enable django checks
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
parent
4ecb571291
commit
cb7cd11778
|
@ -6,7 +6,7 @@ from django_tenants.utils import get_public_schema_name
|
||||||
from authentik.blueprints.apps import ManagedAppConfig
|
from authentik.blueprints.apps import ManagedAppConfig
|
||||||
|
|
||||||
|
|
||||||
def reconcile_default_tenant(*args, using=DEFAULT_DB_ALIAS, **kwargs):
|
def ensure_default_tenant(*args, using=DEFAULT_DB_ALIAS, **kwargs):
|
||||||
"""Make sure default tenant exists"""
|
"""Make sure default tenant exists"""
|
||||||
from django_tenants.utils import schema_context
|
from django_tenants.utils import schema_context
|
||||||
|
|
||||||
|
@ -27,7 +27,11 @@ class AuthentikTenantsConfig(ManagedAppConfig):
|
||||||
verbose_name = "authentik Tenants"
|
verbose_name = "authentik Tenants"
|
||||||
default = True
|
default = True
|
||||||
|
|
||||||
|
def reconcile_global_load_checks(self):
|
||||||
|
"""Load tenant checks"""
|
||||||
|
self.import_module("authentik.tenants.checks")
|
||||||
|
|
||||||
def reconcile_global_default_tenant(self):
|
def reconcile_global_default_tenant(self):
|
||||||
"""Make sure default tenant exists, especially after a migration"""
|
"""Make sure default tenant exists, especially after a migration"""
|
||||||
post_migrate.connect(reconcile_default_tenant)
|
post_migrate.connect(ensure_default_tenant)
|
||||||
reconcile_default_tenant()
|
ensure_default_tenant()
|
||||||
|
|
|
@ -50,6 +50,10 @@ function set_mode {
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function run_django_checks {
|
||||||
|
python -m manage check --deploy
|
||||||
|
}
|
||||||
|
|
||||||
function cleanup {
|
function cleanup {
|
||||||
rm -f ${MODE_FILE}
|
rm -f ${MODE_FILE}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +71,7 @@ fi
|
||||||
if [[ "$1" == "server" ]]; then
|
if [[ "$1" == "server" ]]; then
|
||||||
wait_for_db
|
wait_for_db
|
||||||
set_mode "server"
|
set_mode "server"
|
||||||
|
run_django_checks
|
||||||
# If we have bootstrap credentials set, run bootstrap tasks outside of main server
|
# If we have bootstrap credentials set, run bootstrap tasks outside of main server
|
||||||
# sync, so that we can sure the first start actually has working bootstrap
|
# sync, so that we can sure the first start actually has working bootstrap
|
||||||
# credentials
|
# credentials
|
||||||
|
@ -77,6 +82,7 @@ if [[ "$1" == "server" ]]; then
|
||||||
elif [[ "$1" == "worker" ]]; then
|
elif [[ "$1" == "worker" ]]; then
|
||||||
wait_for_db
|
wait_for_db
|
||||||
set_mode "worker"
|
set_mode "worker"
|
||||||
|
run_django_checks
|
||||||
check_if_root "python -m manage worker"
|
check_if_root "python -m manage worker"
|
||||||
elif [[ "$1" == "worker-status" ]]; then
|
elif [[ "$1" == "worker-status" ]]; then
|
||||||
wait_for_db
|
wait_for_db
|
||||||
|
|
Reference in New Issue