64 lines
3.9 KiB
Markdown
64 lines
3.9 KiB
Markdown
# Deployment View
|
|
|
|
## Infrastructure Overview
|
|
|
|
```txt
|
|
┌──────────────┐ HTTPS/WSS ┌──────────────────────────────┐
|
|
│ Discord APIs │◄───────────────────►│ Coolify backend resource │
|
|
└──────────────┘ │ port 8787 │
|
|
│ - Discord gateway runtime │
|
|
│ - Admin API (Express) │
|
|
│ - Dailies pollers │
|
|
└──────────────┬───────────────┘
|
|
│
|
|
▼
|
|
┌───────────────────┐
|
|
│ PostgreSQL │
|
|
│ mileage + config │
|
|
└───────────────────┘
|
|
|
|
Internet
|
|
│
|
|
▼
|
|
┌──────────────────────────┐
|
|
│ Nginx edge reverse proxy │
|
|
│ - TLS termination │
|
|
│ - Host/path routing │
|
|
└─────────────┬────────────┘
|
|
│
|
|
┌────────┴───────────┐
|
|
▼ ▼
|
|
┌───────────────┐ ┌──────────────────────────┐
|
|
│ Coolify │ │ Coolify dashboard │
|
|
│ backend │ │ resource │
|
|
│ port 8787 │ │ port 80 │
|
|
└───────────────┘ │ 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).
|
|
4. In two-resource production setup, deploy webhooks can independently trigger backend and dashboard resources.
|
|
|
|
## 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 | Nginx edge + Coolify backend/dashboard resources | Managed PostgreSQL | Host-based routing, TLS termination, 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.
|
|
- Risk: edge proxy misroutes dashboard/API traffic.
|
|
Mitigation: verify upstream hostnames/ports and health checks after deploy.
|