auto deploy github based project and others
language: also available in: -
Add launch line to package.json
{
"scripts": {
"auto-deploy": "auto-deploy-run server/server.js"
}
}
Use the module in your server
var autoDeploy = require('auto-deploy');
app.use('/tools', autoDeploy.middleware({pid:12345}));
To log into a text file you can pass the filename as an argument to auto-deploy-run, for example:
{
"scripts": {
"auto-deploy": "auto-deploy-run -l server.log server/server.js"
}
}
Then start the server with
npm run-script auto-deploy
Then run commands in the URL of the browser, for example:
http://theserver.zzz/tools/auto-deploy?restart
http://theserver.zzz/tools/auto-deploy?stop&pid=3344
To have the possibility to specify in the address bar of the browser the need to install a new version:
- auto deploy by URL (GET request)
- the server executes a
stop
(as clean as possible) - the server updates
git pull
orsvn update
, etc - the server installs the new version
npm prune
,npm install
- the server executes
npm start --production
or similar command
- the servers checks the local repository to ensure it's cleaness (to prevent conflicts with the
git pull
) - the possibility to register a function that checks the integrity and status of the server.
- in the case where it's safe to shutdown the server, it returns an explanatory message and a random code to force. ie:
force=4312
- the
force
option executes the indicated action anyway.
- in the case where it's safe to shutdown the server, it returns an explanatory message and a random code to force. ie:
................