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)."
15 if [ "${app}" = "pleroma_otp" ]; then
17 dirs="/var/lib/pleroma/uploads /etc/pleroma"
18 if [ "${app}" = "pleroma_source" ]; then
20 dirs="/var/lib/pleroma/uploads /opt/pleroma/config"
21 elif [ "${app}" = "peertube" ]; then
22 db_name="peertube_prod"
23 dirs="/var/www/peertube/storage /var/www/peertube/config"
26 config_tree_prefix="${HOME}/config/buster"
27 setup_scripts_dir="${config_tree_prefix}/setup_scripts"
29 cd "${setup_scripts_dir}"
30 ./prepare_to_meet_server.sh "${server_ip}"
31 read -p'Hit Enter when you are done.' ignore
32 eval $(ssh-agent) && ssh-add
33 echo 'Enter password for root on target server next.'
34 ssh plom@"${server_ip}" "su -lc \"cd config/buster/setup_scripts && git pull && ./backup_app.sh ${app} ${db_name} ${dirs}\""
35 scp plom@"${server_ip}":~/${app}_backup.tar /home/plom/${app}_backup.tar
36 ./restore_app.sh "${app}" "${db_name}"