home · contact · privacy
Fix Pleroma migration scripts.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 26 Jan 2020 22:41:28 +0000 (23:41 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 26 Jan 2020 22:41:28 +0000 (23:41 +0100)
buster/setup_scripts/migrate_pleroma.sh
buster/setup_scripts/restore_pleroma.sh

index bff98722e2944f0503cb7070dab55439a411158d..5eefc39f561c05941592c07c13a6252601a026cb 100755 (executable)
@@ -11,10 +11,15 @@ server_ip="$1"
 
 config_tree_prefix="${HOME}/config/buster"
 setup_scripts_dir="${config_tree_prefix}/setup_scripts"
+
+# So we're only asked once …
+eval $(ssh-agent)
+ssh-add
+
 cd "${setup_scripts_dir}"
 ./prepare_to_meet_server.sh "${server_ip}"
 read -p'Hit Enter when you are done.' ignore
 ssh plom@"${server_ip}" 'su -lc "cd config && git pull"'
 ssh plom@"${server_ip}" 'su -lc "cd config/buster/setup_scripts && ./backup_pleroma.sh"'
 scp plom@"${server_ip}":~/pleroma_backup.tar /home/plom/pleroma_backup.tar
-./backup_pleroma.sh
+./restore_pleroma.sh
index 844a655e0327ec4f23b620954dd2021bc3d36c7f..325aa236c870776840f094f667ba324bc1cbcd4c 100755 (executable)
@@ -10,4 +10,9 @@ tar xf pleroma_backup.tar
 cp -a pleroma_backup/uploads/* /var/lib/pleroma/uploads/
 cp -a pleroma_backup/etc_files/* /etc/pleroma/
 su postgres -lc 'pg_restore --clean -d pleroma -v -1 /tmp/pleroma_backup/pleroma.pgdump'
+
+# TODO: Horrible hack, improve.
+db_pw=$(cat /etc/pleroma/config.exs | grep password | sed 's/[ ]*password\: *//g' | sed 's/,//g' | sed 's/"//g')
+su postgres -lc "psql -c \"ALTER USER pleroma WITH PASSWORD '${db_pw}';\""
+
 service pleroma start