Files
multi-seal-mail/server/entrypoint.sh

26 lines
723 B
Bash

#!/usr/bin/env sh
set -e
ROLE="${APP_ROLE:-api}"
if [ "$ROLE" = "api" ]; then
if [ "${RUN_DB_MIGRATIONS:-true}" = "true" ]; then
python -m app.db.migrate
fi
exec uvicorn app.main:app \
--host "${APP_HOST:-0.0.0.0}" \
--port "${APP_PORT:-8000}" \
--proxy-headers
elif [ "$ROLE" = "worker" ]; then
exec celery -A app.celery_app.celery worker \
--loglevel="${CELERY_LOGLEVEL:-INFO}" \
--queues="${CELERY_QUEUES:-send_email,append_sent,default}" \
--concurrency="${CELERY_CONCURRENCY:-4}" \
--prefetch-multiplier="${CELERY_PREFETCH_MULTIPLIER:-1}" \
--max-tasks-per-child="${CELERY_MAX_TASKS_PER_CHILD:-200}"
else
echo "Unknown APP_ROLE=$ROLE (expected api|worker)"
exit 1
fi