home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 28 Feb 2020 00:14:50 +0000 (01:14 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 28 Feb 2020 00:14:50 +0000 (01:14 +0100)
buster/setup_scripts/migrate_app.sh
buster/setup_scripts/restore_app.sh
buster/setup_scripts/setup_pleroma_source.sh

index f06b156fb2016b67b2157843768971e46937900d..9ae8c8da4a005d90529c0a61b84a91eef63cd05b 100755 (executable)
@@ -35,5 +35,5 @@ 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 ${service} ${db_name} ${dirs}\""
-scp plom@"${server_ip}":~/${app}_backup.tar /home/plom/${app}_backup.tar
+scp plom@"${server_ip}":~/${service}_backup.tar /home/plom/${service}_backup.tar
 ./restore_app.sh "${app}" "${db_name}"
index b5bef5a9d6370c494ec4b8035ea980c053de411a..8850fe6683451f83f97dc7ac7baa442cc3bfddbc 100755 (executable)
@@ -6,14 +6,14 @@ if [ "$#" -lt 2 ]; then
     echo 'Need two arguments: service name and DB name.'
     false
 fi
-if [ ! "$1" = "pleroma_otp" ] && [ ! "$1" = "pleroma_sourc" ] && [ ! "$1" = "peertube" ]; then
+if [ ! "$1" = "pleroma_otp" ] && [ ! "$1" = "pleroma_source" ] && [ ! "$1" = "peertube" ]; then
     echo "Need legal service name (pleroma_otp or pleroma_source or peertube)."
     false
 fi
 app="$1"
 db_name="$2"
 service="$1"
-if [ "${app}" = "pleroma_source" || "${app}" = "pleroma_otp" ]; then
+if [ "${app}" = "pleroma_source" ] || [ "${app}" = "pleroma_otp" ]; then
     service=pleroma
 fi
 
@@ -24,7 +24,7 @@ cd /tmp
 tar xf "${service}_backup.tar"
 
 su postgres -c "pg_restore -c -1 -d ${db_name} ${service}_backup/${db_name}.pgdump"
-rm "${app}_backup/${db_name}.pgdump"
+rm "${service}_backup/${db_name}.pgdump"
 
 cd "${service}_backup"
 for path in $(find . -type f); do
@@ -46,6 +46,8 @@ if [ "${app}" = "pleroma_otp" ]; then
 elif [ "${app}" = "peertube" ]; then
     db_pw=$(cat /var/www/peertube/config/production.yaml | grep password | head -1 | sed "s/[ ]*password\: *//g" | sed "s/'//g")
 fi
-su postgres -lc "psql -c \"ALTER USER ${app} WITH PASSWORD '${db_pw}';\""
+if [ "${app}" = "pleroma_otp" ] || [ "${app}" = "peertube" ]; then
+    su postgres -lc "psql -c \"ALTER USER ${service} WITH PASSWORD '${db_pw}';\""
+fi
 
 service "${service}" start
index e60350f78e70b029697ea1d5ddf2c5b5adeaedcc..c56006f10478662925cba6edc0a52df124b2af15 100755 (executable)
@@ -74,6 +74,10 @@ mkdir -p /var/lib/pleroma/static/static
 cp "${config_tree_prefix}/other_files/pleroma_panel.html" /var/lib/pleroma/static/instance/panel.html
 cp "${config_tree_prefix}/other_files/pleroma_terms-of-service.html" /var/lib/pleroma/static/static/terms-of-service.html
 
+# Upload directory. For some reason this does not exist yet here.
+mkdir -p /var/lib/pleroma/uploads
+chown pleroma:nogroup /var/lib/pleroma/uploads
+
 # Set up letsencrypt certificate. TODO: Is it auto-renewed?
 ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
 certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"