feat: update documentation for architecture, runtime scenarios, and deployment strategies

This commit is contained in:
2026-05-17 16:54:00 +02:00
parent a402c7b0bb
commit 168f4ea13c
5 changed files with 176 additions and 135 deletions
+41 -38
View File
@@ -3,44 +3,47 @@
## Infrastructure Overview
```txt
┌─────────────┐ ┌──────────────────────────────────────┐
Discord │◄─────►│ Coolify
│ Gateway │ WSS │
│ + REST API │ │ ┌──────────────────────────────┐
└─────────────┘ │ │ omo-bot (Node.js process)
│ - Command handlers
│ - Event listeners
- Mileage engine │
│ └─────────────────────────────┘
│ ▼ │
│ ┌──────────────────────────────┐
│ │ PostgreSQL (local) │
- User profiles │
│ │ - Mileage scores │ │
│ │ - Event schedules │ │
│ │ - Content cache │ │
│ └──────────────────────────────┘
│ ┌──────────────────────────────┐ │
│ │ Admin API / Dashboard │ │
│ │ (React SPA) │ │
│ │ admin.openmicodyssey.com │ │
│ └──────────────────────────────┘ │
└──────────────────────────────────────┘
OAuth2 │
┌─────────────────────┐
│ openmicodyssey.com │
│ (Web Application) │
└─────────────────────┘
┌─────────────HTTPS/WSS ┌───────────────────────────────────┐
│ Discord APIs │◄───────────────────►│ Coolify deployment
└──────────────┘ │ ┌───────────────────────────────┐
│ │ Backend container │
│ │ - Discord gateway runtime
- Admin API (Express) │ │
- Dailies pollers
│ └──────────────┬────────────────┘
└───────────────────────────────────┘
───────────────────┐
│ PostgreSQL
│ mileage + config
└───────────────────┘
┌──────────────────────────┐ HTTPS ┌─────────────────────────────┐
│ Admin Dashboard (SPA) │◄───────────►│ Admin API + OAuth bridge
│ React/Vite static deploy │ │ │
└──────────────────────────┘ ─────────────────────────────
```
## Environments
## CI/CD Pipeline
| Environment | Host | Bot Instance | DB | Purpose |
| ----------- | ---------------- | ------------ | ---------------- | ---------------------------- | ---------------------- |
| Development | Local machine | 1 process | Local Postgres | Feature development, testing |
| Staging | Coolify | 1 instance | Staging Postgres | Integration | Pre-release validation |
| Production | Coolify (scaled) | 2+ instances | Production (HA) | Live community server |
Source file: `.gitea/workflows/ci-cd.yml`
1. Bot job: install dependencies, run lint, build, and test.
2. Dashboard job: install dependencies in `admin-dashboard`, run lint/build.
3. Deploy job: on `main`, trigger Coolify webhook (optionally authenticated with token).
## Environment Matrix
| Environment | Runtime | Database | Notes |
| ----------------- | --------------------------------- | -------------------------------------- | ------------------------------------------- |
| Local development | Node.js process via `npm run dev` | Local/Postgres dev instance | Fast iteration, manual command registration |
| CI | Ephemeral runner | Test/dev DB or mocked integration path | Quality gates before deployment |
| Production | Coolify-managed container(s) | Managed PostgreSQL | Webhook-triggered deployment from Gitea |
## Deployment Risks and Mitigations
- Risk: bot restarts clear in-memory OAuth sessions.
Mitigation: dashboard re-auth flow and short-lived session design.
- Risk: DB connectivity interruptions.
Mitigation: startup validation + retry behavior on mileage writes.