web-app-mediawiki: installer-driven bootstrap, DB readiness, idempotent admin; drop LocalSettings bind-mount

Tasks:
- Enable docker_compose_flush_handlers=true so services come up immediately.
- Add DB readiness guard via maintenance/sql.php (SELECT 1).
- Run maintenance/install.php on empty schema with robust changed_when/failed_when (merge stdout+stderr); keep secrets hidden.
- Run maintenance/update.php for migrations with neutral changed_when unless work is done.
- Make admin creation idempotent: tolerate 'already exists' and 'Account exists', keep async+no_log.

Config changes:
- Remove LocalSettings.php template and its host bind-mount from compose.
- Drop MediaWiki settings path variables and META namespace variable (unused after switch).

Result: First boot is fully automated (schema + admin), subsequent runs are cleanly idempotent.

Ref: ChatGPT conversation (Aug 28, 2025, Europe/Berlin) — https://chatgpt.com/share/68b0d2e1-9bc0-800f-81a5-db03ce0b81e3.
This commit is contained in:
2025-08-29 00:07:00 +02:00
parent d96bfc64a6
commit af1ee64246
4 changed files with 51 additions and 44 deletions

View File

@@ -1,29 +0,0 @@
<?php
# This file was automatically generated by the MediaWiki installer.
# Managed by Ansible in your setup.
# Basic settings
$wgSitename = "{{ MEDIAWIKI_SITENAME }}";
$wgMetaNamespace = "{{ MEDIAWIKI_META_NAMESPACE }}";
$wgScriptPath = "";
$wgServer = "{{ MEDIAWIKI_URL }}";
# Database settings
$wgDBtype = "mysql";
$wgDBserver = "{{ database_host }}:{{ database_port }}";
$wgDBname = "{{ database_name }}";
$wgDBuser = "{{ database_username }}";
$wgDBpassword = "{{ database_password }}";
# Email settings
$wgEnableEmail = true;
$wgEnableUserEmail = true;
$wgEmergencyContact = "{{ users.administrator.email }}";
$wgPasswordSender = "{{ users['no-reply'].email }}";
# Default skin
$wgDefaultSkin = "vector";
# Extensions (examples)
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'Cite' );

View File

@@ -5,7 +5,6 @@
image: "{{ MEDIAWIKI_IMAGE }}:{{ MEDIAWIKI_VERSION }}"
volumes:
- "data:/var/www/html/"
- "{{ MEDIAWIKI_SETTINGS_HOST_PATH }}:{{ MEDIAWIKI_SETTINGS_DOCK_PATH }}:ro"
ports:
- "127.0.0.1:{{ ports.localhost.http[application_id] }}:{{ container_port }}"
{% include 'roles/docker-container/templates/healthcheck/curl.yml.j2' %}