82 lines
2.2 KiB
Markdown
82 lines
2.2 KiB
Markdown
# Runbook — Déploiement Archicratie Web Édition (Blue/Green)
|
||
|
||
## Arborescence NAS (repère)
|
||
- `/volume2/docker/archicratie-web/current/` : état courant (Dockerfile, docker-compose.yml, dist buildé en image)
|
||
- `/volume2/docker/archicratie-web/releases/` : historiques éventuels
|
||
- `/volume2/docker/edge/` : Traefik + config dynamique
|
||
|
||
> Important : les commandes `docker compose -f ...` doivent viser le **docker-compose.yml présent dans `current/`**.
|
||
|
||
---
|
||
|
||
## Pré-requis Synology
|
||
Sur NAS, les commandes ont été exécutées avec :
|
||
en bash
|
||
sudo env DOCKER_API_VERSION=1.43 docker ...
|
||
|
||
(contexte DSM / compat API)
|
||
|
||
### 1) Variables de build (Gitea)
|
||
|
||
Dans /volume2/docker/archicratie-web/current créer/maintenir :
|
||
|
||
cat > .env <<'EOF'
|
||
PUBLIC_GITEA_BASE=https://gitea.archicratie.trans-hands.synology.me
|
||
PUBLIC_GITEA_OWNER=Archicratia
|
||
PUBLIC_GITEA_REPO=archicratie-edition
|
||
EOF
|
||
|
||
### 2) Build images (blue + green) — méthode robuste
|
||
|
||
cd /volume2/docker/archicratie-web/current
|
||
|
||
sudo env DOCKER_API_VERSION=1.43 docker compose -f docker-compose.yml build --no-cache web_blue web_green
|
||
|
||
Puis recréer les conteneurs sans rebuild :
|
||
|
||
sudo env DOCKER_API_VERSION=1.43 docker compose -f docker-compose.yml up -d --force-recreate --no-build web_blue web_green
|
||
|
||
### 3) Vérifier que les deux slots sont OK
|
||
|
||
curl -sS -D- http://127.0.0.1:8081/ | head -n 12
|
||
curl -sS -D- http://127.0.0.1:8082/ | head -n 12
|
||
|
||
Attendu :
|
||
|
||
HTTP/1.1 200 OK
|
||
|
||
Server: nginx/...
|
||
|
||
### 4) Traefik : s’assurer qu’un seul backend est actif
|
||
|
||
Fichier :
|
||
/volume2/docker/edge/config/dynamic/20-archicratie-backend.yml
|
||
|
||
Attendu : une seule URL (8081 OU 8082)
|
||
|
||
http:
|
||
services:
|
||
archicratie_web:
|
||
loadBalancer:
|
||
servers:
|
||
- url: "http://127.0.0.1:8081"
|
||
|
||
### 5) Smoke via Traefik (entrée réelle)
|
||
|
||
curl -sS -H 'Host: archicratie.trans-hands.synology.me' http://127.0.0.1:18080/ | head -n 20
|
||
|
||
Attendu :
|
||
|
||
si non loggé : 302 vers Authelia
|
||
|
||
si loggé : HTML du site
|
||
|
||
### 6) Piège classique : conflit de nom de conteneur
|
||
|
||
Si :
|
||
Conflict. The container name "/archicratie-web-blue" is already in use...
|
||
|
||
Faire :
|
||
|
||
sudo docker rm -f archicratie-web-blue
|
||
sudo env DOCKER_API_VERSION=1.43 docker compose -f docker-compose.yml up -d --force-recreate --no-build web_blue |