Add a maintenance-mode during production deploy

This commit is contained in:
Gaël Métais
2015-12-22 22:06:19 +01:00
parent 100eb01f27
commit 06bdbd929c
2 changed files with 17 additions and 2 deletions
+13
View File
@@ -0,0 +1,13 @@
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var settings = require('./settings.json');
app.all('*', function(req, res) {
res.status(500).send('YellowLabTools is in maintenance. It should come back soon with a new version!');
});
server.listen(settings.serverPort, function() {
console.log('Maintenance mode started on port %d', server.address().port);
});
+4 -2
View File
@@ -2,8 +2,9 @@
cd /space/YellowLabTools
# Stop the server
# Stop the server and start the maintenance mode
forever stopall
forever start server_config/maintenance.js
# Keep the settings.json file
git stash
@@ -18,5 +19,6 @@ npm install || exit 1
rm -rf front/build
grunt build
# Restart the server
# Stop the maintenance mode and restart the server
forever stopall
NODE_ENV=production forever start -c "node --stack-size=262000" bin/server.js