diff options
author | SVNET Libre <svnet@brique.svnet.fr> | 2018-02-12 09:43:16 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-12 09:43:16 +0100 |
commit | 64586951deda01365c14451f463a0a6c41e76213 (patch) | |
tree | d1361b21be3ef580953b48a202a9e78a7d5298bc | |
parent | 053ad3a346a817a3d11106a13079d675a182dca8 (diff) | |
download | PeerTube-64586951deda01365c14451f463a0a6c41e76213.tar.gz PeerTube-64586951deda01365c14451f463a0a6c41e76213.tar.zst PeerTube-64586951deda01365c14451f463a0a6c41e76213.zip |
Upgrade.sh (#281)
* Upgrade.sh
Bash script for upgrading Instance
* add bash strict mode
* move to "scripts" folder and other fix
* Rename scirpts/upgrade.sh to scripts/upgrade.sh
* Fix SQL BACKUP path
* Fix symbolic link update
-rw-r--r-- | scripts/upgrade.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh new file mode 100644 index 000000000..d6ee9d166 --- /dev/null +++ b/scripts/upgrade.sh | |||
@@ -0,0 +1,34 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | ### Note !! ### | ||
4 | # On shell prompt do : | ||
5 | # | ||
6 | # $ su - peertube | ||
7 | # $ ./upgrade.sh | ||
8 | ############ | ||
9 | |||
10 | # Stcict mode | ||
11 | set -e | ||
12 | |||
13 | # Backup database | ||
14 | SQL_BACKUP_PATH="/var/www/peertube/backup/sql-peertube_prod-$(date -Im).bak" | ||
15 | mkdir -p ~/backup | ||
16 | pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH" | ||
17 | |||
18 | # Get and Display the Latest Version | ||
19 | VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) | ||
20 | echo "Latest Peertube version is $VERSION" | ||
21 | wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" -O ~/versions/peertube-${VERSION}.zip | ||
22 | cd ~/versions | ||
23 | unzip -o peertube-${VERSION}.zip | ||
24 | rm -f peertube-${VERSION}.zip | ||
25 | |||
26 | # Upgrade Scripts | ||
27 | rm -rf ~/peertube-latest | ||
28 | ln -s ~/versions/peertube-${VERSION} ~/peertube-latest | ||
29 | cd ~/peertube-latest | ||
30 | yarn install --production --pure-lockfile | ||
31 | cp ~/peertube-latest/config/default.yaml ~/config/default.yaml | ||
32 | diff ~/peertube-latest/config/production.yaml.example ~/config/production.yaml | ||
33 | |||
34 | exit 0 | ||