aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/upgrade.sh24
1 files changed, 8 insertions, 16 deletions
diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh
index d6ee9d166..e7c34a6b4 100644
--- a/scripts/upgrade.sh
+++ b/scripts/upgrade.sh
@@ -1,34 +1,26 @@
1#!/bin/bash 1#!/bin/bash
2 2
3### Note !! ### 3# Strict mode
4# On shell prompt do :
5#
6# $ su - peertube
7# $ ./upgrade.sh
8############
9
10# Stcict mode
11set -e 4set -e
12 5
13# Backup database 6# Backup database
14SQL_BACKUP_PATH="/var/www/peertube/backup/sql-peertube_prod-$(date -Im).bak" 7SQL_BACKUP_PATH="/var/www/peertube/backup/sql-peertube_prod-$(date -Im).bak"
15mkdir -p ~/backup 8mkdir -p /var/www/peertube/backup
16pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH" 9pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH"
17 10
18# Get and Display the Latest Version 11# Get and Display the Latest Version
19VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) 12VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4)
20echo "Latest Peertube version is $VERSION" 13echo "Latest Peertube version is $VERSION"
21wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" -O ~/versions/peertube-${VERSION}.zip 14wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" -O /var/www/peertube/versions/peertube-${VERSION}.zip
22cd ~/versions 15cd /var/www/peertube/versions
23unzip -o peertube-${VERSION}.zip 16unzip -o peertube-${VERSION}.zip
24rm -f peertube-${VERSION}.zip 17rm -f peertube-${VERSION}.zip
25 18
26# Upgrade Scripts 19# Upgrade Scripts
27rm -rf ~/peertube-latest 20rm -rf /var/www/peertube/peertube-latest
28ln -s ~/versions/peertube-${VERSION} ~/peertube-latest 21ln -s /var/www/peertube/versions/peertube-${VERSION} /var/www/peertube/peertube-latest
29cd ~/peertube-latest 22cd /var/www/peertube/peertube-latest
30yarn install --production --pure-lockfile 23yarn install --production --pure-lockfile
31cp ~/peertube-latest/config/default.yaml ~/config/default.yaml 24cp /var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml
32diff ~/peertube-latest/config/production.yaml.example ~/config/production.yaml
33 25
34exit 0 26exit 0