master user anlegen #2
|
|
@ -25,10 +25,15 @@ jobs:
|
|||
fi
|
||||
docker compose -f docker-compose.dev-env.yml build --no-cache backend frontend
|
||||
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
|
||||
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
|
||||
fi
|
||||
echo "✓ DEV API /api/health OK"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ ENV PIP_DEFAULT_TIMEOUT=120
|
|||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
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,24 +11,25 @@ from fastapi.middleware.cors import CORSMiddleware
|
|||
from db import check_db
|
||||
from version import APP_NAME, APP_VERSION, DB_SCHEMA_VERSION
|
||||
|
||||
if os.getenv("SKIP_DB_MIGRATE", "").strip().lower() in ("1", "true", "yes"):
|
||||
print("[SKIP_DB_MIGRATE] Migrationen übersprungen")
|
||||
else:
|
||||
if os.getenv("KAIRO_DB_READY") != "1":
|
||||
if os.getenv("SKIP_DB_MIGRATE", "").strip().lower() not in ("1", "true", "yes"):
|
||||
import run_migrations
|
||||
|
||||
exit_code = run_migrations.main()
|
||||
if exit_code != 0:
|
||||
print(f"[FAIL] Migrationen fehlgeschlagen (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
|
||||
|
||||
exit_code = run_seeds.main()
|
||||
if exit_code != 0:
|
||||
print(f"[FAIL] Seeds fehlgeschlagen (Exit {exit_code})")
|
||||
sys.exit(exit_code)
|
||||
else:
|
||||
else:
|
||||
print("[SKIP_SEEDS] Data-Seeds übersprungen")
|
||||
|
||||
allowed_origins = [
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
-- Dev/CI: pytest-Artefakte entfernen (idempotent, sicher mehrfach ausführbar).
|
||||
-- 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)
|
||||
DELETE FROM actors
|
||||
WHERE user_id IN (SELECT id FROM users WHERE email ~* '@example\.com$');
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ services:
|
|||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
start_period: 30s
|
||||
retries: 18
|
||||
start_period: 90s
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- dev-kairo-network
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user