From: Christian Heller Date: Sun, 16 Feb 2020 23:44:23 +0000 (+0100) Subject: Remove redundant scripts. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/task?a=commitdiff_plain;h=a85cb51c5b991642f7af9eefe26a0ea7295883d4;p=config Remove redundant scripts. --- diff --git a/buster/setup_scripts/backup_peertube.sh b/buster/setup_scripts/backup_peertube.sh deleted file mode 100755 index c787c75..0000000 --- a/buster/setup_scripts/backup_peertube.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/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 diff --git a/buster/setup_scripts/backup_pleroma.sh b/buster/setup_scripts/backup_pleroma.sh deleted file mode 100755 index 31b2718..0000000 --- a/buster/setup_scripts/backup_pleroma.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -set -e - -# Heavily inspired by - -service pleroma stop -su postgres -lc 'pg_dump -d pleroma --format=custom -f /tmp/pleroma.pgdump' -cd /tmp -mkdir -p 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 -rm -rf pleroma_backup -chown plom:plom pleroma_backup.tar -mv pleroma_backup.tar /home/plom/ -service pleroma start diff --git a/buster/setup_scripts/migrate_peertube.sh b/buster/setup_scripts/migrate_peertube.sh deleted file mode 100755 index 604920a..0000000 --- a/buster/setup_scripts/migrate_peertube.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -set -e - -# Heavily inspired by - -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 - diff --git a/buster/setup_scripts/migrate_pleroma.sh b/buster/setup_scripts/migrate_pleroma.sh deleted file mode 100755 index 1fc2ec8..0000000 --- a/buster/setup_scripts/migrate_pleroma.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -set -e - -# Heavily inspired by - -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_pleroma.sh"' -scp plom@"${server_ip}":~/pleroma_backup.tar /home/plom/pleroma_backup.tar -./restore_pleroma.sh diff --git a/buster/setup_scripts/restore_peertube.sh b/buster/setup_scripts/restore_peertube.sh deleted file mode 100755 index dad8649..0000000 --- a/buster/setup_scripts/restore_peertube.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/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 diff --git a/buster/setup_scripts/restore_pleroma.sh b/buster/setup_scripts/restore_pleroma.sh deleted file mode 100755 index c081177..0000000 --- a/buster/setup_scripts/restore_pleroma.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -set -e - -# Heavily inspired by - -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' - -# TODO: Horrible hack, improve. -db_pw=$(cat /etc/pleroma/config.exs | grep password | sed 's/[ ]*password\: *//g' | sed 's/,//g' | sed 's/"//g') -su postgres -lc "psql -c \"ALTER USER pleroma WITH PASSWORD '${db_pw}';\"" - -service pleroma start