aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/mw-backend/files
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/mw-backend/files')
-rw-r--r--ansible/roles/mw-backend/files/bin/mw-dump-backup9
-rw-r--r--ansible/roles/mw-backend/files/bin/mw-dump-db11
-rw-r--r--ansible/roles/mw-backend/files/bin/mw-make-backup5
3 files changed, 25 insertions, 0 deletions
diff --git a/ansible/roles/mw-backend/files/bin/mw-dump-backup b/ansible/roles/mw-backend/files/bin/mw-dump-backup
new file mode 100644
index 0000000..5530b03
--- /dev/null
+++ b/ansible/roles/mw-backend/files/bin/mw-dump-backup
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+set -euo pipefail
+
+exec php /usr/share/mediawiki/maintenance/dumpBackup.php \
+ --full \
+ --include-files \
+ --uploads \
+ > /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
new file mode 100644
index 0000000..0a82059
--- /dev/null
+++ b/ansible/roles/mw-backend/files/bin/mw-dump-db
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -euo pipefail
+
+export PGHOST=$(sed -n 's,^.wgDBserver.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSettings.php)
+export PGUDATABASE=$(sed -n 's,^.wgDBname.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSettings.php)
+export PGUSER=$(sed -n 's,^.wgDBuser.*"\([^"]*\)".*,\1,p' /etc/mediawiki/LocalSettings.php)
+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
diff --git a/ansible/roles/mw-backend/files/bin/mw-make-backup b/ansible/roles/mw-backend/files/bin/mw-make-backup
new file mode 100644
index 0000000..18c48e2
--- /dev/null
+++ b/ansible/roles/mw-backend/files/bin/mw-make-backup
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+set -euo pipefail
+
+exec borg create /mediawiki-borg::mediawiki-{now:%Y%m%d-%H%M%S} /mediawiki-backup