2024-05-10 23:15:29 +08:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo "Running as: $RUN_TYPE"
|
|
|
|
if [ "$RUN_TYPE" = "web" ]; then
|
|
|
|
python backend/manage.py spectacular --color --file backend/schema.yml
|
|
|
|
python backend/manage.py migrate
|
|
|
|
if [ ! -d "backend/static" ]; then
|
|
|
|
echo "Generating static files"
|
|
|
|
python backend/manage.py collectstatic --noinput
|
|
|
|
fi
|
|
|
|
python backend/manage.py graph_models -o documentation/erd/app_models.png
|
|
|
|
cd backend
|
|
|
|
# python manage.py runserver 0.0.0.0:8000
|
2024-06-04 20:19:13 +08:00
|
|
|
python -m granian --host 0.0.0.0 --workers 8 --interface wsgi config.wsgi:application
|
2024-05-10 23:15:29 +08:00
|
|
|
elif [ "$RUN_TYPE" = "worker" ]; then
|
|
|
|
cd backend && celery -A config worker -l INFO -E --concurrency 1
|
|
|
|
elif [ "$RUN_TYPE" = "beat" ]; then
|
|
|
|
sleep 15
|
|
|
|
cd backend && celery -A config beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler
|
|
|
|
elif [ "$RUN_TYPE" = "monitor" ]; then
|
|
|
|
cd backend && celery -A config flower --port=5555
|
|
|
|
else
|
|
|
|
echo "No RUN_TYPE value set. Defaulting to web mode"
|
|
|
|
echo "No value specified, defaulting to web"
|
|
|
|
python backend/manage.py spectacular --color --file backend/schema.yml
|
|
|
|
python backend/manage.py migrate
|
|
|
|
if [ ! -d "backend/static" ]; then
|
|
|
|
echo "Generating static files"
|
|
|
|
python backend/manage.py collectstatic --noinput
|
|
|
|
fi
|
|
|
|
python backend/manage.py graph_models -o documentation/erd/app_models.png
|
|
|
|
cd backend
|
|
|
|
# python manage.py runserver 0.0.0.0:8000
|
2024-06-04 20:19:13 +08:00
|
|
|
python -m granian --host 0.0.0.0 --workers 8 --interface wsgi config.wsgi:application
|
2024-05-10 23:15:29 +08:00
|
|
|
fi
|