From: Christian Heller Date: Thu, 27 Feb 2020 23:56:54 +0000 (+0100) Subject: Fix. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/static/%7B%7Bdb.prefix%7D%7D/todos?a=commitdiff_plain;h=d0ea846a4695f6d14ee8ae517425f91489e1aa7e;p=config Fix. --- diff --git a/buster/setup_scripts/migrate_app.sh b/buster/setup_scripts/migrate_app.sh index 6e18f33..f06b156 100755 --- a/buster/setup_scripts/migrate_app.sh +++ b/buster/setup_scripts/migrate_app.sh @@ -12,12 +12,15 @@ if [ ! "$2" = "pleroma_otp" ] && [ ! "$2" = "pleroma_source" ] && [ ! "$2" = "pe fi server_ip="$1" app="$2" +service="$2" if [ "${app}" = "pleroma_otp" ]; then db_name="pleroma" dirs="/var/lib/pleroma/uploads /etc/pleroma" -if [ "${app}" = "pleroma_source" ]; then + service=pleroma +elif [ "${app}" = "pleroma_source" ]; then db_name="pleroma" dirs="/var/lib/pleroma/uploads /opt/pleroma/config" + service=pleroma elif [ "${app}" = "peertube" ]; then db_name="peertube_prod" dirs="/var/www/peertube/storage /var/www/peertube/config" @@ -31,6 +34,6 @@ cd "${setup_scripts_dir}" 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_app.sh ${app} ${db_name} ${dirs}\"" +ssh plom@"${server_ip}" "su -lc \"cd config/buster/setup_scripts && git pull && ./backup_app.sh ${service} ${db_name} ${dirs}\"" scp plom@"${server_ip}":~/${app}_backup.tar /home/plom/${app}_backup.tar ./restore_app.sh "${app}" "${db_name}" diff --git a/buster/setup_scripts/restore_app.sh b/buster/setup_scripts/restore_app.sh index 363a5f6..b5bef5a 100755 --- a/buster/setup_scripts/restore_app.sh +++ b/buster/setup_scripts/restore_app.sh @@ -12,17 +12,21 @@ if [ ! "$1" = "pleroma_otp" ] && [ ! "$1" = "pleroma_sourc" ] && [ ! "$1" = "pee fi app="$1" db_name="$2" +service="$1" +if [ "${app}" = "pleroma_source" || "${app}" = "pleroma_otp" ]; then + service=pleroma +fi -service "${app}" stop +service "${service}" stop -mv "/home/plom/${app}_backup.tar" /tmp/ +mv "/home/plom/${service}_backup.tar" /tmp/ cd /tmp -tar xf "${app}_backup.tar" +tar xf "${service}_backup.tar" -su postgres -c "pg_restore -c -1 -d ${db_name} ${app}_backup/${db_name}.pgdump" +su postgres -c "pg_restore -c -1 -d ${db_name} ${service}_backup/${db_name}.pgdump" rm "${app}_backup/${db_name}.pgdump" -cd "${app}_backup" +cd "${service}_backup" for path in $(find . -type f); do if [ "${app}" = "pleroma_source" ]; then if [ "${path}" = '/opt/pleroma/config/prod.secret.exs' ]; then @@ -44,4 +48,4 @@ elif [ "${app}" = "peertube" ]; then fi su postgres -lc "psql -c \"ALTER USER ${app} WITH PASSWORD '${db_pw}';\"" -service "${app}" start +service "${service}" start