5 if [ "$#" -lt 2 ]; then
6 echo 'Need two arguments: old server IP, and service name.'
9 if [ ! "$2" = "pleroma_otp" ] && [ ! "$2" = "pleroma_source" ] && [ ! "$2" = "peertube" ]; then
10 echo "Need legal service name (pleroma_otp or pleroma_source or peertube)."
16 if [ "${app}" = "pleroma_otp" ]; then
18 dirs="/var/lib/pleroma/uploads /etc/pleroma"
20 elif [ "${app}" = "pleroma_source" ]; then
22 dirs="/var/lib/pleroma/uploads /opt/pleroma/config"
24 elif [ "${app}" = "peertube" ]; then
25 db_name="peertube_prod"
26 dirs="/var/www/peertube/storage /var/www/peertube/config"
29 config_tree_prefix="${HOME}/config/buster"
30 setup_scripts_dir="${config_tree_prefix}/setup_scripts"
32 cd "${setup_scripts_dir}"
33 ./prepare_to_meet_server.sh "${server_ip}"
34 read -p'Hit Enter when you are done.' ignore
35 eval $(ssh-agent) && ssh-add
36 echo 'Enter password for root on target server next.'
37 ssh plom@"${server_ip}" "su -lc \"cd config/buster/setup_scripts && git pull && ./backup_app.sh ${service} ${db_name} ${dirs}\""
38 scp plom@"${server_ip}":~/${service}_backup.tar /home/plom/${service}_backup.tar
39 ./restore_app.sh "${app}" "${db_name}"