diff options
-rw-r--r-- | scripts/upgrade.sh | 24 | ||||
-rw-r--r-- | support/doc/production.md | 16 |
2 files changed, 15 insertions, 25 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 | ||
11 | set -e | 4 | set -e |
12 | 5 | ||
13 | # Backup database | 6 | # Backup database |
14 | SQL_BACKUP_PATH="/var/www/peertube/backup/sql-peertube_prod-$(date -Im).bak" | 7 | SQL_BACKUP_PATH="/var/www/peertube/backup/sql-peertube_prod-$(date -Im).bak" |
15 | mkdir -p ~/backup | 8 | mkdir -p /var/www/peertube/backup |
16 | pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH" | 9 | pg_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 |
19 | VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) | 12 | 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" | 13 | 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 | 14 | wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" -O /var/www/peertube/versions/peertube-${VERSION}.zip |
22 | cd ~/versions | 15 | cd /var/www/peertube/versions |
23 | unzip -o peertube-${VERSION}.zip | 16 | unzip -o peertube-${VERSION}.zip |
24 | rm -f peertube-${VERSION}.zip | 17 | rm -f peertube-${VERSION}.zip |
25 | 18 | ||
26 | # Upgrade Scripts | 19 | # Upgrade Scripts |
27 | rm -rf ~/peertube-latest | 20 | rm -rf /var/www/peertube/peertube-latest |
28 | ln -s ~/versions/peertube-${VERSION} ~/peertube-latest | 21 | ln -s /var/www/peertube/versions/peertube-${VERSION} /var/www/peertube/peertube-latest |
29 | cd ~/peertube-latest | 22 | cd /var/www/peertube/peertube-latest |
30 | yarn install --production --pure-lockfile | 23 | yarn install --production --pure-lockfile |
31 | cp ~/peertube-latest/config/default.yaml ~/config/default.yaml | 24 | cp /var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml |
32 | diff ~/peertube-latest/config/production.yaml.example ~/config/production.yaml | ||
33 | 25 | ||
34 | exit 0 | 26 | exit 0 |
diff --git a/support/doc/production.md b/support/doc/production.md index e3187d481..06a51dedf 100644 --- a/support/doc/production.md +++ b/support/doc/production.md | |||
@@ -289,19 +289,17 @@ $ cd /var/www/peertube/peertube-latest && NODE_CONFIG_DIR=/var/www/peertube/conf | |||
289 | ``` | 289 | ``` |
290 | 290 | ||
291 | ## Upgrade | 291 | ## Upgrade |
292 | #### Auto | ||
293 | 292 | ||
294 | Via the bash Script : | 293 | #### Auto (minor versions only) |
295 | 294 | ||
296 | ``` | 295 | ``` |
297 | $ su - peertube | 296 | $ cd /var/www/peertube/peertube-latest/scripts && sudo -u peertube ./upgrade.sh |
298 | $ cd scripts && ./upgrade.sh | 297 | $ diff /var/www/peertube/versions/peertube-${VERSION}/config/production.yaml.example /var/www/peertube/config/production.yaml |
299 | $ exit | 298 | $ sudo systemctl restart peertube && sudo journalctl -fu peertube |
300 | $ systemctl restart peertube | ||
301 | $ systemctl status peertube | ||
302 | ``` | 299 | ``` |
303 | 300 | ||
304 | #### Manuel | 301 | #### Manually |
302 | |||
305 | Make a SQL backup | 303 | Make a SQL backup |
306 | 304 | ||
307 | ``` | 305 | ``` |
@@ -336,7 +334,7 @@ Copy new configuration defaults values and update your configuration file: | |||
336 | 334 | ||
337 | ``` | 335 | ``` |
338 | $ sudo -u peertube cp /var/www/peertube/versions/peertube-${VERSION}/config/default.yaml /var/www/peertube/config/default.yaml | 336 | $ sudo -u peertube cp /var/www/peertube/versions/peertube-${VERSION}/config/default.yaml /var/www/peertube/config/default.yaml |
339 | $ diff /var/www/peertube/versions/peertube-${VERSION}/config//production.yaml.example /var/www/peertube/config/production.yaml | 337 | $ diff /var/www/peertube/versions/peertube-${VERSION}/config/production.yaml.example /var/www/peertube/config/production.yaml |
340 | ``` | 338 | ``` |
341 | 339 | ||
342 | Change the link to point to the latest version: | 340 | Change the link to point to the latest version: |