added health check endpoint

This commit is contained in:
Henry Oswald 2015-03-01 12:45:14 +00:00
parent aa7ab83ddf
commit eb193c24ae
3 changed files with 14 additions and 6 deletions

View file

@ -7,6 +7,8 @@ Path = require("path")
metrics = require("metrics-sharelatex")
metrics.initialize("tpds")
metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger)
HealthCheckController = require("./app/js/HealthCheckController")
server = restify.createServer
name: "spelling-sharelatex",
@ -20,6 +22,9 @@ server.post "/user/:user_id/learn", SpellingAPIController.learn
server.get "/status", (req, res)->
res.send(status:'spelling api is up')
server.get "/health_check", HealthCheckController.healthCheck
host = Settings.internal?.spelling?.host || "localhost"
port = Settings.internal?.spelling?.port || 3005
server.listen port, host, (error) ->

View file

@ -12,3 +12,5 @@ module.exports = Settings =
mongo:
url : 'mongodb://127.0.0.1/sharelatex'
healthCheckUserId: "53c64d2fd68c8d000010bb5f"

View file

@ -8,16 +8,17 @@
},
"version": "0.1.0",
"dependencies": {
"express": "3.1.0",
"async": "0.1.22",
"restify": "2.5.1",
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0",
"express": "3.1.0",
"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",
"node-statsd": "0.0.3",
"underscore": "1.4.4",
"mongojs": "0.9.11",
"redis": "~0.8.4"
"node-statsd": "0.0.3",
"redis": "~0.8.4",
"request": "^2.53.0",
"restify": "2.5.1",
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0",
"underscore": "1.4.4"
},
"devDependencies": {
"bunyan": "^1.0.0",