-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Describe the bug
The migration at lifecycle/system_migrations/tenant_to_brand.py fails to run and permanently crashes the authentik container(s) if the container is killed before the initial schema setup is finished but after it has been partially created.
To Reproduce
Launch new authentik instance and kill the container after one or more migrations run and before the tenant_to_brand.py migration is run.
All restarts of the container will fail and not recover.
Expected behavior
The migrations to properly handle prior partial schema completion.
Logs
Will add logs when/if I get a chance to rerun without my hack fix in place.
Version and Deployment (please complete the following information):
- authentik version: 2025.2.4
- Deployment: helm
Additional context
https://github.com/goauthentik/authentik/blob/19bb2de13fbbecfe50121b26b9bde482d29351ef/lifecycle/system_migrations/tenant_to_brand.py#L6C1-L6C71
Suggest change (tested by overwriting migration via configmap mount.)
ALTER TABLE authentik_tenants_tenant RENAME TO authentik_brands_brand;
Update to
ALTER TABLE IF EXISTS authentik_tenants_tenant RENAME TO authentik_brands_brand;
With this change the migration passes and everything else seems to work correctly.