-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·56 lines (52 loc) · 1.73 KB
/
Copy pathentrypoint.sh
File metadata and controls
executable file
·56 lines (52 loc) · 1.73 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
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# /entrypoint.sh
# spin up server in local, remote, or stage env
if [[ $1 == *"server"* ]]
then
if [[ $2 == *"local"* ]]
then
python3 manage.py wait_for_db &&
python3 manage.py migrate --no-input &&
python3 manage.py create_admin &&
python3 manage.py verify_account &&
python3 manage.py create_tasks &&
python3 manage.py test_driver &&
python3 manage.py runserver 0.0.0.0:8000
fi
if [[ $2 == *"remote"* ]]
then
python3 manage.py wait_for_db &&
python3 manage.py migrate --no-input &&
python3 manage.py create_admin &&
python3 manage.py verify_account &&
python3 manage.py create_tasks &&
python3 manage.py test_driver &&
gunicorn --timeout 1000 --graceful-timeout 1000 --keep-alive 3 --log-level debug cursion.wsgi:application --bind 0.0.0.0:8000
fi
if [[ $2 == *"stage"* ]]
then
python3 manage.py wait_for_db &&
python3 manage.py makemigrations --no-input &&
python3 manage.py migrate --no-input
fi
fi
# spin up celery
if [[ $1 == *"celery"* ]]
then
python3 manage.py wait_for_db &&
echo "pausing for migrations to complete..." && sleep 7s &&
QUEUES=${2:-"scheduled,on_demand"}
CONCURRENCY=${3:-${CELERY_CONCURRENCY:-""}}
EXTRA_ARGS=""
if [[ -n "$CONCURRENCY" ]]; then
EXTRA_ARGS="--concurrency=$CONCURRENCY"
fi
celery -A cursion worker -E --loglevel=info -O fair --hostname=celery@$(hostname) -Q "$QUEUES" $EXTRA_ARGS
fi
# spin up celery beat
if [[ $1 == *"beat"* ]]
then
python3 manage.py wait_for_db &&
echo "pausing for migrations to complete..." && sleep 7s &&
celery -A cursion beat --scheduler django --loglevel=info
fi