Deploy-Fix: Migrationen/Seeds im Entrypoint, laengere Healthcheck-Phase, Logs bei Fehler.
All checks were successful
Deploy Development / deploy (push) Successful in 1m0s
Test Suite / pytest-backend (push) Successful in 9s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s
All checks were successful
Deploy Development / deploy (push) Successful in 1m0s
Test Suite / pytest-backend (push) Successful in 9s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
7a6eb3abe8
commit
598677d343
|
|
@ -25,10 +25,15 @@ jobs:
|
||||||
fi
|
fi
|
||||||
docker compose -f docker-compose.dev-env.yml build --no-cache backend frontend
|
docker compose -f docker-compose.dev-env.yml build --no-cache backend frontend
|
||||||
echo "✓ Backend + Frontend gebaut (Frontend: npm run build im Dockerfile)"
|
echo "✓ Backend + Frontend gebaut (Frontend: npm run build im Dockerfile)"
|
||||||
docker compose -f docker-compose.dev-env.yml up -d --wait
|
if ! docker compose -f docker-compose.dev-env.yml up -d --wait; then
|
||||||
|
echo "✗ compose up --wait fehlgeschlagen — Backend-Logs:"
|
||||||
|
docker compose -f docker-compose.dev-env.yml logs backend --tail 150 || true
|
||||||
|
docker compose -f docker-compose.dev-env.yml ps || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if ! curl -sf http://localhost:8097/api/health; then
|
if ! curl -sf http://localhost:8097/api/health; then
|
||||||
echo "✗ DEV API nicht erreichbar — Backend-Logs:"
|
echo "✗ DEV API nicht erreichbar — Backend-Logs:"
|
||||||
docker compose -f docker-compose.dev-env.yml logs backend --tail 120 || true
|
docker compose -f docker-compose.dev-env.yml logs backend --tail 150 || true
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "✓ DEV API /api/health OK"
|
echo "✓ DEV API /api/health OK"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@ ENV PIP_DEFAULT_TIMEOUT=120
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
|
|
|
||||||
20
backend/entrypoint.sh
Normal file
20
backend/entrypoint.sh
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "=== Kairo Backend Startup ==="
|
||||||
|
|
||||||
|
if [ "${SKIP_DB_MIGRATE}" != "1" ] && [ "${SKIP_DB_MIGRATE}" != "true" ] && [ "${SKIP_DB_MIGRATE}" != "yes" ]; then
|
||||||
|
python run_migrations.py
|
||||||
|
else
|
||||||
|
echo "[SKIP_DB_MIGRATE] Migrationen übersprungen"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${SKIP_SEEDS}" != "1" ] && [ "${SKIP_SEEDS}" != "true" ] && [ "${SKIP_SEEDS}" != "yes" ]; then
|
||||||
|
python run_seeds.py
|
||||||
|
else
|
||||||
|
echo "[SKIP_SEEDS] Data-Seeds übersprungen"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export KAIRO_DB_READY=1
|
||||||
|
echo "=== Starte Anwendung: $* ==="
|
||||||
|
exec "$@"
|
||||||
|
|
@ -11,25 +11,26 @@ from fastapi.middleware.cors import CORSMiddleware
|
||||||
from db import check_db
|
from db import check_db
|
||||||
from version import APP_NAME, APP_VERSION, DB_SCHEMA_VERSION
|
from version import APP_NAME, APP_VERSION, DB_SCHEMA_VERSION
|
||||||
|
|
||||||
if os.getenv("SKIP_DB_MIGRATE", "").strip().lower() in ("1", "true", "yes"):
|
if os.getenv("KAIRO_DB_READY") != "1":
|
||||||
print("[SKIP_DB_MIGRATE] Migrationen übersprungen")
|
if os.getenv("SKIP_DB_MIGRATE", "").strip().lower() not in ("1", "true", "yes"):
|
||||||
else:
|
import run_migrations
|
||||||
import run_migrations
|
|
||||||
|
|
||||||
exit_code = run_migrations.main()
|
exit_code = run_migrations.main()
|
||||||
if exit_code != 0:
|
if exit_code != 0:
|
||||||
print(f"[FAIL] Migrationen fehlgeschlagen (Exit {exit_code})")
|
print(f"[FAIL] Migrationen fehlgeschlagen (Exit {exit_code})")
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
|
else:
|
||||||
|
print("[SKIP_DB_MIGRATE] Migrationen übersprungen")
|
||||||
|
|
||||||
if os.getenv("SKIP_SEEDS", "").strip().lower() not in ("1", "true", "yes"):
|
if os.getenv("SKIP_SEEDS", "").strip().lower() not in ("1", "true", "yes"):
|
||||||
import run_seeds
|
import run_seeds
|
||||||
|
|
||||||
exit_code = run_seeds.main()
|
exit_code = run_seeds.main()
|
||||||
if exit_code != 0:
|
if exit_code != 0:
|
||||||
print(f"[FAIL] Seeds fehlgeschlagen (Exit {exit_code})")
|
print(f"[FAIL] Seeds fehlgeschlagen (Exit {exit_code})")
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
else:
|
else:
|
||||||
print("[SKIP_SEEDS] Data-Seeds übersprungen")
|
print("[SKIP_SEEDS] Data-Seeds übersprungen")
|
||||||
|
|
||||||
allowed_origins = [
|
allowed_origins = [
|
||||||
origin.strip()
|
origin.strip()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
-- Dev/CI: pytest-Artefakte entfernen (idempotent, sicher mehrfach ausführbar).
|
-- Dev/CI: pytest-Artefakte entfernen (idempotent, sicher mehrfach ausführbar).
|
||||||
-- Nur in Nicht-Prod-Umgebungen (Dateiname *.dev.sql).
|
-- Nur in Nicht-Prod-Umgebungen (Dateiname *.dev.sql).
|
||||||
|
|
||||||
|
-- Reparatur: ungültige Human-Actors (user_id NULL verletzt CHECK constraint)
|
||||||
|
DELETE FROM actors WHERE actor_type = 'human' AND user_id IS NULL;
|
||||||
|
|
||||||
-- Abhängigkeiten vor User-Löschung (human actors: user_id NOT NULL constraint)
|
-- Abhängigkeiten vor User-Löschung (human actors: user_id NOT NULL constraint)
|
||||||
DELETE FROM actors
|
DELETE FROM actors
|
||||||
WHERE user_id IN (SELECT id FROM users WHERE email ~* '@example\.com$');
|
WHERE user_id IN (SELECT id FROM users WHERE email ~* '@example\.com$');
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ services:
|
||||||
]
|
]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 12
|
retries: 18
|
||||||
start_period: 30s
|
start_period: 90s
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- dev-kairo-network
|
- dev-kairo-network
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user