mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-11-11 07:36:37 +00:00
Compare commits
3 Commits
1dceabfd46
...
9ef4f91ec4
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ef4f91ec4 | |||
| 5bc635109a | |||
| efb5488cfc |
@@ -1,5 +1,5 @@
|
|||||||
# roles/web-app-mediawiki/tasks/03_patch_settings.yml
|
# roles/web-app-mediawiki/tasks/03_patch_settings.yml
|
||||||
- name: "MEDIAWIKI | Ensure LocalSettings.php has correct base settings"
|
- name: "MEDIAWIKI | Normalize base settings in LocalSettings.php (clean + append once)"
|
||||||
vars:
|
vars:
|
||||||
_lsp_path: "{{ MEDIAWIKI_HTML_DIR }}/LocalSettings.php"
|
_lsp_path: "{{ MEDIAWIKI_HTML_DIR }}/LocalSettings.php"
|
||||||
_server_url: "{{ MEDIAWIKI_URL | regex_replace('/+$', '') }}"
|
_server_url: "{{ MEDIAWIKI_URL | regex_replace('/+$', '') }}"
|
||||||
@@ -14,46 +14,34 @@
|
|||||||
docker exec -u {{ MEDIAWIKI_USER }} {{ MEDIAWIKI_CONTAINER }} bash -lc '
|
docker exec -u {{ MEDIAWIKI_USER }} {{ MEDIAWIKI_CONTAINER }} bash -lc '
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
LSP="{{ _lsp_path }}"
|
LSP="{{ _lsp_path }}"
|
||||||
|
[ -f "$LSP" ] || { echo "ERROR: LocalSettings.php not found."; exit 1; }
|
||||||
|
|
||||||
SERVER='\''{{ _server_url_sq }}'\''
|
SERVER='\''{{ _server_url_sq }}'\''
|
||||||
DBNAME='\''{{ _db_name_sq }}'\''
|
DBNAME='\''{{ _db_name_sq }}'\''
|
||||||
DBUSER='\''{{ _db_user_sq }}'\''
|
DBUSER='\''{{ _db_user_sq }}'\''
|
||||||
DBPASS='\''{{ _db_pass_sq }}'\''
|
DBPASS='\''{{ _db_pass_sq }}'\''
|
||||||
DBHOST='\''{{ _db_host_sq }}'\''
|
DBHOST='\''{{ _db_host_sq }}'\''
|
||||||
LANG='\''{{ _lang_sq }}'\''
|
LANG='\''{{ _lang_sq }}'\''
|
||||||
[ -f "$LSP" ] || { echo "LocalSettings.php not found, skipping."; exit 0; }
|
|
||||||
|
|
||||||
need=0
|
tmp="$(mktemp)"; trap "rm -f \"$tmp\"" EXIT
|
||||||
|
|
||||||
check_line() {
|
# 1) Copy existing file, but drop ALL prior assignments of our managed keys
|
||||||
local key="$1" val="$2"
|
grep -Ev "^[[:space:]]*\$(wgServer|wgCanonicalServer|wgDBname|wgDBuser|wgDBpassword|wgDBserver|wgLanguageCode)[[:space:]]*=" "$LSP" > "$tmp" || true
|
||||||
grep -Eq "^[[:space:]]*\$${key}[[:space:]]*=[[:space:]]*'\''${val}'\'';" "$LSP" || need=1
|
|
||||||
}
|
|
||||||
|
|
||||||
check_line wgServer "$SERVER"
|
# 2) Append ONE clean, authoritative block
|
||||||
check_line wgCanonicalServer "$SERVER"
|
{
|
||||||
check_line wgDBname "$DBNAME"
|
printf "\n\$wgServer = '\''%s'\'';\n" "$SERVER"
|
||||||
check_line wgDBuser "$DBUSER"
|
printf "\$wgCanonicalServer = '\''%s'\'';\n" "$SERVER"
|
||||||
check_line wgDBpassword "$DBPASS"
|
printf "\$wgDBname = '\''%s'\'';\n" "$DBNAME"
|
||||||
check_line wgDBserver "$DBHOST"
|
printf "\$wgDBuser = '\''%s'\'';\n" "$DBUSER"
|
||||||
check_line wgLanguageCode "$LANG"
|
printf "\$wgDBpassword = '\''%s'\'';\n" "$DBPASS"
|
||||||
|
printf "\$wgDBserver = '\''%s'\'';\n" "$DBHOST"
|
||||||
if [ "$need" -eq 1 ]; then
|
printf "\$wgLanguageCode = '\''%s'\'';\n" "$LANG"
|
||||||
tmp="$(mktemp)"
|
} >> "$tmp"
|
||||||
# Remove any existing definitions for these keys
|
|
||||||
grep -Ev "^[[:space:]]*\$(wgServer|wgCanonicalServer|wgDBname|wgDBuser|wgDBpassword|wgDBserver|wgLanguageCode)[[:space:]]*=" "$LSP" > "$tmp" || true
|
|
||||||
|
|
||||||
{
|
|
||||||
printf "\n\$wgServer = '\''%s'\'';\n" "$SERVER"
|
|
||||||
printf "\$wgCanonicalServer = '\''%s'\'';\n" "$SERVER"
|
|
||||||
printf "\$wgDBname = '\''%s'\'';\n" "$DBNAME"
|
|
||||||
printf "\$wgDBuser = '\''%s'\'';\n" "$DBUSER"
|
|
||||||
printf "\$wgDBpassword = '\''%s'\'';\n" "$DBPASS"
|
|
||||||
printf "\$wgDBserver = '\''%s'\'';\n" "$DBHOST"
|
|
||||||
printf "\$wgLanguageCode = '\''%s'\'';\n" "$LANG"
|
|
||||||
} >> "$tmp"
|
|
||||||
|
|
||||||
|
# 3) Idempotent write: only replace if content actually changed
|
||||||
|
if ! cmp -s "$LSP" "$tmp"; then
|
||||||
cat "$tmp" > "$LSP"
|
cat "$tmp" > "$LSP"
|
||||||
rm -f "$tmp"
|
|
||||||
echo CHANGED
|
echo CHANGED
|
||||||
fi
|
fi
|
||||||
'
|
'
|
||||||
|
|||||||
@@ -3,11 +3,16 @@
|
|||||||
|
|
||||||
{% if MEDIAWIKI_OIDC_ENABLED | bool %}
|
{% if MEDIAWIKI_OIDC_ENABLED | bool %}
|
||||||
|
|
||||||
|
{% if 'web-svc-logout' in CURRENT_PLAY_APPLICATIONS %}
|
||||||
|
# The cookie deletion of the logout app leads to a login bug if this isn't set
|
||||||
|
$wgPasswordAttemptThrottle = [];
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
wfLoadExtension( 'PluggableAuth' );
|
wfLoadExtension( 'PluggableAuth' );
|
||||||
wfLoadExtension( 'OpenIDConnect' );
|
wfLoadExtension( 'OpenIDConnect' );
|
||||||
|
|
||||||
$wgPluggableAuth_EnableAutoLogin = true;
|
$wgPluggableAuth_EnableAutoLogin = {{ MEDIAWIKI_OIDC_AUTOLOGIN | bool | ternary('true','false') }};
|
||||||
$wgPluggableAuth_EnableLocalLogin = false;
|
$wgPluggableAuth_EnableLocalLogin = {{ MEDIAWIKI_OIDC_LOCALLOGIN | bool | ternary('true','false') }};
|
||||||
$wgPluggableAuth_ButtonLabel = '{{ MEDIAWIKI_OIDC_BUTTON_TEXT }}';
|
$wgPluggableAuth_ButtonLabel = '{{ MEDIAWIKI_OIDC_BUTTON_TEXT }}';
|
||||||
|
|
||||||
$wgPluggableAuth_Config = [
|
$wgPluggableAuth_Config = [
|
||||||
|
|||||||
@@ -32,12 +32,14 @@ MEDIAWIKI_OIDC_CLIENT_ID: "{{ OIDC.CLIENT.ID }}"
|
|||||||
MEDIAWIKI_OIDC_CLIENT_SECRET: "{{ OIDC.CLIENT.SECRET }}"
|
MEDIAWIKI_OIDC_CLIENT_SECRET: "{{ OIDC.CLIENT.SECRET }}"
|
||||||
MEDIAWIKI_OIDC_ISSUER: "{{ OIDC.CLIENT.ISSUER_URL }}"
|
MEDIAWIKI_OIDC_ISSUER: "{{ OIDC.CLIENT.ISSUER_URL }}"
|
||||||
MEDIAWIKI_OIDC_BUTTON_TEXT: "{{ OIDC.BUTTON_TEXT }}"
|
MEDIAWIKI_OIDC_BUTTON_TEXT: "{{ OIDC.BUTTON_TEXT }}"
|
||||||
|
MEDIAWIKI_OIDC_AUTOLOGIN: true
|
||||||
|
MEDIAWIKI_OIDC_LOCALLOGIN: false
|
||||||
|
|
||||||
# Extensions
|
# Extensions
|
||||||
MEDIAWIKI_EXT_BRANCH: "REL1_44"
|
MEDIAWIKI_EXT_BRANCH: "REL1_44"
|
||||||
MEDIAWIKI_EXT_CFG_BASE: "{{ MEDIAWIKI_CONFIG_DIR }}/mwext/{{ MEDIAWIKI_EXT_BRANCH }}"
|
MEDIAWIKI_EXT_CFG_BASE: "{{ [ MEDIAWIKI_CONFIG_DIR, 'mwext', MEDIAWIKI_EXT_BRANCH ] | path_join }}"
|
||||||
MEDIAWIKI_EXT_LIST:
|
MEDIAWIKI_EXT_LIST:
|
||||||
- name: "PluggableAuth"
|
- name: "PluggableAuth"
|
||||||
url: "https://codeload.github.com/wikimedia/mediawiki-extensions-PluggableAuth/tar.gz/refs/heads/{{ MEDIAWIKI_EXT_BRANCH }}"
|
url: "{{ [ 'https://codeload.github.com/wikimedia/mediawiki-extensions-PluggableAuth/tar.gz/refs/heads/',MEDIAWIKI_EXT_BRANCH ] | url_join }}"
|
||||||
- name: "OpenIDConnect"
|
- name: "OpenIDConnect"
|
||||||
url: "https://codeload.github.com/wikimedia/mediawiki-extensions-OpenIDConnect/tar.gz/refs/heads/{{ MEDIAWIKI_EXT_BRANCH }}"
|
url: "{{ [ 'https://codeload.github.com/wikimedia/mediawiki-extensions-OpenIDConnect/tar.gz/refs/heads/',MEDIAWIKI_EXT_BRANCH ] | url_join }}"
|
||||||
|
|||||||
@@ -32,8 +32,42 @@ distribution.defaultUI=org.xwiki.platform:xwiki-platform-distribution-flavor-mai
|
|||||||
distribution.skip=false
|
distribution.skip=false
|
||||||
distribution.wizard.enabled=true
|
distribution.wizard.enabled=true
|
||||||
|
|
||||||
|
{% if MODE_DEBUG | bool %}
|
||||||
|
# Root logger
|
||||||
logging.rootLogger=DEBUG, console
|
logging.rootLogger=DEBUG, console
|
||||||
|
|
||||||
|
# XWiki OIDC extension
|
||||||
|
logging.logger.org.xwiki.contrib.oidc=TRACE
|
||||||
|
logging.logger.org.xwiki.contrib.oidc.internal=TRACE
|
||||||
|
logging.logger.org.xwiki.contrib.oidc.provider=TRACE
|
||||||
|
|
||||||
|
# OIDC extra (sometimes split in other packages)
|
||||||
|
logging.logger.org.xwiki.contrib.oidc.auth=TRACE
|
||||||
|
logging.logger.org.xwiki.contrib.oidc.client=TRACE
|
||||||
|
|
||||||
|
# Tomcat internals (servlet and HTTP handling)
|
||||||
|
logging.logger.org.apache.catalina.core=DEBUG
|
||||||
|
logging.logger.org.apache.coyote.http11=DEBUG
|
||||||
|
|
||||||
|
# Request/Resource handling
|
||||||
|
logging.logger.org.xwiki.resource=TRACE
|
||||||
|
logging.logger.org.xwiki.resource.internal=TRACE
|
||||||
|
logging.logger.org.xwiki.container.servlet=DEBUG
|
||||||
|
|
||||||
|
# Nimbus OIDC/OAuth + JOSE libraries
|
||||||
|
logging.logger.com.nimbusds=DEBUG
|
||||||
|
logging.logger.com.nimbusds.oauth2.sdk=DEBUG
|
||||||
|
logging.logger.com.nimbusds.openid.connect.sdk=DEBUG
|
||||||
|
logging.logger.com.nimbusds.jose=DEBUG
|
||||||
|
|
||||||
|
# Apache HttpClient (used under the hood by Nimbus)
|
||||||
|
logging.logger.org.apache.http=DEBUG
|
||||||
|
logging.logger.org.apache.http.wire=DEBUG # very verbose, raw request/response wire logs
|
||||||
|
|
||||||
|
# Pac4j (if your build uses it)
|
||||||
|
logging.logger.org.pac4j=DEBUG
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Persist data in the Docker volume
|
# Persist data in the Docker volume
|
||||||
environment.permanentDirectory={{ XWIKI_DOCK_DATA_DIR }}
|
environment.permanentDirectory={{ XWIKI_DOCK_DATA_DIR }}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user