Files
FabledCurator/entrypoint.sh
T
bvandeusen b68a382b60 feat(fc2b): importer enqueues tag_and_embed + ml-worker model self-heal
import_media_file now enqueues tag_and_embed alongside generate_thumbnail
after a successful import. scripts/download_models.py snapshots Camie +
SigLIP into /models, idempotent (skips when present). The ml-worker
entrypoint runs it before starting the Celery worker so a fresh /models
volume self-heals on first boot. Downloader tests are pure-logic (no
network in CI).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 07:45:09 -04:00

63 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROLE="${1:-web}"
shift || true
case "$ROLE" in
web)
echo "[entrypoint] Running alembic upgrade head"
alembic upgrade head
echo "[entrypoint] Starting hypercorn on :8080"
exec hypercorn \
--bind 0.0.0.0:8080 \
--workers "${HYPERCORN_WORKERS:-2}" \
--access-logfile - \
backend.app:create_app
;;
worker)
QUEUES="${CELERY_QUEUES:-default,import,thumbnail}"
CONCURRENCY="${CELERY_CONCURRENCY:-2}"
echo "[entrypoint] Starting Celery worker queues=$QUEUES concurrency=$CONCURRENCY"
exec celery -A backend.app.celery_app:celery worker \
--loglevel=info \
-Q "$QUEUES" \
--concurrency="$CONCURRENCY"
;;
scheduler)
QUEUES="${CELERY_QUEUES:-maintenance,scan}"
echo "[entrypoint] Starting Celery beat+worker queues=$QUEUES"
exec celery -A backend.app.celery_app:celery worker \
--beat \
--loglevel=info \
-Q "$QUEUES" \
--concurrency=1
;;
ml-worker)
echo "[entrypoint] Ensuring ML models present in /models..."
python -m backend.app.scripts.download_models
echo "[entrypoint] Starting ML Celery worker (ml queue)"
exec celery -A backend.app.celery_app:celery worker \
--loglevel=info \
-Q ml \
--concurrency=1
;;
shell|bash)
exec /bin/bash "$@"
;;
alembic)
exec alembic "$@"
;;
*)
echo "[entrypoint] Unknown role: $ROLE" >&2
echo "[entrypoint] Valid roles: web | worker | scheduler | ml-worker | shell | alembic" >&2
exit 1
;;
esac