fix: wait for LocalSettings.php with external DB to prevent exit 123#176
Conversation
When USE_EXTERNAL_DB=true, the container entrypoint runs waitdatabase() before install.php has generated LocalSettings.php. This causes 'Unsupported database type' and exit 123 because $WG_DB_TYPE is empty (no LocalSettings.php to read DB config from). Add a retry loop: when $WG_DB_TYPE is empty and USE_EXTERNAL_DB is true, wait up to ~62 seconds for install.php to create LocalSettings.php before giving up. Fixes the chicken-and-egg deadlock where: - Container needs LocalSettings.php to determine DB type - LocalSettings.php is created by install.php - install.php hasn't run yet when container first starts Ref: hexmode1/icannwiki-canasta#7
|
🐳 The image based on 3339d820 commit has been built with |
The retry only re-read WG_DB_TYPE; WG_DB_SERVER/NAME/USER/PASSWORD were snapshotted at script start while LocalSettings.php was still empty and stayed stale. Reload all of them once the type resolves, matching the existing config-wait reload. Collapse the duplicated first attempt into a single loop (same ~62s ceiling).
|
Pushed a small follow-up on top of this. The retry re-read only |
Problem
When USE_EXTERNAL_DB=true on Docker Compose, canasta create fails because the container entrypoint checks $WG_DB_TYPE before install.php has generated LocalSettings.php.
The container starts → get_mediawiki_db_var → getMediawikiSettings.php checks LocalSettings.php → not found → returns empty → $WG_DB_TYPE is empty → exit 123
Fix
When $WG_DB_TYPE is empty and USE_EXTERNAL_DB=true, retry for up to ~62 seconds to give install.php time to create LocalSettings.php.
Testing
Production-style deployment: EC2 with rootless Podman, Canasta CLI v4.2.0, image 3.5.10, external Aurora MySQL RDS.
Closes #175