diff --git a/deploy b/deploy new file mode 100644 index 000000000..3a66f6dc8 --- /dev/null +++ b/deploy @@ -0,0 +1,6 @@ +ssh 192.168.1.2 < cd /var/lib/jenkins/workspace/test + git pull + npm install --production + pm2 restart all + exit +EOF diff --git a/index.js b/index.js index 54e5fef1f..458ca8b3d 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ const port = process.env.PORT || 3000; const server = http.createServer((req, res) => { res.statusCode = 200; - const msg = 'Hello Node!\n' + const msg = 'Hellooooooo00000oooo to Node! \n test2 \n node app' res.end(msg); }); diff --git a/runApp.sh b/runApp.sh new file mode 100644 index 000000000..09656308f --- /dev/null +++ b/runApp.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + + + +echo 'The following "npm" command runs your Node.js application' + +set -x +npm start & +sleep 1 +echo $! > .pidfile +set +x + +echo 'Now you can' +echo 'Visit http://ServerIp:9981 to see your Node.js application' diff --git a/script/runApp.sh b/script/runApp.sh new file mode 100644 index 000000000..09656308f --- /dev/null +++ b/script/runApp.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + + + +echo 'The following "npm" command runs your Node.js application' + +set -x +npm start & +sleep 1 +echo $! > .pidfile +set +x + +echo 'Now you can' +echo 'Visit http://ServerIp:9981 to see your Node.js application' diff --git a/script/stopApp.sh b/script/stopApp.sh new file mode 100644 index 000000000..dcf6181c4 --- /dev/null +++ b/script/stopApp.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +echo 'The following command terminates the "npm start" process using its PID' +echo '(written to ".pidfile"), all of which were conducted when "deliver.sh"' +echo 'was executed.' +set -x +kill -9 $(cat .pidfile)