From 2a05045600e57de99c8b021c0a9e130b82b2bef2 Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 20 Nov 2014 16:56:09 +0000 Subject: [PATCH] Add in redis health check --- services/real-time/app.coffee | 10 ++++++++++ services/real-time/app/coffee/Router.coffee | 3 --- services/real-time/package.json | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/services/real-time/app.coffee b/services/real-time/app.coffee index b6d8c2e23c..58368683ed 100644 --- a/services/real-time/app.coffee +++ b/services/real-time/app.coffee @@ -38,6 +38,16 @@ io.configure -> #io.enable('browser client gzip') io.set('transports', ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling']) io.set('log level', 1) + +app.get "/status", (req, res, next) -> + res.send "real-time-sharelatex is alive" + +redisCheck = redis.activeHealthCheckRedis(Settings.redis.web) +app.get "/health_check/redis", (req, res, next) -> + if redisCheck.isAlive() + res.send 200 + else + res.send 500 Router = require "./app/js/Router" Router.configure(app, io, sessionSockets) diff --git a/services/real-time/app/coffee/Router.coffee b/services/real-time/app/coffee/Router.coffee index 262239b2a9..14d2f698a8 100644 --- a/services/real-time/app/coffee/Router.coffee +++ b/services/real-time/app/coffee/Router.coffee @@ -20,9 +20,6 @@ module.exports = Router = app.get "/clients", HttpController.getConnectedClients app.get "/clients/:client_id", HttpController.getConnectedClient - app.get "/status", (req, res, next) -> - res.send "real-time-sharelatex is alive" - session.on 'connection', (error, client, session) -> if error? logger.err err: error, "error when client connected" diff --git a/services/real-time/package.json b/services/real-time/package.json index 851c785a64..6a09d38bba 100644 --- a/services/real-time/package.json +++ b/services/real-time/package.json @@ -15,7 +15,7 @@ "express-session": "^1.9.1", "logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.0.0", "metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v1.0.0", - "redis-sharelatex": "~0.0.4", + "redis-sharelatex": "0.0.9", "session.socket.io": "^0.1.6", "settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0", "socket.io": "0.9.16",