CoolFace
Apppublic

cmoss3/RcmEmailAutomation

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
entrypoint.sh30 linesDownload Raw Back to root
1#!/bin/bash2set -e3 4# Apply DB migrations once (idempotent — both processes also call init_db5# defensively in case alembic was skipped during local dev).6alembic upgrade head7 8# Start the background routing processor (poll loop).9python -m app.processor &10PROCESSOR_PID=$!11 12# Start the standalone scheduler (subscription bootstrap + APScheduler cron13# jobs). Runs in its own process so the FastAPI server below can scale to14# multiple uvicorn workers without duplicating cron work.15python -m app.scheduler_main &16SCHEDULER_PID=$!17 18# Forward SIGTERM/SIGINT and EXIT to the background processes so the19# container shuts down cleanly.20trap "kill ${PROCESSOR_PID} ${SCHEDULER_PID} 2>/dev/null; \21      wait ${PROCESSOR_PID} ${SCHEDULER_PID} 2>/dev/null" EXIT TERM INT22 23# FastAPI in the foreground. UVICORN_WORKERS controls horizontal scaling24# of the webhook receiver. Safe to bump because scheduler + processor are25# in their own processes.26exec uvicorn app.main:app \27    --host "${HOST:-0.0.0.0}" \28    --port "${PORT:-8000}" \29    --workers "${UVICORN_WORKERS:-2}"30