* chore: handle TERM in datatracker-start.sh * chore: delay celery start if migration needed * chore: skip-checks when migrating * chore: label beat/celery as deleteBeforeUpgrade Used by the infra-k8s deployment process to flag these as needing to be shut down before a new release rolls out. * chore: increase termination grace periods
33 lines
934 B
Bash
33 lines
934 B
Bash
#!/bin/bash
|
|
|
|
echo "Running Datatracker checks..."
|
|
./ietf/manage.py check
|
|
|
|
echo "Running Datatracker migrations..."
|
|
./ietf/manage.py migrate --skip-checks --settings=settings_local
|
|
|
|
echo "Starting Datatracker..."
|
|
|
|
# trap TERM and shut down gunicorn
|
|
cleanup () {
|
|
if [[ -n "${gunicorn_pid}" ]]; then
|
|
echo "Terminating gunicorn..."
|
|
kill -TERM "${gunicorn_pid}"
|
|
wait "${gunicorn_pid}"
|
|
fi
|
|
}
|
|
|
|
trap 'trap "" TERM; cleanup' TERM
|
|
|
|
# start gunicorn in the background so we can trap the TERM signal
|
|
gunicorn \
|
|
--workers "${DATATRACKER_GUNICORN_WORKERS:-9}" \
|
|
--max-requests "${DATATRACKER_GUNICORN_MAX_REQUESTS:-32768}" \
|
|
--timeout "${DATATRACKER_GUNICORN_TIMEOUT:-180}" \
|
|
--bind :8000 \
|
|
--log-level "${DATATRACKER_GUNICORN_LOG_LEVEL:-info}" \
|
|
${DATATRACKER_GUNICORN_EXTRA_ARGS} \
|
|
ietf.wsgi:application &
|
|
gunicorn_pid=$!
|
|
wait "${gunicorn_pid}"
|