]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - scripts/upgrade.sh
Automatic resolution according to user bandwidth V1
[github/Chocobozzz/PeerTube.git] / scripts / upgrade.sh
CommitLineData
0e4ffb4b 1#!/bin/sh
64586951 2
0e4ffb4b 3set -eu
64586951
SL
4
5# Backup database
f8087a54 6SQL_BACKUP_PATH="/var/www/peertube/backup/sql-peertube_prod-$(date +\"%Y%m%d-%H%M\").bak"
a8b5ce95 7mkdir -p /var/www/peertube/backup
64586951
SL
8pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH"
9
10# Get and Display the Latest Version
11VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4)
12echo "Latest Peertube version is $VERSION"
0e4ffb4b 13wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" -O "/var/www/peertube/versions/peertube-${VERSION}.zip"
a8b5ce95 14cd /var/www/peertube/versions
0e4ffb4b
LA
15unzip -o "peertube-${VERSION}.zip"
16rm -f "peertube-${VERSION}.zip"
64586951
SL
17
18# Upgrade Scripts
a8b5ce95 19rm -rf /var/www/peertube/peertube-latest
0e4ffb4b
LA
20ln -s "/var/www/peertube/versions/peertube-${VERSION}" /var/www/peertube/peertube-latest
21cd /var/www/peertube/peertube-latest
64586951 22yarn install --production --pure-lockfile
a8b5ce95 23cp /var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml
64586951 24
34333925 25echo "Differences in configuration files..."
0e4ffb4b 26diff "/var/www/peertube/versions/peertube-${VERSION}/config/production.yaml.example" /var/www/peertube/config/production.yaml
34333925 27