From c4e8053d8aed6cf3141b6a0912a52cf2f945bbfc Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 18 Mar 2019 12:12:42 +0100 Subject: [PATCH] update migration script after successful migration --- migration.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/migration.sh b/migration.sh index 7510ba5..4f2ea30 100755 --- a/migration.sh +++ b/migration.sh @@ -16,9 +16,6 @@ function sync-volumes { rsync -a --rsync-path="sudo rsync" "$OLD_SERVER:$OLD_BASE_FOLDER/storage/thumbnails/" "$NEW_BASE_FOLDER/data/thumbnails/" rsync -a --rsync-path="sudo rsync" "$OLD_SERVER:$OLD_BASE_FOLDER/storage/torrents/" "$NEW_BASE_FOLDER/data/torrents/" rsync -a --rsync-path="sudo rsync" "$OLD_SERVER:/var/lib/postgresql/10/main/" "$NEW_BASE_FOLDER/db/" - cp db_config/* "$NEW_BASE_FOLDER/db/" - chown 70:115 volumes/db/ -R - chown 999:999 volumes/data/ -R } if [ "$(whoami)" != "root" ]; then @@ -58,6 +55,9 @@ rm -r "$NEW_BASE_FOLDER/db/" || true # we do this while the old server is still running to reduce downtime sync-volumes +# add database config files +cp db_config/* "$NEW_BASE_FOLDER/db/" + read -p "Initial copy complete. Do you want to complete the migration now? [y/N] " yn if [ "$yn" != "y" ]; then exit @@ -69,8 +69,12 @@ ssh $OLD_SERVER sudo systemctl stop peertube # now that the old server is offline, we can do a final copy sync-volumes +# fix permissions +chown 70:115 volumes/db/ -R +chown 999:999 volumes/data/ -R + # TODO: also need to update domain in .env and traefik.toml (maybe with sed, or just set it before we migrate) -docker-compose -f "$NEW_BASE_FOLDER/docker-compose.yaml" up -d +docker-compose -f "/peertube/docker-compose.yaml" up -d # TODO: first check that docker-compose started without errors (eg database password working) echo "Now update the dns entries for $DOMAIN to point at the new server"