Fix deploy.sh: auto-update nginx config on deploy (STI-93)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled

deploy.sh was only updating Docker containers but never copying the
nginx config to the host. This meant changes like the sub_filter fix
for GrampsWeb's <base href> rewrite were never applied.

Now diffs deploy-production/nginx.conf against /etc/nginx/sites-enabled/stiftung
and reloads nginx when changed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
SysAdmin Agent
2026-03-24 00:25:55 +00:00
parent 951c434ef2
commit cee51ccec2

View File

@@ -135,6 +135,23 @@ echo ""
echo "--- Collecting static files ---" echo "--- Collecting static files ---"
docker compose -f "$COMPOSE_FILE" exec -T web python manage.py collectstatic --noinput docker compose -f "$COMPOSE_FILE" exec -T web python manage.py collectstatic --noinput
echo ""
echo "--- Updating nginx config ---"
NGINX_CONF="$PROD_DIR/deploy-production/nginx.conf"
NGINX_DEST="/etc/nginx/sites-enabled/stiftung"
if [[ -f "$NGINX_CONF" ]]; then
if ! diff -q "$NGINX_CONF" "$NGINX_DEST" &>/dev/null; then
echo "Nginx config changed — updating and reloading"
sudo cp "$NGINX_CONF" "$NGINX_DEST"
sudo nginx -t && sudo systemctl reload nginx
echo "Nginx reloaded"
else
echo "Nginx config unchanged — skipping"
fi
else
echo "WARNUNG: $NGINX_CONF nicht gefunden — nginx nicht aktualisiert"
fi
echo "" echo ""
echo "--- Service status ---" echo "--- Service status ---"
docker compose -f "$COMPOSE_FILE" ps docker compose -f "$COMPOSE_FILE" ps