Files
timetracker/entrypoint.sh
T
lukas 710a0fc5bc
Django CI/CD / test (push) Successful in 23s
Django CI/CD / build-and-push (push) Successful in 57s
Update entrypoint.sh
2026-01-27 21:30:04 +01:00

24 lines
616 B
Bash

#!/bin/bash
# Apply database migrations
set -euo pipefail
echo "Apply database migrations"
python manage.py migrate
echo "Collect static files"
python manage.py collectstatic --clear --no-input
_term() {
echo "Caught SIGTERM signal!"
kill -SIGTERM "$gunicorn_pid"
kill -SIGTERM "$django_q_pid"
}
trap _term SIGTERM
echo "Starting Django-Q cluster"
python manage.py qcluster & django_q_pid=$!
echo "Starting app"
python -m gunicorn --bind 0.0.0.0:8001 timetracker.asgi:application -k uvicorn.workers.UvicornWorker --access-logfile - --error-logfile - & gunicorn_pid=$!
wait "$gunicorn_pid" "$django_q_pid"