- sogoctl: supervisor avec health checks et restart auto - sogoway: gateway HTTP, auth JWT, routing par hostname - sogoms-db: microservice MariaDB avec pool par application - Protocol IPC Unix socket JSON length-prefixed - Config YAML multi-application (prokov) - Deploy script pour container Alpine gw3 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
98 lines
2.0 KiB
Markdown
98 lines
2.0 KiB
Markdown
# SOGOMS
|
|
|
|
**Service Oriented GO MicroServices** - Plateforme SaaS modulaire multi-tenant.
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Client → Nginx(:443) → Sogoway(:8080) → Sogoms-db → MariaDB
|
|
↓
|
|
Unix Socket
|
|
```
|
|
|
|
| Binaire | Rôle | Port/Socket |
|
|
|---------|------|-------------|
|
|
| `sogoctl` | Superviseur PID 1, health checks, restart auto | - |
|
|
| `sogoway` | Gateway HTTP, auth JWT, routing par hostname | TCP :8080 |
|
|
| `sogoms-db` | Accès MariaDB, pool par application | Unix socket |
|
|
|
|
## Déploiement
|
|
|
|
```bash
|
|
./deploy.sh
|
|
```
|
|
|
|
Déploie sur le container `gw3` (Alpine) via IN3.
|
|
|
|
## Lancement
|
|
|
|
Sur gw3 :
|
|
|
|
```bash
|
|
/opt/sogoms/bin/sogoctl
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Chaque application cliente a son fichier dans `config/routes/` :
|
|
|
|
```yaml
|
|
# config/routes/prokov.yaml
|
|
app: prokov
|
|
hosts:
|
|
- prokov.unikoffice.com
|
|
database:
|
|
host: 13.23.33.4
|
|
user: prokov_user
|
|
password_file: /secrets/prokov_db_pass
|
|
name: prokov
|
|
auth:
|
|
jwt_secret_file: /secrets/prokov_jwt_secret
|
|
jwt_expiry: 24h
|
|
```
|
|
|
|
## Structure
|
|
|
|
```
|
|
cmd/
|
|
sogoctl/main.go # Superviseur
|
|
sogoway/main.go # Gateway HTTP
|
|
sogoms/db/main.go # Microservice DB
|
|
internal/
|
|
protocol/ # IPC Unix socket (JSON length-prefixed)
|
|
config/ # Chargement YAML, registry par host
|
|
auth/ # JWT (HS256), bcrypt passwords
|
|
config/
|
|
sogoctl.yaml # Services à superviser
|
|
routes/*.yaml # Config par application
|
|
scenarios/ # Scénarios YAML (V2)
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
```bash
|
|
# Health check
|
|
curl http://localhost:8080/health
|
|
|
|
# Login
|
|
curl -X POST http://localhost:8080/api/auth/login \
|
|
-H "Host: prokov.unikoffice.com" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"email":"user@example.com","password":"secret"}'
|
|
|
|
# User info (avec token)
|
|
curl http://localhost:8080/api/auth/me \
|
|
-H "Host: prokov.unikoffice.com" \
|
|
-H "Authorization: Bearer <token>"
|
|
```
|
|
|
|
## Prérequis
|
|
|
|
- Go 1.22+
|
|
- MariaDB/MySQL
|
|
- Container Alpine (gw3)
|
|
|
|
## Licence
|
|
|
|
Propriétaire
|