get ready for final migration

This commit is contained in:
Felix Ableitner 2019-03-15 01:26:19 +01:00
parent 01c3c66397
commit 64d60d8904
3 changed files with 18 additions and 14 deletions

12
.env
View file

@ -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

View file

@ -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"

View file

@ -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
#