lifecycle: fix error when worker is not running as root
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
c5e9197b19
commit
934e62d5be
|
@ -5,6 +5,7 @@ printf '{"event": "Bootstrap completed", "level": "info", "logger": "bootstrap",
|
||||||
function check_if_root {
|
function check_if_root {
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
printf '{"event": "Not running as root, disabling permission fixes", "level": "info", "logger": "bootstrap", "command": "%s"}\n' "$@" > /dev/stderr
|
printf '{"event": "Not running as root, disabling permission fixes", "level": "info", "logger": "bootstrap", "command": "%s"}\n' "$@" > /dev/stderr
|
||||||
|
$1
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
SOCKET="/var/run/docker.sock"
|
SOCKET="/var/run/docker.sock"
|
||||||
|
@ -16,14 +17,14 @@ function check_if_root {
|
||||||
fi
|
fi
|
||||||
# Fix permissions of backups and media
|
# Fix permissions of backups and media
|
||||||
chown -R authentik:authentik /media /backups
|
chown -R authentik:authentik /media /backups
|
||||||
|
chpst -u authentik env HOME=/authentik $1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$1" == "server" ]]; then
|
if [[ "$1" == "server" ]]; then
|
||||||
python -m lifecycle.migrate
|
python -m lifecycle.migrate
|
||||||
/authentik-proxy
|
/authentik-proxy
|
||||||
elif [[ "$1" == "worker" ]]; then
|
elif [[ "$1" == "worker" ]]; then
|
||||||
check_if_root
|
check_if_root "celery -A authentik.root.celery worker --autoscale 3,1 -E -B -s /tmp/celerybeat-schedule -Q authentik,authentik_scheduled,authentik_events"
|
||||||
chpst -u authentik env HOME=/authentik celery -A authentik.root.celery worker --autoscale 3,1 -E -B -s /tmp/celerybeat-schedule -Q authentik,authentik_scheduled,authentik_events
|
|
||||||
elif [[ "$1" == "backup" ]]; then
|
elif [[ "$1" == "backup" ]]; then
|
||||||
python -m manage dbbackup --clean
|
python -m manage dbbackup --clean
|
||||||
elif [[ "$1" == "restore" ]]; then
|
elif [[ "$1" == "restore" ]]; then
|
||||||
|
|
Reference in New Issue