mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 04:41:32 +02:00
Merge pull request #868 from sharelatex/ho-mongo-health-checks
added a /health_check/mongo endpoint
This commit is contained in:
@@ -5,6 +5,7 @@ rclient = RedisWrapper.client("health_check")
|
||||
settings = require("settings-sharelatex")
|
||||
logger = require "logger-sharelatex"
|
||||
domain = require "domain"
|
||||
UserGetter = require("../User/UserGetter")
|
||||
|
||||
module.exports = HealthCheckController =
|
||||
check: (req, res, next = (error) ->) ->
|
||||
@@ -37,6 +38,20 @@ module.exports = HealthCheckController =
|
||||
res.sendStatus 500
|
||||
else
|
||||
res.sendStatus 200
|
||||
|
||||
checkMongo: (req, res, next)->
|
||||
logger.log "running mongo health check"
|
||||
UserGetter.getUserEmail settings.smokeTest.userId, (err, email)->
|
||||
if err?
|
||||
logger.err err:err, "mongo health check failed, error present"
|
||||
return res.sendStatus 500
|
||||
else if !email?
|
||||
logger.err err:err, "mongo health check failed, no emai present in find result"
|
||||
return res.sendStatus 500
|
||||
else
|
||||
logger.log email:email, "mongo health check passed"
|
||||
res.sendStatus 200
|
||||
|
||||
|
||||
Reporter = (res) ->
|
||||
(runner) ->
|
||||
|
||||
@@ -359,6 +359,9 @@ module.exports = class Router
|
||||
publicApiRouter.get '/health_check/redis', HealthCheckController.checkRedis
|
||||
privateApiRouter.get '/health_check/redis', HealthCheckController.checkRedis
|
||||
|
||||
publicApiRouter.get '/health_check/mongo', HealthCheckController.checkMongo
|
||||
privateApiRouter.get '/health_check/mongo', HealthCheckController.checkMongo
|
||||
|
||||
webRouter.get "/status/compiler/:Project_id", AuthorizationMiddlewear.ensureUserCanReadProject, (req, res) ->
|
||||
project_id = req.params.Project_id
|
||||
sendRes = _.once (statusCode, message)->
|
||||
|
||||
Reference in New Issue
Block a user