From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 23 Jan 2020 22:03:36 +0000 (+0100)
Subject: Plemora migration scripts.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/bar%20baz.html?a=commitdiff_plain;h=93f8e23a461f76cf802c8f882d08acb91fc60cd2;p=config

Plemora migration scripts.
---

diff --git a/buster/setup_scripts/backup_pleroma.sh b/buster/setup_scripts/backup_pleroma.sh
new file mode 100755
index 0000000..ae1e6bd
--- /dev/null
+++ b/buster/setup_scripts/backup_pleroma.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+# Heavily inspired by <https://docs.pleroma.social/backup.html>
+
+service pleroma stop
+su postgres -lc 'pg_dump -d pleroma --format=custom -f /tmp/pleroma.pgdump'
+cd /tmp
+mkdir pleroma_backup
+mv pleroma.pgdump pleroma_backup
+cp -a /var/lib/pleroma/uploads pleroma_backup/uploads
+cp -a /etc/pleroma pleroma_backup/etc_files
+tar cf pleroma_backup.tar pleroma_backup
+chown plom:plom pleroma_backup.tar
+mv pleroma_backup.tar /home/plom/
+service pleroma start
diff --git a/buster/setup_scripts/restore_pleroma.sh b/buster/setup_scripts/restore_pleroma.sh
new file mode 100755
index 0000000..4f4d05b
--- /dev/null
+++ b/buster/setup_scripts/restore_pleroma.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+# Heavily inspired by <https://docs.pleroma.social/backup.html>
+
+service pleroma stop
+mv /home/plom/pleroma_backup.tar /tmp/
+cd /tmp
+tar xf pleroma_backup.tar
+cp -a pleroma_backup/uploads/* /var/lib/pleroma/uploads/
+cp -a pleroma_backup/etc_files/* /etc/pleroma/
+su postgres -lc 'pg_restore --clean -d pleroma -v -1 /tmp/pleroma_backup/pleroma.pgdump'
+service pleroma start