feat: Add health check and diagnostics to launch_dev.sh for improved reliability
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -36,6 +36,9 @@ RUN set -eu; \
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application sources into the image (templates, static, main app, config)
|
||||
COPY . /app
|
||||
|
||||
EXPOSE 4999
|
||||
|
||||
CMD ["gunicorn", "-c", "gunicorn.conf.py", "main:app"]
|
||||
|
||||
@@ -15,6 +15,12 @@ echo " INSTANCE_TLS_MODE=$INSTANCE_TLS_MODE"
|
||||
echo " INSTANCE_PARENT_DOMAIN=$INSTANCE_PARENT_DOMAIN"
|
||||
echo " DEV_HOSTS_REFRESH_INTERVAL=$DEV_HOSTS_REFRESH_INTERVAL"
|
||||
|
||||
# Ensure required runtime files exist before building
|
||||
if [ ! -f "$SCRIPT_DIR/gunicorn.conf.py" ]; then
|
||||
echo "[FEHLER] gunicorn.conf.py fehlt in $SCRIPT_DIR. Bitte prüfen." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
docker compose build website
|
||||
docker compose up -d
|
||||
|
||||
@@ -24,6 +30,31 @@ if [[ -x "$NGINX_SCRIPT" ]]; then
|
||||
sudo "$NGINX_SCRIPT" apply || echo "Warnung: Nginx konnte nicht automatisch aktualisiert werden."
|
||||
fi
|
||||
|
||||
# Wait for website to become healthy (simple HTTP check)
|
||||
check_url="http://127.0.0.1:4999/"
|
||||
timeout_seconds=60
|
||||
interval=2
|
||||
elapsed=0
|
||||
|
||||
echo "Warte auf Website (${check_url}) bis ${timeout_seconds}s..."
|
||||
while [ $elapsed -lt $timeout_seconds ]; do
|
||||
if curl -sS --max-time 2 "$check_url" >/dev/null 2>&1; then
|
||||
echo "Website erreichbar nach ${elapsed}s"
|
||||
break
|
||||
fi
|
||||
sleep $interval
|
||||
elapsed=$((elapsed + interval))
|
||||
done
|
||||
|
||||
if [ $elapsed -ge $timeout_seconds ]; then
|
||||
echo "[FEHLER] Website nicht erreichbar nach ${timeout_seconds}s. Sammle Diagnosedaten..."
|
||||
echo "--- docker compose ps ---"
|
||||
docker compose ps || true
|
||||
echo "--- docker logs website (tail 200) ---"
|
||||
docker logs --tail 200 website-website-1 || true
|
||||
echo "Bitte prüfe Container-Logs und nginx-Konfiguration."
|
||||
fi
|
||||
|
||||
if [[ -x "$SCRIPT_DIR/sync_dev_hosts.sh" ]]; then
|
||||
"$SCRIPT_DIR/sync_dev_hosts.sh" || true
|
||||
if [[ "${DEV_HOSTS_REFRESH_INTERVAL}" != "0" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user