Files
servesync-demo/backend/start.sh

22 lines
523 B
Bash

#!/bin/bash
set -e
echo "Waiting for database..."
until python -c "
import psycopg2, os
try:
conn = psycopg2.connect(os.environ.get('DATABASE_URL', 'postgresql://servesync:servesync@db:5432/servesync'))
conn.close()
print('DB ready')
except Exception as e:
print(f'DB not ready: {e}')
exit(1)
"; do
sleep 2
done
echo "Running seed..."
cd /app && python seed.py && echo "Seed complete" || echo "Seed failed (continuing)"
echo "Starting server..."
exec uvicorn app.main:app --host 0.0.0.0 --port 8000