40 lines
1.2 KiB
Bash
40 lines
1.2 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
echo "=== Customer Portal Startup ==="
|
|
|
|
# Warte auf PostgreSQL
|
|
echo "Warte auf PostgreSQL..."
|
|
while ! pg_isready -h portal-db -U portal -d customer_portal; do
|
|
echo "PostgreSQL nicht bereit, warte 2 Sekunden..."
|
|
sleep 2
|
|
done
|
|
echo "PostgreSQL ist bereit!"
|
|
|
|
# Datenbank-Migrations ausfuehren (in Reihenfolge)
|
|
echo "Fuehre Datenbank-Migrations aus..."
|
|
|
|
# Die Migrations sind idempotent - pruefen selbst ob bereits ausgefuehrt
|
|
python -m customer_portal.migrations.001_add_custom_fields || true
|
|
python -m customer_portal.migrations.002_add_admin_and_settings || true
|
|
python -m customer_portal.migrations.003_add_email_preferences || true
|
|
python -m customer_portal.migrations.004_consolidate_customer_fields || true
|
|
python -m customer_portal.migrations.005_text_to_jsonb || true
|
|
python -m customer_portal.migrations.006_drop_legacy_columns || true
|
|
|
|
echo "Migrations abgeschlossen!"
|
|
|
|
# Starte Gunicorn
|
|
echo "Starte Gunicorn..."
|
|
exec gunicorn \
|
|
--bind 0.0.0.0:8000 \
|
|
--workers 2 \
|
|
--threads 4 \
|
|
--timeout 30 \
|
|
--graceful-timeout 30 \
|
|
--keep-alive 5 \
|
|
--access-logfile - \
|
|
--error-logfile - \
|
|
--capture-output \
|
|
"customer_portal.web.app:create_app()"
|