#!/bin/sh # Starts the unified AlertHub app (frontoffice + /backoffice) on a single port. # POSIX /bin/sh (dash) compatible. Uses exec so Gunicorn becomes the container's # main process and receives signals directly for clean, graceful shutdown. set -eu PORT="${APP_PORT:-${FRONTOFFICE_PORT:-8080}}" # A single worker guarantees exactly one reminder scheduler. Concurrency is # handled with threads, which is plenty for this internal tool. You can raise # GUNICORN_THREADS if needed; leave GUNICORN_WORKERS at 1 to avoid running the # scheduler more than once. WORKERS="${GUNICORN_WORKERS:-1}" THREADS="${GUNICORN_THREADS:-4}" echo ">> AlertHub starting (frontoffice + /backoffice on one port)" echo " listening -> 0.0.0.0:${PORT}" exec gunicorn --bind "0.0.0.0:${PORT}" \ --workers "${WORKERS}" \ --threads "${THREADS}" \ --timeout 60 \ --graceful-timeout 30 \ --access-logfile - \ --error-logfile - \ "wsgi:application"