-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathentry.sh
More file actions
43 lines (36 loc) · 1.28 KB
/
entry.sh
File metadata and controls
43 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Usage:
# Set CONTAINER_ROLE to control which process this container runs:
# worker — Celery worker
# beat — Celery beat scheduler
# (unset) — Backend API server (default)
echo "Entry script starting..."
if [[ "$CONTAINER_ROLE" == "worker" ]]; then
echo "Starting Celery worker..."
celery -A appointment.celery_app:celery worker -l INFO -Q appointment
elif [[ "$CONTAINER_ROLE" == "beat" ]]; then
echo "Starting Celery beat scheduler..."
celery -A appointment.celery_app:celery beat -l INFO
elif [[ "$CONTAINER_ROLE" == "flower" ]]; then
celery -A appointment.celery_app:celery flower -l INFO
elif [[ "$CONTAINER_ROLE" == "api" ]]; then
if [[ "$IS_LOCAL_DEV" == "yes" ]]; then
echo "Running setup"
run-command main setup
fi
echo "Running update-db"
run-command main update-db
if [[ "$IS_LOCAL_DEV" == "yes" ]]; then
echo "Starting cron service"
service cron start
fi
ARGS="--factory appointment.main:server --host 0.0.0.0 --port 5000"
if [[ "$IS_LOCAL_DEV" == "yes" ]]; then
ARGS="$ARGS --reload --log-level trace"
fi
echo "Running uvicorn with these arguments: '$ARGS'"
uvicorn $ARGS
else
echo "Unrecognized CONTAINER_ROLE: $CONTAINER_ROLE"
exit 1
fi