home · contact · privacy
Pleroma migration scripts.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 26 Jan 2020 21:40:15 +0000 (22:40 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 26 Jan 2020 21:40:15 +0000 (22:40 +0100)
buster/setup_scripts/backup_pleroma.sh
buster/setup_scripts/migrate_pleroma.sh [new file with mode: 0755]
buster/setup_scripts/prepare_to_meet_server.sh [new file with mode: 0755]
buster/setup_scripts/restore_pleroma.sh

index ae1e6bdc28fdea721d75ed0c0fd4d1ee7261cf7b..ae95b4dfa11b9d2b8f07400f2c6cd641cc020c1d 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
 set -e
+set -x
 # Heavily inspired by <https://docs.pleroma.social/backup.html>
 
 service pleroma stop
diff --git a/buster/setup_scripts/migrate_pleroma.sh b/buster/setup_scripts/migrate_pleroma.sh
new file mode 100755 (executable)
index 0000000..bff9872
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+set -e
+set -x
+# Heavily inspired by <https://docs.pleroma.social/backup.html>
+
+if [ "$#" -ne 1 ]; then
+    echo 'Need server IP as argument.'
+    false
+fi
+server_ip="$1"
+
+config_tree_prefix="${HOME}/config/buster"
+setup_scripts_dir="${config_tree_prefix}/setup_scripts"
+cd "${setup_scripts_dir}"
+./prepare_to_meet_server.sh "${server_ip}"
+read -p'Hit Enter when you are done.' ignore
+ssh plom@"${server_ip}" 'su -lc "cd config && git pull"'
+ssh plom@"${server_ip}" 'su -lc "cd config/buster/setup_scripts && ./backup_pleroma.sh"'
+scp plom@"${server_ip}":~/pleroma_backup.tar /home/plom/pleroma_backup.tar
+./backup_pleroma.sh
diff --git a/buster/setup_scripts/prepare_to_meet_server.sh b/buster/setup_scripts/prepare_to_meet_server.sh
new file mode 100755 (executable)
index 0000000..569bf74
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Do some of the steps necessary to SSH (key-based) with another server.
+set -e
+
+if [ "$#" -ne 1 ]; then
+    echo 'Need server IP as argument.'
+    false
+fi
+target="$1"
+
+# We need a public key to copy over, so generate it if not found.
+if [ ! -f ~/.ssh/id_rsa.pub ]; then
+    ssh-keygen
+fi
+
+# Add target to ~/.ssh/known_hosts so we don't get
+# asked for permission at inopportune moments.
+ssh-keyscan -H "$target" >> ~/.ssh/known_hosts
+
+# Tell user what to do.
+echo "APPEND FOLLOWING TO TARGET'S ~/.ssh/authorized_keys:"
+cat ~/.ssh/id_rsa.pub
index 4f4d05bf2212e6c4a2570afa32e37410308a6c0f..844a655e0327ec4f23b620954dd2021bc3d36c7f 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
 set -e
+set -x
 # Heavily inspired by <https://docs.pleroma.social/backup.html>
 
 service pleroma stop