]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - scripts/upgrade.sh
Automatic resolution according to user bandwidth V1
[github/Chocobozzz/PeerTube.git] / scripts / upgrade.sh
... / ...
CommitLineData
1#!/bin/sh
2
3set -eu
4
5# Backup database
6SQL_BACKUP_PATH="/var/www/peertube/backup/sql-peertube_prod-$(date +\"%Y%m%d-%H%M\").bak"
7mkdir -p /var/www/peertube/backup
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"
13wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" -O "/var/www/peertube/versions/peertube-${VERSION}.zip"
14cd /var/www/peertube/versions
15unzip -o "peertube-${VERSION}.zip"
16rm -f "peertube-${VERSION}.zip"
17
18# Upgrade Scripts
19rm -rf /var/www/peertube/peertube-latest
20ln -s "/var/www/peertube/versions/peertube-${VERSION}" /var/www/peertube/peertube-latest
21cd /var/www/peertube/peertube-latest
22yarn install --production --pure-lockfile
23cp /var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml
24
25echo "Differences in configuration files..."
26diff "/var/www/peertube/versions/peertube-${VERSION}/config/production.yaml.example" /var/www/peertube/config/production.yaml
27