lifecycle: much improved debugging experience (#12804)

* lifecycle: much improved debugging experience

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* format

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* add start debug launch configs

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* only install dev deps in container

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* add pathMappings

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* use debugger variable to enable only debugger without debug mode enabled

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix path map

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L.
2025-02-01 03:35:56 +01:00
committed by GitHub
parent 7c944b954c
commit 334e2c466f
10 changed files with 103 additions and 25 deletions

View File

@ -55,6 +55,10 @@ function cleanup {
}
function prepare_debug {
# Only attempt to install debug dependencies if we're running in a container
if [ ! -d /ak-root ]; then
return
fi
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends krb5-kdc krb5-user krb5-admin-server libkrb5-dev gcc
@ -63,7 +67,7 @@ function prepare_debug {
chown authentik:authentik /unittest.xml
}
if [[ "${AUTHENTIK_REMOTE_DEBUG}" == "true" ]]; then
if [[ "$(python -m authentik.lib.config debugger 2> /dev/null)" == "True" ]]; then
prepare_debug
fi
@ -92,7 +96,7 @@ elif [[ "$1" == "test-all" ]]; then
elif [[ "$1" == "healthcheck" ]]; then
run_authentik healthcheck $(cat $MODE_FILE)
elif [[ "$1" == "dump_config" ]]; then
exec python -m authentik.lib.config
exec python -m authentik.lib.config $@
elif [[ "$1" == "debug" ]]; then
exec sleep infinity
else

View File

@ -13,6 +13,7 @@ from prometheus_client.values import MultiProcessValue
from authentik import get_full_version
from authentik.lib.config import CONFIG
from authentik.lib.debug import start_debug_server
from authentik.lib.logging import get_logger_config
from authentik.lib.utils.http import get_http_session
from authentik.lib.utils.reflection import get_env
@ -146,9 +147,5 @@ if not CONFIG.get_bool("disable_startup_analytics", False):
except Exception: # nosec
pass
if CONFIG.get_bool("remote_debug"):
import debugpy
debugpy.listen(("0.0.0.0", 6800)) # nosec
start_debug_server()
run_migrations()