--- /dev/null
+#!/bin/sh
+set -e
+
+service peertube stop
+cd /tmp
+mkdir -p peertube_backup
+su peertube -c 'pg_dump -Fc peertube_prod' > peertube_backup/peertube_prod-dump.db
+cp -a /var/www/peertube/storage peertube_backup/storage
+cp -a /var/www/peertube/config peertube_backup/config
+tar cf peertube_backup.tar peertube_backup
+chown plom:plom peertube_backup.tar
+mv peertube_backup.tar /home/plom/
+service peertube start
cp -a /var/lib/pleroma/uploads pleroma_backup/uploads
cp -a /etc/pleroma pleroma_backup/etc_files
tar cf pleroma_backup.tar pleroma_backup
+rm -rf pleroma_backup
chown plom:plom pleroma_backup.tar
mv pleroma_backup.tar /home/plom/
service pleroma start
--- /dev/null
+#!/bin/sh
+set -e
+
+# 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
+eval $(ssh-agent) && ssh-add
+echo 'Enter password for root on target server next.'
+ssh plom@"${server_ip}" 'su -lc "cd config/buster/setup_scripts && git pull && ./backup_peertube.sh"'
+scp plom@"${server_ip}":~/peertube_backup.tar /home/plom/peertube_backup.tar
+./restore_peertube.sh
+
--- /dev/null
+#!/bin/sh
+set -e
+
+service peertube stop
+mv /home/plom/peertube_backup.tar /tmp/
+cd /tmp
+tar xf peertube_backup.tar
+cp -a peertube_backup/storage/* /var/www/peertube/storage/
+cp -a peertube_backup/config/* /var/www/peertube/config/
+su postgres -c 'pg_restore -c -C -d postgres peertube_backup/peertube_prod-dump.db'
+
+db_pw=$(cat /var/www/peertube/config/production.yaml | grep password | head -1 | sed "s/[ ]*password\: *//g" | sed "s/'//g")
+su postgres -lc "psql -c \"ALTER USER peertube WITH PASSWORD '${db_pw}';\""
+
+service peertube start
#!/bin/sh
set -e
-set -x
+
# Heavily inspired by
# <https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/production.md>
# and