-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·50 lines (38 loc) · 1.1 KB
/
entrypoint.sh
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
44
45
46
47
48
49
50
#!/bin/bash
# fail script when command fails and print the commands and arguments
set -xe
export APP_RUN=${APP_RUN:=api}
export LOG_LEVEL=${APP_LOGLEVEL:=critical}
export FORWARDED_ALLOW_IPS=${FORWARDED_ALLOW_IPS:="*"}
function setup() {
echo "Upgrading SQL Database Scheme:"
alembic upgrade head
}
setup
COMMAND=$1
if [[ ! -z "$COMMAND" ]]; then
shift
fi
case "$COMMAND" in
worker)
echo "Launching Worker:"
exec python3 main.py worker --identifier ${WORKER_IDENTIFIER:=general} --queue ${WORKER_QUEUES:=celery} --concurrency ${WORKER_CONCURRENCY:=1} $*
;;
flower)
echo "Launching Flower:"
exec celery -A backend.tasks.celery flower --address=${APP_HOST:="0.0.0.0"} --port=${APP_PORT:=5000} $*
;;
beat)
echo "Launching Beat:"
exec celery -A backend.tasks.celery beat $*
;;
web)
echo "Public web:"
exec uvicorn backend.web:app --host ${APP_HOST:="0.0.0.0"} --port ${APP_PORT:=5000} --log-level $LOG_LEVEL --proxy-headers $*
;;
# Default
*)
echo "Public API:"
exec uvicorn backend.api:app --host ${APP_HOST:="0.0.0.0"} --port ${APP_PORT:=5000} --log-level $LOG_LEVEL --proxy-headers $*
;;
esac