From 64d60d8904ae6286c8a506e6404845dc52ac8c0d Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Fri, 15 Mar 2019 01:26:19 +0100 Subject: [PATCH] get ready for final migration --- .env | 12 +++++++----- migration.sh | 18 ++++++++++-------- traefik.toml | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.env b/.env index 4be50bd..093e56a 100644 --- a/.env +++ b/.env @@ -1,6 +1,4 @@ -PEERTUBE_DB_USERNAME=peertube -PEERTUBE_DB_PASSWORD=WBUe8qGIIQFUIkcg -PEERTUBE_WEBSERVER_HOSTNAME=testing.peertube.social +PEERTUBE_WEBSERVER_HOSTNAME=peertube.social PEERTUBE_WEBSERVER_PORT=443 PEERTUBE_WEBSERVER_HTTPS=true PEERTUBE_TRUST_PROXY=["127.0.0.1"] @@ -11,7 +9,11 @@ PEERTUBE_TRUST_PROXY=["127.0.0.1"] #PEERTUBE_SMTP_PASSWORD= PEERTUBE_SMTP_HOSTNAME=postfix PEERTUBE_SMTP_PORT=25 -PEERTUBE_SMTP_FROM=info@testing.peertube.social +PEERTUBE_SMTP_FROM=info@peertube.social PEERTUBE_SMTP_TLS=false #PEERTUBE_SMTP_DISABLE_STARTTLS=false -PEERTUBE_ADMIN_EMAIL=info@testing.peertube.social +PEERTUBE_ADMIN_EMAIL=info@peertube.social + +# this will override the config value +#PEERTUBE_DB_USERNAME=peertube +#PEERTUBE_DB_PASSWORD=WBUe8qGIIQFUIkcg diff --git a/migration.sh b/migration.sh index cd0929a..61a08a7 100755 --- a/migration.sh +++ b/migration.sh @@ -5,17 +5,17 @@ DOMAIN="peertube.social" OLD_SERVER="migration-user@$DOMAIN" OLD_BASE_FOLDER="/var/www/peertube" NEW_BASE_FOLDER="/peertube/volumes" -RSYNC_PARAMS="-a --rsync-path=\"sudo rsync\" --bwlimit=5000" function sync-volumes { mkdir -p "$NEW_BASE_FOLDER" mkdir -p "$NEW_BASE_FOLDER/data/" - rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/avatars/" "$NEW_BASE_FOLDER/data/avatars/" - rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/cache/" "$NEW_BASE_FOLDER/data/cache/" - rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/captions/" "$NEW_BASE_FOLDER/data/captions/" - rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/previews/" "$NEW_BASE_FOLDER/data/previews/" - rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/thumbnails/" "$NEW_BASE_FOLDER/data/thumbnails/" - rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/torrents/" "$NEW_BASE_FOLDER/data/torrents/" + rsync -a --rsync-path="sudo rsync" "$OLD_SERVER:$OLD_BASE_FOLDER/storage/avatars/" "$NEW_BASE_FOLDER/data/avatars/" + rsync -a --rsync-path="sudo rsync" "$OLD_SERVER:$OLD_BASE_FOLDER/storage/cache/" "$NEW_BASE_FOLDER/data/cache/" + rsync -a --rsync-path="sudo rsync" "$OLD_SERVER:$OLD_BASE_FOLDER/storage/captions/" "$NEW_BASE_FOLDER/data/captions/" + rsync -a --rsync-path="sudo rsync" "$OLD_SERVER:$OLD_BASE_FOLDER/storage/previews/" "$NEW_BASE_FOLDER/data/previews/" + 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/" + cp db_config/* "$NEW_BASE_FOLDER/db/" } if [ "$(whoami)" != "root" ]; then @@ -46,7 +46,8 @@ fi # remove any existing volume files # https://stackoverflow.com/a/790245 -rm -r "$NEW_BASE_FOLDER/data/" | true +rm -r "$NEW_BASE_FOLDER/data/" || true +rm -r "$NEW_BASE_FOLDER/db/" || true # dont delete this because it would take too long to sync #rm -r "/mnt/external/*" | true @@ -68,4 +69,5 @@ sync-volumes # 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 +# 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" diff --git a/traefik.toml b/traefik.toml index ffcac5e..458faea 100644 --- a/traefik.toml +++ b/traefik.toml @@ -60,7 +60,7 @@ entryPoint = "https" # Domains list. # [[acme.domains]] - main = "testing.peertube.social" + main = "peertube.social" # Use a HTTP-01 acme challenge rather than TLS-SNI-01 challenge #