- Drop @supabase/supabase-js entirely; add drizzle-orm + postgres (porsager) driver - New packages/db: schema (pgSchema ordinarthur_os), client factory, migrate runner, drizzle-kit config - SQL migrations: 0000_init (pgcrypto + schema), 0001_jobs (jobs + job_search_criteria, no RLS) - Rewrite apps/api db module with DI symbols DB/DB_HANDLE + @InjectDb() decorator - Rewrite jobs.service.ts with Drizzle queries (upsert via onConflictDoUpdate, arrayOverlaps for stack filter) - Replace SUPABASE_* env vars with DATABASE_URL in env config + .env.example - Add docker-compose.yml (Postgres 16-alpine, dev only) - Add deploy/k8s/postgres.yaml (StatefulSet + PVC), migrate.job.yaml, updated secrets.template.yaml - Update all docs (README, PLAN, ARCHITECTURE, CLAUDE.md, AGENTS.md, packages/db/README.md) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
38 lines
1.7 KiB
Markdown
38 lines
1.7 KiB
Markdown
# deploy/k8s
|
|
|
|
Manifests Kubernetes pour le k3s perso d'Arthur.
|
|
|
|
## Stack
|
|
|
|
- `postgres.yaml` — StatefulSet Postgres 16 + PVC 5 Gi (single-user, faible volume).
|
|
- `api.deployment.yaml` / `pwa.deployment.yaml` — services applicatifs.
|
|
- `ingress.yaml` — routage Traefik TLS vers `os.arthurbarre.fr` et `api.os.arthurbarre.fr`.
|
|
- `migrate.job.yaml` — job one-shot `drizzle-orm` pour appliquer les migrations.
|
|
- `backup.cronjob.yaml` — `pg_dump` quotidien vers un bucket S3-compatible via `rclone`.
|
|
|
|
## Ordre d'application initial
|
|
|
|
```bash
|
|
kubectl apply -f namespace.yaml
|
|
# Copier secrets.template.yaml -> secrets.yaml, remplir, puis :
|
|
kubectl apply -f secrets.yaml
|
|
kubectl apply -f postgres.yaml
|
|
# Attendre que le pod postgres soit Ready.
|
|
kubectl apply -f migrate.job.yaml # crée le schéma ordinarthur_os + tables
|
|
kubectl apply -f api.deployment.yaml
|
|
kubectl apply -f pwa.deployment.yaml
|
|
kubectl apply -f ingress.yaml
|
|
# Une fois le bucket S3 choisi :
|
|
kubectl apply -f backup.cronjob.yaml
|
|
```
|
|
|
|
## Points à confirmer avec Arthur avant déploiement réel
|
|
|
|
- Cluster issuer cert-manager (`letsencrypt-prod` ?)
|
|
- Entrée Traefik (`websecure` ?)
|
|
- DNS : `os.arthurbarre.fr` et `api.os.arthurbarre.fr` doivent pointer sur l'IP du load-balancer k3s
|
|
- StorageClass du PVC postgres (k3s fournit `local-path` par défaut — OK pour single-node)
|
|
- Bucket S3-compatible pour les backups (B2 / Scaleway / autre)
|
|
- Image registry : Gitea CR (défaut) — credentials pull peuvent nécessiter un `imagePullSecrets`
|
|
- Image pour le `migrate.job` : soit re-utiliser l'image API et `node ./node_modules/.../migrate.ts` via tsx, soit builder une image dédiée `ordinarthur-os-migrate` qui embarque `packages/db` compilé.
|