1
0
mirror of https://yerbamate.ml/nutomic/peertube.social synced 2024-11-25 01:28:21 -05:00

Update paths

This commit is contained in:
Felix Ableitner 2019-03-12 14:50:38 +01:00
parent 171620046d
commit 01c3c66397
3 changed files with 11 additions and 15 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
docker-volume/ volumes/

View File

@ -10,7 +10,7 @@ services:
- "443:443" # The HTTPS port - "443:443" # The HTTPS port
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
- ./docker-volumes/traefik/acme.json:/etc/acme.json - ./volumes/traefik/acme.json:/etc/acme.json
- ./traefik.toml:/traefik.toml - ./traefik.toml:/traefik.toml
restart: "always" restart: "always"
# If you want to use the Traefik dashboard, you should expose it on a # If you want to use the Traefik dashboard, you should expose it on a
@ -27,8 +27,9 @@ services:
traefik.frontend.rule: "Host:${PEERTUBE_WEBSERVER_HOSTNAME}" traefik.frontend.rule: "Host:${PEERTUBE_WEBSERVER_HOSTNAME}"
traefik.port: "9000" traefik.port: "9000"
volumes: volumes:
- ./docker-volumes/data:/data - ./volumes/data:/data
- ./docker-volumes/config:/config - /mnt/external:/data-external
- ./volumes/config:/config
depends_on: depends_on:
- postgres - postgres
- redis - redis
@ -42,7 +43,7 @@ services:
POSTGRES_PASSWORD: ${PEERTUBE_DB_PASSWORD} POSTGRES_PASSWORD: ${PEERTUBE_DB_PASSWORD}
POSTGRES_DB: peertube POSTGRES_DB: peertube
volumes: volumes:
- ./docker-volumes/db:/var/lib/postgresql/data - ./volumes/db:/var/lib/postgresql/data
restart: "always" restart: "always"
labels: labels:
traefik.enable: "false" traefik.enable: "false"
@ -50,7 +51,7 @@ services:
redis: redis:
image: redis:5-alpine image: redis:5-alpine
volumes: volumes:
- ./docker-volumes/redis:/data - ./volumes/redis:/data
restart: "always" restart: "always"
labels: labels:
- "traefik.enable=false" - "traefik.enable=false"

View File

@ -4,24 +4,18 @@ set -e
DOMAIN="peertube.social" DOMAIN="peertube.social"
OLD_SERVER="migration-user@$DOMAIN" OLD_SERVER="migration-user@$DOMAIN"
OLD_BASE_FOLDER="/var/www/peertube" OLD_BASE_FOLDER="/var/www/peertube"
NEW_BASE_FOLDER="/peertube/docker-volumes" NEW_BASE_FOLDER="/peertube/volumes"
RSYNC_PARAMS="-a --rsync-path=\"sudo rsync\" --bwlimit=5000" RSYNC_PARAMS="-a --rsync-path=\"sudo rsync\" --bwlimit=5000"
function sync-volumes { function sync-volumes {
mkdir -p "$NEW_BASE_FOLDER" mkdir -p "$NEW_BASE_FOLDER"
mkdir -p "$NEW_BASE_FOLDER/data/" mkdir -p "$NEW_BASE_FOLDER/data/"
rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/config/" "$NEW_BASE_FOLDER/config/"
rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/avatars/" "$NEW_BASE_FOLDER/data/avatars/" 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/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/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/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/thumbnails/" "$NEW_BASE_FOLDER/data/thumbnails/"
rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/torrents/" "$NEW_BASE_FOLDER/data/torrents/" rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/torrents/" "$NEW_BASE_FOLDER/data/torrents/"
# TODO: change folders in config/docker-compose
rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/external/videos/" "/mnt/external/videos/"
rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/external/redundancy/" "/mnt/external/redundancy/"
rsync $RSYNC_PARAMS "$OLD_SERVER:$OLD_BASE_FOLDER/storage/external/tmp/" "/mnt/external/tmp/"
} }
if [ "$(whoami)" != "root" ]; then if [ "$(whoami)" != "root" ]; then
@ -38,9 +32,10 @@ fi
echo "Before running this script, ensure the following: echo "Before running this script, ensure the following:
- this script is running on the new server (migration target) - this script is running on the new server (migration target)
- docker-compose based setup for peertube is already installed in /peertube/ - docker-compose based setup for peertube is already installed in /peertube/
- peertube config with adjusted paths is in /peertube/volumes/config/
- set reverse dns for new server to $DOMAIN - set reverse dns for new server to $DOMAIN
- set DNS TTL for $DOMAIN to the minimum possible value - set DNS TTL for $DOMAIN to the minimum possible value
- new external storage is mounted under /mnt/external/ - videos are mounted under /mnt/external
- backups are in place and tested (ideally also of videos) - backups are in place and tested (ideally also of videos)
" "
@ -51,7 +46,7 @@ fi
# remove any existing volume files # remove any existing volume files
# https://stackoverflow.com/a/790245 # https://stackoverflow.com/a/790245
rm -r "$NEW_BASE_FOLDER"/* | true rm -r "$NEW_BASE_FOLDER/data/" | true
# dont delete this because it would take too long to sync # dont delete this because it would take too long to sync
#rm -r "/mnt/external/*" | true #rm -r "/mnt/external/*" | true