vbv/compose/django/docker_start.sh

24 lines
779 B
Bash

#!/bin/bash
set -o errexit
set -o pipefail
echo $IT_APP_ENVIRONMENT
if [[ $IT_APP_ENVIRONMENT == dev* ]] || [[ $IT_FORCE_RESET_SCHEMA == "true" ]]; then
echo "IT_APP_ENVIRONMENT=$IT_APP_ENVIRONMENT; IT_FORCE_RESET_SCHEMA=$IT_FORCE_RESET_SCHEMA"
echo "Resetting the database schema."
python /app/manage.py reset_schema
else
echo "IT_APP_ENVIRONMENT=$IT_APP_ENVIRONMENT"
echo "Migrating the database schema. (no reset)"
python /app/manage.py migrate
fi
if [[ $IT_APP_ENVIRONMENT != dev* ]]; then
# Start periodic tasks
/usr/local/bin/supercronic -sentry-dsn "$IT_SENTRY_DSN" -split-logs /app/send_attendance_course_reminders &
fi
newrelic-admin run-program gunicorn config.asgi --bind 0.0.0.0:7555 --chdir=/app -k uvicorn.workers.UvicornWorker