aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-09-23 11:36:13 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-09-23 13:15:21 +0200
commitdd49efbcad47f7d9e801bb12758183220dae9c86 (patch)
treea407f5f25407da39322be59dd351e45278be1093 /ansible/roles
parentf7badd1323ed9e53e496c0b7f5b60a69a04d67b4 (diff)
downloadinfra-dd49efbcad47f7d9e801bb12758183220dae9c86.tar.gz
infra-dd49efbcad47f7d9e801bb12758183220dae9c86.tar.bz2
infra-dd49efbcad47f7d9e801bb12758183220dae9c86.tar.xz
infra-dd49efbcad47f7d9e801bb12758183220dae9c86.zip
o Replacing all custom semantic mediawiki configuration with a generic
composer setup. Should be possible to maintain all of the mediawiki code with composer now. o Adding scribunto and semantic-scribunto as extensions. o Moving borg and backup directory under /opt/mediawiki
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/mw-backend/files/bin/mw-dump-backup2
-rw-r--r--ansible/roles/mw-backend/files/bin/mw-dump-db3
-rw-r--r--ansible/roles/mw-backend/files/bin/mw-make-backup2
-rw-r--r--ansible/roles/mw-backend/files/opt/mediawiki/semantic-media-wiki/composer.json6
-rw-r--r--ansible/roles/mw-backend/tasks/main.yml59
-rw-r--r--ansible/roles/mw-backend/tasks/semantic-mediawiki.yml78
-rw-r--r--ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j26
7 files changed, 50 insertions, 106 deletions
diff --git a/ansible/roles/mw-backend/files/bin/mw-dump-backup b/ansible/roles/mw-backend/files/bin/mw-dump-backup
index 5530b03..0e21eb2 100644
--- a/ansible/roles/mw-backend/files/bin/mw-dump-backup
+++ b/ansible/roles/mw-backend/files/bin/mw-dump-backup
@@ -6,4 +6,4 @@ exec php /usr/share/mediawiki/maintenance/dumpBackup.php \
--full \
--include-files \
--uploads \
- > /mediawiki-backup/content-dump.xml
+ > /opt/mediawiki/backup/content-dump.xml
diff --git a/ansible/roles/mw-backend/files/bin/mw-dump-db b/ansible/roles/mw-backend/files/bin/mw-dump-db
index 0a82059..5a6699a 100644
--- a/ansible/roles/mw-backend/files/bin/mw-dump-db
+++ b/ansible/roles/mw-backend/files/bin/mw-dump-db
@@ -8,4 +8,5 @@ export PGUSER=$(sed -n 's,^.wgDBuser.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSe
export PGPASSWORD=$(sed -n 's,^.wgDBpassword.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSettings.php)
export PGPORT=$(sed -n 's,^.wgDBport.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSettings.php)
-exec pg_dump -b --format directory -f /mediawiki-backup/db
+rm -rf /opt/mediawiki/backup/db
+exec pg_dump -b --format directory -f /opt/mediawiki/backup/db
diff --git a/ansible/roles/mw-backend/files/bin/mw-make-backup b/ansible/roles/mw-backend/files/bin/mw-make-backup
index 18c48e2..e99b909 100644
--- a/ansible/roles/mw-backend/files/bin/mw-make-backup
+++ b/ansible/roles/mw-backend/files/bin/mw-make-backup
@@ -2,4 +2,4 @@
set -euo pipefail
-exec borg create /mediawiki-borg::mediawiki-{now:%Y%m%d-%H%M%S} /mediawiki-backup
+exec borg create /opt/mediawiki/borg::mediawiki-{now:%Y%m%d-%H%M%S} /opt/mediawiki/backup
diff --git a/ansible/roles/mw-backend/files/opt/mediawiki/semantic-media-wiki/composer.json b/ansible/roles/mw-backend/files/opt/mediawiki/semantic-media-wiki/composer.json
deleted file mode 100644
index f1c00f4..0000000
--- a/ansible/roles/mw-backend/files/opt/mediawiki/semantic-media-wiki/composer.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "require": {
- "mediawiki/semantic-result-formats": "2.5",
- "mediawiki/semantic-media-wiki": "2.5.8"
- }
-}
diff --git a/ansible/roles/mw-backend/tasks/main.yml b/ansible/roles/mw-backend/tasks/main.yml
index a172b9a..f5d3e67 100644
--- a/ansible/roles/mw-backend/tasks/main.yml
+++ b/ansible/roles/mw-backend/tasks/main.yml
@@ -13,13 +13,9 @@
dest: /etc/apt/sources.list
content: |
deb http://httpredir.debian.org/debian/ stretch main contrib non-free
- deb-src http://httpredir.debian.org/debian/ stretch main contrib non-free
-
deb http://security.debian.org/debian-security stretch/updates main contrib non-free
- deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free
-
deb http://httpredir.debian.org/debian/ stretch-updates main contrib non-free
- deb-src http://httpredir.debian.org/debian/ stretch-updates main contrib non-free
+ deb http://httpredir.debian.org/debian/ stretch-backports main contrib non-free
- meta: flush_handlers
@@ -68,7 +64,9 @@
- php-intl
- php-gd
- php-apcu
- - mediawiki
+ - composer
+ - php-zip
+ - mediawiki # TODO: this should be replaced with composer
- name: /var/www/mw.trygvis.io
tags: apache-config
file:
@@ -101,6 +99,40 @@
state: started
name: mw-jobqueue.timer
+- name: Mediawiki extensions
+ tags: mw-extensions
+ block:
+ - name: directories
+ file:
+ state: directory
+ path: /opt/mediawiki/extensions
+ owner: www-data
+ group: root
+
+ - name: run composer install scribunto
+ with_items: "{{ mediawiki_extensions }}"
+ become: yes
+ become_user: www-data
+ composer:
+ command: require
+ arguments: "{{ item.package }} {{ item.version }}"
+ working_dir: /opt/mediawiki/extensions
+
+ - name: symlink extensions into mediawiki
+ with_items: "{{ mediawiki_extensions }}"
+ file:
+ state: link
+ dest: "/var/lib/mediawiki/extensions/{{ item.extension }}"
+ src: "/opt/mediawiki/extensions/extensions/{{ item.extension }}"
+
+ - name: symlink maintenance into smw
+ file:
+ state: link
+ dest: "/opt/mediawiki/extensions/maintenance"
+ src: "/var/lib/mediawiki/maintenance"
+ owner: root
+ group: root
+
- name: Mediawiki Backup
tags:
- mw-backend
@@ -113,16 +145,14 @@
with_items:
- borgbackup
- name: mkdir
- with_items:
- - /mediawiki-backup
file:
state: directory
- path: "{{ item }}"
+ path: "/opt/mediawiki/backup"
- name: borgbackup init
- shell: borgbackup init -e none /mediawiki-borg
+ shell: borgbackup init -e none /opt/mediawiki/borg
args:
- creates: /mediawiki-borg
+ creates: /opt/mediawiki/borg
- copy:
src: "{{ item }}"
@@ -132,10 +162,3 @@
- bin/mw-dump-backup
- bin/mw-dump-db
- bin/mw-make-backup
-
-- name: Semantic MediaWiki
- tags:
- - mw-backend
- - smw
- block:
- - include_tasks: semantic-mediawiki.yml
diff --git a/ansible/roles/mw-backend/tasks/semantic-mediawiki.yml b/ansible/roles/mw-backend/tasks/semantic-mediawiki.yml
deleted file mode 100644
index c035ce3..0000000
--- a/ansible/roles/mw-backend/tasks/semantic-mediawiki.yml
+++ /dev/null
@@ -1,78 +0,0 @@
-- name: packages
- apt:
- name: "{{ item }}"
- install_recommends: no
- with_items:
- - composer
- - php-zip
-- name: directories
- file:
- state: directory
- path: /opt/mediawiki
- owner: root
- group: root
-- name: directories
- file:
- state: directory
- path: /opt/mediawiki/semantic-media-wiki
- owner: www-data
- group: root
-
-- name: composer config
- copy:
- src: opt/mediawiki/semantic-media-wiki/composer.json
- dest: /opt/mediawiki/semantic-media-wiki/composer.json
-
-- tags: composer
- block:
- - name: run composer update
- become: yes
- become_user: www-data
- register: run_composer_update
- composer:
- command: update
- working_dir: /opt/mediawiki/semantic-media-wiki
-
- - name: composer update stdout
- debug: var=run_composer_update.stdout_lines
- when: run_composer_update.stdout_lines is defined
-
- - name: composer update stderr
- debug: var=run_composer_update.stderr_lines
- when: run_composer_update.stderr_lines is defined
-
-- tags: composer
- block:
- - name: run composer install
- tags: composer
- become: yes
- become_user: www-data
- register: run_composer_install
- composer:
- command: install
- working_dir: /opt/mediawiki/semantic-media-wiki
-
- - name: composer install stdout
- debug: var=run_composer_install.stdout_lines
- when: run_composer_install.stdout_lines is defined
-
- - name: composer install stderr
- debug: var=run_composer_install.stderr_lines
- when: run_composer_install.stderr_lines is defined
-
-- name: symlink smw into mw extensions
- file:
- state: link
- dest: "/var/lib/mediawiki/extensions/{{ item }}"
- src: "/opt/mediawiki/semantic-media-wiki/extensions/{{ item }}"
- with_items:
- - SemanticMediaWiki
- - SemanticResultFormats
-
-- name: symlink maintenance into smw
- file:
- state: link
- dest: "/opt/mediawiki/semantic-media-wiki/maintenance"
- src: "/var/lib/mediawiki/maintenance"
- owner: root
- group: root
diff --git a/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2 b/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2
index 9def832..450dfab 100644
--- a/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2
+++ b/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2
@@ -119,6 +119,10 @@ $wgDefaultSkin = "vector";
# Enabled skins.
# The following skins were automatically enabled:
+
+wfLoadExtension( 'Scribunto' );
+$wgScribuntoDefaultEngine = 'luastandalone';
+
wfLoadSkin( 'CologneBlue' );
wfLoadSkin( 'Modern' );
wfLoadSkin( 'MonoBook' );
@@ -133,7 +137,7 @@ wfLoadExtension( 'Cite' );
wfLoadExtension( 'ParserFunctions' );
# Doesnt work yet: wfLoadExtension( 'SemanticMediaWiki' );
-require_once "/opt/mediawiki/semantic-media-wiki/vendor/autoload.php";
+require_once "/opt/mediawiki/extensions/vendor/autoload.php";
# End of automatically generated settings.
# Add more configuration options below.