From 974886268464230259dffe665286b8e044ebeefb Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 7 Apr 2026 15:29:32 +0200 Subject: [PATCH] fix(infra) : add deploy.sh with maintenance mode like Inventory Maintenance is handled by nginx-proxy on the host, not inside the container. deploy.sh extracts maintenance.html from the container. Co-Authored-By: Claude Opus 4.6 (1M context) --- infra/prod/deploy.sh | 38 ++++++++++++++++++++++++++++++++++++++ infra/prod/nginx.conf | 10 ---------- 2 files changed, 38 insertions(+), 10 deletions(-) create mode 100755 infra/prod/deploy.sh diff --git a/infra/prod/deploy.sh b/infra/prod/deploy.sh new file mode 100755 index 0000000..e51dae1 --- /dev/null +++ b/infra/prod/deploy.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname "$0")" + +TAG="${1:-latest}" +export COLTURA_IMAGE_TAG="$TAG" + +echo "==> Deploying coltura:${TAG}..." + +echo "==> Enabling maintenance mode..." +touch maintenance.on + +echo "==> Pulling image..." +sudo docker compose pull + +echo "==> Starting container..." +sudo docker compose up -d + +echo "==> Waiting for container to be ready..." +sleep 3 + +echo "==> Extracting maintenance page..." +mkdir -p public +sudo docker compose cp app:/var/www/html/public/maintenance.html public/maintenance.html + +echo "==> Running migrations..." +sudo docker compose exec -T -u www-data app php bin/console doctrine:migrations:migrate --no-interaction + +echo "==> Clearing cache..." +sudo docker compose exec -T -u www-data app php bin/console cache:clear --env=prod +sudo docker compose exec -T -u www-data app php bin/console cache:warmup --env=prod + +echo "==> Disabling maintenance mode..." +rm -f maintenance.on + +VERSION=$(sudo docker compose exec -T app cat config/version.yaml | grep 'app.version' | awk -F"'" '{print $2}') +echo "==> Deployed v${VERSION}" diff --git a/infra/prod/nginx.conf b/infra/prod/nginx.conf index 580e0cb..f30b15e 100644 --- a/infra/prod/nginx.conf +++ b/infra/prod/nginx.conf @@ -10,16 +10,6 @@ server { access_log /dev/stdout; error_log /dev/stderr; - # Mode maintenance : créer /var/www/html/maintenance.on pour activer - if (-f /var/www/html/maintenance.on) { - return 503; - } - error_page 503 @maintenance; - location @maintenance { - root /var/www/html/public; - rewrite ^(.*)$ /maintenance.html break; - } - location ^~ /api/ { root /var/www/html/public; try_files $uri /index.php?$query_string;