Pre-create operations_manager database for fresh sandbox#108
Merged
Conversation
On a fresh cluster, OPI's docker-entrypoint.sh runs `alembic upgrade head` before `python -m opi.server` ever boots, so the in-app `_ensure_database_exists()` never runs and Alembic crashes with `database "operations_manager" does not exist`. Declare the database via CNPG `Database` CRD alongside the existing forgejo/keycloak databases. Owner is `postgres` because OPI connects as the admin user (DATABASE_ADMIN_NAME=postgres).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Probleem
Op een verse cluster draait OPI's
docker-entrypoint.sheerstalembic upgrade headvoorpython -m opi.serverooit boot. Daardoor draait de in-app_ensure_database_exists()nooit en crasht Alembic met:Resultaat: OPI komt niet up op een fresh sandbox.
Fix
Declareer de database via CNPG
DatabaseCRD naast de bestaandeforgejo/keycloakdatabases. Owner ispostgresomdat OPI als admin-user verbindt (DATABASE_ADMIN_NAME=postgres).Test plan
task sandbox:setupkubectl -n rig-system get databasetoontoperations-manager-dbHerkomst
Cherry-pick van
a589f5dfuit de lokaledevex-updatedbranch, waar deze fix al een tijdje stond maar nooit naar main is gegaan.