X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=buster%2Fsetup_scripts%2Fmigrate_app.sh;h=9ae8c8da4a005d90529c0a61b84a91eef63cd05b;hb=6b847de2430565e7cd7b654b5cffb6aa1b64a44b;hp=3be68704f87c915162752ab6df3b165723245c21;hpb=edfccdfc1e92443facf6fac46d0d2bb36e1e578c;p=config diff --git a/buster/setup_scripts/migrate_app.sh b/buster/setup_scripts/migrate_app.sh index 3be6870..9ae8c8d 100755 --- a/buster/setup_scripts/migrate_app.sh +++ b/buster/setup_scripts/migrate_app.sh @@ -6,18 +6,24 @@ if [ "$#" -lt 2 ]; then echo 'Need two arguments: old server IP, and service name.' false fi -if [ ! "$2" = "pleroma" ] && [ ! "$2" = "peertube" ]; then - echo "Need legal service name (pleroma or peertube)." +if [ ! "$2" = "pleroma_otp" ] && [ ! "$2" = "pleroma_source" ] && [ ! "$2" = "peertube" ]; then + echo "Need legal service name (pleroma_otp or pleroma_source or peertube)." false fi server_ip="$1" app="$2" -if [ "${app}" = "pleroma" ]; then +service="$2" +if [ "${app}" = "pleroma_otp" ]; then db_name="pleroma" - dirs="/var/www/peertube/storage /var/www/peertube/config" + dirs="/var/lib/pleroma/uploads /etc/pleroma" + 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/lib/pleroma/uploads /etc/pleroma" + dirs="/var/www/peertube/storage /var/www/peertube/config" fi config_tree_prefix="${HOME}/config/buster" @@ -28,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}\"" -scp plom@"${server_ip}":~/${app}_backup.tar /home/plom/${app}_backup.tar +ssh plom@"${server_ip}" "su -lc \"cd config/buster/setup_scripts && git pull && ./backup_app.sh ${service} ${db_name} ${dirs}\"" +scp plom@"${server_ip}":~/${service}_backup.tar /home/plom/${service}_backup.tar ./restore_app.sh "${app}" "${db_name}"