diff options
-rwxr-xr-x | scripts/upgrade.sh | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index feb3091a8..abb7e9414 100755 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh | |||
@@ -2,26 +2,28 @@ | |||
2 | 2 | ||
3 | set -eu | 3 | set -eu |
4 | 4 | ||
5 | PEERTUBE_PATH=/var/www/peertube/ | ||
6 | |||
5 | # Backup database | 7 | # Backup database |
6 | SQL_BACKUP_PATH="/var/www/peertube/backup/sql-peertube_prod-$(date +"%Y%m%d-%H%M").bak" | 8 | SQL_BACKUP_PATH="$PEERTUBE_PATH/backup/sql-peertube_prod-$(date +"%Y%m%d-%H%M").bak" |
7 | mkdir -p /var/www/peertube/backup | 9 | mkdir -p $PEERTUBE_PATH/backup |
8 | pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH" | 10 | pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH" |
9 | 11 | ||
10 | # Get and Display the Latest Version | 12 | # Get and Display the Latest Version |
11 | VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) | 13 | VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) |
12 | echo "Latest Peertube version is $VERSION" | 14 | echo "Latest Peertube version is $VERSION" |
13 | wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" -O "/var/www/peertube/versions/peertube-${VERSION}.zip" | 15 | wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" -O "$PEERTUBE_PATH/versions/peertube-${VERSION}.zip" |
14 | cd /var/www/peertube/versions | 16 | cd $PEERTUBE_PATH/versions |
15 | unzip -o "peertube-${VERSION}.zip" | 17 | unzip -o "peertube-${VERSION}.zip" |
16 | rm -f "peertube-${VERSION}.zip" | 18 | rm -f "peertube-${VERSION}.zip" |
17 | 19 | ||
18 | # Upgrade Scripts | 20 | # Upgrade Scripts |
19 | rm -rf /var/www/peertube/peertube-latest | 21 | rm -rf $PEERTUBE_PATH/peertube-latest |
20 | ln -s "/var/www/peertube/versions/peertube-${VERSION}" /var/www/peertube/peertube-latest | 22 | ln -s "$PEERTUBE_PATH/versions/peertube-${VERSION}" $PEERTUBE_PATH/peertube-latest |
21 | cd /var/www/peertube/peertube-latest | 23 | cd $PEERTUBE_PATH/peertube-latest |
22 | yarn install --production --pure-lockfile | 24 | yarn install --production --pure-lockfile |
23 | cp /var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml | 25 | cp $PEERTUBE_PATH/peertube-latest/config/default.yaml $PEERTUBE_PATH/config/default.yaml |
24 | 26 | ||
25 | echo "Differences in configuration files..." | 27 | echo "Differences in configuration files..." |
26 | diff "/var/www/peertube/versions/peertube-${VERSION}/config/production.yaml.example" /var/www/peertube/config/production.yaml | 28 | diff "$PEERTUBE_PATH/versions/peertube-${VERSION}/config/production.yaml.example" $PEERTUBE_PATH/config/production.yaml |
27 | 29 | ||