mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-10 04:25:20 +02:00
refactor(web-app-mediawiki): unify debug & oidc handling via _ensure_require, introduce host-side prep, switch to bind mounts
- Removed obsolete Installation.md, TODO.md, 02_debug.yml, 05_oidc.yml and legacy debug enable/disable tasks - Added 01_prep.yml to render debug.php/oidc.php on host side before container start - Introduced _ensure_require.yml for generic require_once management in LocalSettings.php - Renamed 01_install.yml -> 02_install.yml to align with new numbering - Updated docker-compose.yml.j2 to bind-mount mw-local into /opt/mw-local - Adjusted vars/main.yml to define MEDIAWIKI_LOCAL_MOUNT_DIR and MEDIAWIKI_LOCAL_PATH - Templates debug.php.j2 and oidc.php.j2 now gated by MODE_DEBUG and MEDIAWIKI_OIDC_ENABLED - main.yml now orchestrates prep, install, debug, extensions, oidc require, admin consistently Ref: https://chatgpt.com/share/68b57db2-efcc-800f-a733-aca952298437
This commit is contained in:
44
roles/web-app-mediawiki/tasks/02_install.yml
Normal file
44
roles/web-app-mediawiki/tasks/02_install.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
- name: "Wait for DB to be reachable"
|
||||
command: >
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/sql.php --query "SELECT 1;"
|
||||
register: mw_db_ready
|
||||
retries: 15
|
||||
delay: 2
|
||||
until: mw_db_ready.rc == 0
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: "Install MediaWiki if no schema exists"
|
||||
command: >
|
||||
docker exec -u {{ MEDIAWIKI_USER }} {{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/install.php
|
||||
--dbname="{{ database_name }}"
|
||||
--dbuser="{{ database_username }}"
|
||||
--dbpass="{{ database_password }}"
|
||||
--dbserver="{{ database_host }}:{{ database_port }}"
|
||||
--installdbuser="{{ database_username }}"
|
||||
--installdbpass="{{ database_password }}"
|
||||
--server="{{ MEDIAWIKI_URL }}"
|
||||
--scriptpath=""
|
||||
--lang={{ HOST_LL }}
|
||||
--pass="{{ MEDIAWIKI_ADMINISTRATOR_PASSWORD }}"
|
||||
"{{ MEDIAWIKI_SITENAME }}"
|
||||
"{{ MEDIAWIKI_ADMINISTRATOR_NAME }}"
|
||||
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
||||
register: mw_install
|
||||
changed_when: mw_install.rc == 0
|
||||
failed_when: >
|
||||
mw_install.rc != 0 and
|
||||
('LocalSettings.php file has been detected' not in (((mw_install.stdout | default('')) ~ (mw_install.stderr | default(''))))) and
|
||||
('run update.php instead' not in (((mw_install.stdout | default('')) ~ (mw_install.stderr | default('')))))
|
||||
|
||||
- name: "Initialize / migrate MediaWiki database schema"
|
||||
command: >
|
||||
docker exec
|
||||
-u {{ MEDIAWIKI_USER }}
|
||||
{{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/update.php --quick
|
||||
register: mw_update
|
||||
changed_when: "'...done.' in (mw_update.stdout | default(''))"
|
||||
failed_when: mw_update.rc != 0
|
Reference in New Issue
Block a user