2020-09-09 22:14:59 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
python -m lifecycle.wait_for_db
|
2020-10-03 18:36:36 +00:00
|
|
|
printf '{"event": "Bootstrap completed", "level": "info", "logger": "bootstrap", "command": "%s"}\n' "$@" > /dev/stderr
|
2020-09-09 22:14:59 +00:00
|
|
|
if [[ "$1" == "server" ]]; then
|
2021-04-18 12:47:50 +00:00
|
|
|
python -m lifecycle.migrate
|
2020-12-05 21:08:42 +00:00
|
|
|
gunicorn -c /lifecycle/gunicorn.conf.py authentik.root.asgi:application
|
2020-09-09 22:14:59 +00:00
|
|
|
elif [[ "$1" == "worker" ]]; then
|
2021-01-11 17:43:59 +00:00
|
|
|
celery -A authentik.root.celery worker --autoscale 3,1 -E -B -s /tmp/celerybeat-schedule -Q authentik,authentik_scheduled,authentik_events
|
2020-09-09 22:14:59 +00:00
|
|
|
elif [[ "$1" == "migrate" ]]; then
|
2021-04-18 12:47:50 +00:00
|
|
|
printf "DEPERECATED: database migrations are now executed automatically on startup."
|
2020-09-09 22:14:59 +00:00
|
|
|
python -m lifecycle.migrate
|
2020-10-03 18:36:36 +00:00
|
|
|
elif [[ "$1" == "backup" ]]; then
|
|
|
|
python -m manage dbbackup --clean
|
|
|
|
elif [[ "$1" == "restore" ]]; then
|
|
|
|
python -m manage dbrestore ${@:2}
|
|
|
|
elif [[ "$1" == "bash" ]]; then
|
|
|
|
/bin/bash
|
2020-09-09 22:14:59 +00:00
|
|
|
else
|
|
|
|
python -m manage "$@"
|
|
|
|
fi
|