#!/bin/bash cd "/app" || exit 1 export PYTHONPATH="$PYTHONPATH:/app/" # Ensure we can write the logs chown -R appuser:appuser /app/logs # Wait for the database to be ready echo "Waiting for database to be ready" until pg_isready -h $DB_HOST -p $DB_PORT; do echo "Postgres is unavailable - sleeping" sleep 2 done echo "Postgres is up - executing commands" # Set FLASK_APP environment variables PROJECT_DIR="/app" export FLASK_APP=${PROJECT_DIR}/scripts/run_eveai_chat_client.py export PYTHONPATH="$PROJECT_DIR/patched_packages:$PYTHONPATH:$PROJECT_DIR" # Start Flask app with Gunicorn gunicorn -w 1 -k gevent -b 0.0.0.0:5004 --worker-connections 100 scripts.run_eveai_chat_client:app