mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
added redis health check in
This commit is contained in:
parent
57abc2cb24
commit
6c746d9aec
3 changed files with 14 additions and 1 deletions
|
@ -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) ->
|
||||
|
|
|
@ -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)->
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue