Implement automatic Nginx updates and hosts synchronization for development and production environments

This commit is contained in:
2026-04-16 14:39:46 +02:00
parent afc7fe3423
commit 09cb8306ff
10 changed files with 287 additions and 4 deletions
+22
View File
@@ -27,5 +27,27 @@ echo " INSTANCE_WILDCARD_KEY_FILE=$INSTANCE_WILDCARD_KEY_FILE"
docker compose build website
docker compose up -d
NGINX_SCRIPT="$SCRIPT_DIR/../nginx.sh"
if [[ -x "$NGINX_SCRIPT" ]]; then
echo "Aktualisiere Nginx Reverse Proxy..."
sudo "$NGINX_SCRIPT" apply || echo "Warnung: Nginx konnte nicht automatisch aktualisiert werden."
fi
# Automatically sync hosts after container start
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ -x "$SCRIPT_DIR/sync_dev_hosts.sh" ]]; then
echo "Warte auf MongoDB-Verfügbarkeit..."
sleep 5
"$SCRIPT_DIR/sync_dev_hosts.sh" || true
echo "Production Hosts werden synchronisiert (stündlich)"
# Starte Background-Daemon für stündliche Sync
if [[ "${PROD_HOSTS_REFRESH_INTERVAL}" != "0" ]]; then
nohup bash -lc "while true; do '$SCRIPT_DIR/sync_dev_hosts.sh' >/dev/null 2>&1 || true; sleep ${PROD_HOSTS_REFRESH_INTERVAL:-3600}; done" \
>"$SCRIPT_DIR/prod-hosts-sync.log" 2>&1 &
echo " Prod-Hosts-Sync läuft im Hintergrund (Log: $SCRIPT_DIR/prod-hosts-sync.log)"
fi
fi
echo "Production stack is running on http://localhost:4999"
echo "Provisioning expects wildcard certificate for all subdomains."