#!/bin/bash set -e # Run standard postgres entrypoint in background # This will initialize the DB (running init.sql) if it's the first time echo "Starting PostgreSQL in background..." bash /docker-entrypoint.sh postgres & # Wait for PostgreSQL to become available echo "Waiting for PostgreSQL to start..." until pg_isready -h localhost -p 5432 -U postgres; do sleep 2 done echo "PostgreSQL is ready!" # Start the Streamlit application in the foreground echo "Starting Background Ingest Worker..." python3 -u ingest_worker.py > /tmp/ingest.log 2>&1 & echo "Starting FastAPI Server..." uvicorn api:app --host 0.0.0.0 --port 8000 & echo "Starting Streamlit..." streamlit run app.py --server.port 8501 --server.address 0.0.0.0 & echo "Starting MCP SSE Server..." python3 -u mcp_server.py > /tmp/mcp.log 2>&1 & echo "Starting Nginx Proxy..." nginx -g "daemon off;"