Add upgrade script
authorChocobozzz <florian.bigard@gmail.com>
Fri, 21 Oct 2016 12:23:20 +0000 (14:23 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 21 Oct 2016 12:23:20 +0000 (14:23 +0200)
package.json
scripts/help.sh
scripts/upgrade.sh [new file with mode: 0755]
server.js

index 8e2163bb2f7741c43a1063cc9ac3bc499f27c035..93c748cd32b969bcb0f9bf6e9a5e07d366ea6fca 100644 (file)
@@ -31,6 +31,7 @@
     "dev": "scripty",
     "start": "node server",
     "check": "scripty",
+    "upgrade": "scripty",
     "test": "scripty",
     "help": "scripty",
     "postinstall": "cd client && npm install"
index fdccabbf016bc22ad3efed49f734670d11f05107..23c460afa42f8387d831d598bf79646d8ec55630 100755 (executable)
@@ -16,5 +16,6 @@ printf "  play                 -> Run 3 fresh nodes so that you can test the com
 printf "  dev                  -> Watch, run the livereload and run the server so that you can develop the application\n"
 printf "  start                -> Run the server\n"
 printf "  check                -> Check the server (according to NODE_ENV)\n"
+printf "  upgrade -- [branch]  -> Upgrade the application according to the [branch] parameter\n"
 printf "  test                 -> Run the tests\n"
 printf "  help                 -> Print this help\n"
diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh
new file mode 100755 (executable)
index 0000000..1299ac5
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env sh
+
+
+git pull origin $(git rev-parse --abbrev-ref HEAD) || exit -1
+
+if [[ `pgrep peertube` > /dev/null ]]; then
+  echo 'PeerTube is running!'
+  exit 0
+fi
+
+npm install
+npm update
+cd client && npm update && cd ../
+npm run build
+
+echo "\n\nUpgrade finished! You can restart PeerTube that may run the migration scripts."
index d540c301b5213f87d4d80c0195e52acef86b1390..d866f628c1e439146f91d18aaccb39efa30e47b0 100644 (file)
--- a/server.js
+++ b/server.js
@@ -11,6 +11,8 @@ const path = require('path')
 const TrackerServer = require('bittorrent-tracker').Server
 const WebSocketServer = require('ws').Server
 
+process.title = 'peertube'
+
 // Create our main app
 const app = express()