Architecture — Infrastructure partagée Docker (shared_infra)¶
Rôle¶
Centraliser tous les services partagés entre projets sur le VPS tekdhi.dev dans un seul réseau Docker shared_infra. Chaque projet se connecte à ce réseau sans démarrer ses propres instances postgres/redis.
Structure¶
Fichier : /home/kanmaber/shared_infra/docker-compose.yml
shared_infra (réseau Docker bridge)
├── shared-postgres → postgresql://psycho_user@shared-postgres:5432
├── shared-redis → redis://shared-redis:6379
├── shared-prometheus → http://127.0.0.1:9090
├── shared-grafana → http://127.0.0.1:3003
├── wikijs → http://127.0.0.1:3010 (wiki.tekdhi.dev)
└── shared-caddy → network_mode: host (ports 80/443)
Interfaces¶
Connexion d'un projet au réseau :
# Dans le docker-compose.yml du projet
networks:
shared_infra:
external: true
name: shared_infra
Variables d'environnement backend :
DATABASE_URL=postgresql://psycho_user:PASSWORD@shared-postgres:5432/psychoenLigne
REDIS_URL=redis://shared-redis:6379
REDIS_HOST=shared-redis
Règles¶
- Aucun projet ne doit déclarer ses propres services
postgresouredis - Caddy est en
network_mode: host— il ne peut pas être dansshared_infrasimultanément - Les volumes postgres/redis sont externes (
psychoenligne_postgres_data,psychoenligne_redis_data) - Wiki.js utilise la même instance postgres avec sa propre DB
wikijs
Décisions clés¶
- PsychoEnLigneV2/decisions/migration-shared-infra — migration psycho-postgres/redis → shared_infra
- shared/debug/caddy-docker-network-mode-host — pourquoi Caddy est en network_mode host
Liens connexes¶
- shared/architecture/vps-ports-services — cartographie complète ports/services
- shared/architecture/postgres-vps-credentials — credentials et procédure from scratch