50 lines
3.9 KiB
Markdown
50 lines
3.9 KiB
Markdown
# Deployment View
|
|
|
|
## Infrastructure Overview
|
|
|
|
```txt
|
|
┌──────────────┐ 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 │ │ │
|
|
└──────────────────────────┘ └─────────────────────────────┘
|
|
```
|
|
|
|
## CI/CD Pipeline
|
|
|
|
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.
|