mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add health check endpoint and http route logger
This commit is contained in:
parent
49c7bde799
commit
78629610d5
1 changed files with 10 additions and 4 deletions
|
@ -25,10 +25,9 @@ HealthCheckManager = require("./app/js/HealthCheckManager")
|
|||
|
||||
# work around frame handler bug in socket.io v0.9.16
|
||||
require("./socket.io.patch.js")
|
||||
|
||||
# Set up socket.io server
|
||||
app = express()
|
||||
Metrics.injectMetricsRoute(app)
|
||||
|
||||
server = require('http').createServer(app)
|
||||
io = require('socket.io').listen(server)
|
||||
|
||||
|
@ -38,6 +37,9 @@ cookieParser = CookieParser(Settings.security.sessionSecret)
|
|||
|
||||
sessionSockets = new SessionSockets(io, sessionStore, cookieParser, Settings.cookieName)
|
||||
|
||||
Metrics.injectMetricsRoute(app)
|
||||
app.use(Metrics.http.monitor(logger))
|
||||
|
||||
io.configure ->
|
||||
io.enable('browser client minification')
|
||||
io.enable('browser client etag')
|
||||
|
@ -65,7 +67,7 @@ app.get "/debug/events", (req, res, next) ->
|
|||
|
||||
rclient = require("redis-sharelatex").createClient(Settings.redis.realtime)
|
||||
|
||||
app.get "/health_check/redis", (req, res, next) ->
|
||||
healthCheck = (req, res, next)->
|
||||
rclient.healthCheck (error) ->
|
||||
if error?
|
||||
logger.err {err: error}, "failed redis health check"
|
||||
|
@ -77,7 +79,11 @@ app.get "/health_check/redis", (req, res, next) ->
|
|||
else
|
||||
res.sendStatus 200
|
||||
|
||||
Metrics.injectMetricsRoute(app)
|
||||
app.get "/health_check", healthCheck
|
||||
|
||||
app.get "/health_check/redis", healthCheck
|
||||
|
||||
|
||||
|
||||
Router = require "./app/js/Router"
|
||||
Router.configure(app, io, sessionSockets)
|
||||
|
|
Loading…
Reference in a new issue