Skip to content

Fix MediaWiki DBQueryError: auto-initialize database via init container#40

Merged
velghea merged 2 commits intomainfrom
copilot/fix-mediawiki-internal-error
Mar 23, 2026
Merged

Fix MediaWiki DBQueryError: auto-initialize database via init container#40
velghea merged 2 commits intomainfrom
copilot/fix-mediawiki-internal-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

The chart mounts LocalSettings.php via ConfigMap, bypassing the installation wizard — but never initialized the database schema, causing Wikimedia\Rdbms\DBQueryError on every first access.

Changes

deployment.yaml — new init-db init container

Runs after wait-for-db, before the MediaWiki container starts:

  • Idempotent check: queries information_schema.tables to detect any existing tables (not tied to a specific table name)
  • Auto-init: if the database is empty, runs install.php with credentials from Secrets and config from env vars
  • No LocalSettings.php conflict: uses --confpath=/tmp so the generated file doesn't collide with the ConfigMap-mounted one
  • NetworkPolicy compatible: pod carries component: mediawiki label — existing policies already permit egress to MariaDB port 3306
- name: init-db
  image: "mediawiki:1.45"
  command:
    - sh
    - -c
    - |
      # check if any tables exist; skip if already initialized
      if php /tmp/check_db.php; then exit 0; fi
      php /var/www/html/maintenance/install.php \
        --dbserver="${DB_HOST}:${DB_PORT}" --dbpass="${MARIADB_PASSWORD}" \
        --pass="${MW_ADMIN_PASSWORD}" --confpath=/tmp \
        "${MW_SITE_NAME}" "${MW_ADMIN_USER}"

configmap.yaml

Removed $wgAllowSchemaUpdates = false — it was blocking update.php from running, which is required for schema migrations after MediaWiki version upgrades.

NOTES.txt / README.md

Replaced the mandatory manual install.php step with a note about automatic initialization, and added guidance to run update.php --quick after MediaWiki upgrades.

Original prompt

This section details on the original issue you should resolve

<issue_title>Mediawiki internal error</issue_title>
<issue_description>MediaWiki internal error.

Original exception: [4c8e7c6651515f164e539fed] 2026-03-23 17:29:24: Fatal exception of type "Wikimedia\Rdbms\DBQueryError"

Exception caught inside exception handler.

Set $wgShowExceptionDetails = true; at the bottom of LocalSettings.php to show detailed debugging information.</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 23, 2026

🏷️ Version RC publiée

Chart RC 3.6.2-rc.2
Version finale prévue 3.6.2
FileSender 3.6

Installation pour test

helm repo update ifpen
helm install filesender-rc ifpen/filesender --version 3.6.2-rc.2

Vérification

helm search repo ifpen/filesender --versions --devel

⚠️ Cette version RC sera remplacée par la version stable 3.6.2 lors du merge.

github-actions Bot added a commit that referenced this pull request Mar 23, 2026
@velghea velghea marked this pull request as ready for review March 23, 2026 17:35
… init container

Co-authored-by: velghea <70569153+velghea@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ifpen/helm-charts/sessions/7d675b42-d6ea-453f-ba9e-25f4f3db83b3
Copilot AI changed the title [WIP] Fix MediaWiki internal error during query execution Fix MediaWiki DBQueryError: auto-initialize database via init container Mar 23, 2026
Copilot AI requested a review from velghea March 23, 2026 17:45
github-actions Bot added a commit that referenced this pull request Mar 23, 2026
@velghea velghea merged commit d171819 into main Mar 23, 2026
4 checks passed
@mechermu mechermu deleted the copilot/fix-mediawiki-internal-error branch April 8, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mediawiki internal error

2 participants