added redis health check in

This commit is contained in:
Henry Oswald 2014-11-19 23:18:20 +00:00
parent 57abc2cb24
commit 6c746d9aec
3 changed files with 14 additions and 1 deletions

View file

@ -1,5 +1,8 @@
Mocha = require "mocha"
Base = require("mocha/lib/reporters/base")
redis = require("redis-sharelatex")
settings = require("settings-sharelatex")
redisCheck = redis.activeHealthCheckRedis(settings.redis.web)
module.exports = HealthCheckController =
check: (req, res, next = (error) ->) ->
@ -8,6 +11,15 @@ module.exports = HealthCheckController =
mocha.run () ->
path = require.resolve(__dirname + "/../../../../test/smoke/js/SmokeTests.js")
delete require.cache[path]
checkRedis: (req, res, next)->
if redisCheck.isAlive()
res.send 200
else
res.send 500
Reporter = (res) ->
(runner) ->

View file

@ -175,6 +175,7 @@ module.exports = class Router
req.session.destroy()
app.get '/health_check', HealthCheckController.check
app.get '/health_check/redis', HealthCheckController.checkRedis
app.get "/status/compiler/:Project_id", SecurityManager.requestCanAccessProject, (req, res) ->
sendRes = _.once (statusCode, message)->

View file

@ -31,7 +31,7 @@
"optimist": "0.6.1",
"redback": "0.4.0",
"redis": "0.10.1",
"redis-sharelatex": "0.0.6",
"redis-sharelatex": "0.0.7",
"request": "2.34.0",
"rimraf": "2.2.6",
"sanitizer": "0.1.1",