diff options
-rw-r--r-- | package.json | 2 | ||||
-rwxr-xr-x | scripts/upgrade-peertube.sh | 38 | ||||
-rw-r--r-- | support/doc/production.md | 24 |
3 files changed, 11 insertions, 53 deletions
diff --git a/package.json b/package.json index ba05dcc61..05c5f46b9 100644 --- a/package.json +++ b/package.json | |||
@@ -34,8 +34,6 @@ | |||
34 | "dev:server": "scripty", | 34 | "dev:server": "scripty", |
35 | "dev:client": "scripty", | 35 | "dev:client": "scripty", |
36 | "start": "node dist/server", | 36 | "start": "node dist/server", |
37 | "upgrade-peertube": "scripty", | ||
38 | "upgrade": "echo 'This command was renamed to upgrade-peertube.'", | ||
39 | "update-host": "ts-node ./scripts/update-host.ts", | 37 | "update-host": "ts-node ./scripts/update-host.ts", |
40 | "test": "scripty", | 38 | "test": "scripty", |
41 | "help": "scripty", | 39 | "help": "scripty", |
diff --git a/scripts/upgrade-peertube.sh b/scripts/upgrade-peertube.sh deleted file mode 100755 index bfef38264..000000000 --- a/scripts/upgrade-peertube.sh +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | verlte() { | ||
4 | [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] | ||
5 | } | ||
6 | |||
7 | nodeMinVersion="8.0.0" | ||
8 | npmMinVersion="3.0.0" | ||
9 | |||
10 | actualNodeVersion=$(node --version | tr -d "v") | ||
11 | actualNpmVersion=$(npm --version) | ||
12 | |||
13 | if verlte $actualNodeVersion $nodeMinVersion; then | ||
14 | echo 'You need node >= 8' | ||
15 | exit 0 | ||
16 | fi | ||
17 | |||
18 | if verlte $actualNpmVersion $npmMinVersion; then | ||
19 | echo 'You need npm >= 3' | ||
20 | exit 0 | ||
21 | fi | ||
22 | |||
23 | if ! which yarn > /dev/null; then | ||
24 | echo 'You need yarn' | ||
25 | exit 0 | ||
26 | fi | ||
27 | |||
28 | if pgrep peertube > /dev/null; then | ||
29 | echo 'PeerTube is running, please shut it off before upgrading' | ||
30 | exit 0 | ||
31 | fi | ||
32 | |||
33 | git pull origin $(git rev-parse --abbrev-ref HEAD) || exit -1 | ||
34 | |||
35 | yarn install --pure-lockfile | ||
36 | npm run build | ||
37 | |||
38 | echo -e "\n\nUpgrade finished! You can restart PeerTube that may run the migration scripts." | ||
diff --git a/support/doc/production.md b/support/doc/production.md index 77c9a086d..af137fe9a 100644 --- a/support/doc/production.md +++ b/support/doc/production.md | |||
@@ -26,17 +26,14 @@ $ sudo -u postgres createdb -O peertube peertube_prod | |||
26 | 26 | ||
27 | ### Prepare PeerTube directory | 27 | ### Prepare PeerTube directory |
28 | 28 | ||
29 | Check the latest release: https://github.com/Chocobozzz/PeerTube/releases or the release version you want. | ||
30 | We assume in the following commands the version is 0.42.42: | ||
31 | |||
32 | ``` | 29 | ``` |
33 | $ VERSION="0.42.42" && \ | 30 | $ VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && \ |
34 | cd /home/peertube && \ | 31 | cd /home/peertube && \ |
35 | sudo -u peertube mkdir config storage versions && \ | 32 | sudo -u peertube mkdir config storage versions && \ |
36 | cd versions && \ | 33 | cd versions && \ |
37 | sudo -u peertube wget "https://github.com/Chocobozzz/PeerTube/releases/download/v${VERSION}/peertube-v${VERSION}.zip" && \ | 34 | sudo -u peertube wget "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" && \ |
38 | sudo -u peertube unzip peertube-v${VERSION}.zip && sudo -u peertube rm peertube-v${VERSION}.zip && \ | 35 | sudo -u peertube unzip peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip && \ |
39 | cd ../ && sudo -u peertube ln -s versions/peertube-v${VERSION} ./peertube-latest && \ | 36 | cd ../ && sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest && \ |
40 | cd ./peertube-latest && sudo -u peertube yarn install --production --pure-lockfile | 37 | cd ./peertube-latest && sudo -u peertube yarn install --production --pure-lockfile |
41 | ``` | 38 | ``` |
42 | 39 | ||
@@ -227,11 +224,12 @@ $ NODE_ENV=production npm run reset-password -- -u root | |||
227 | 224 | ||
228 | ## Upgrade | 225 | ## Upgrade |
229 | 226 | ||
230 | The following commands will upgrade the source (according to your current | ||
231 | branch), upgrade node modules and rebuild client application: | ||
232 | |||
233 | ``` | 227 | ``` |
234 | # systemctl stop peertube | 228 | $ VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && \ |
235 | $ npm run upgrade-peertube | 229 | cd /home/peertube/versions && \ |
236 | # systemctl start peertube | 230 | sudo -u peertube wget "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" && \ |
231 | sudo -u peertube unzip peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip && \ | ||
232 | cd ../ && sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest && \ | ||
233 | cd ./peertube-latest && sudo -u peertube yarn install --production --pure-lockfile && \ | ||
234 | sudo systemctl restart peertube | ||
237 | ``` | 235 | ``` |