From eb193c24aeb54de8b6d3c10cf7cc7bfd96c9f014 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Sun, 1 Mar 2015 12:45:14 +0000 Subject: [PATCH] added health check endpoint --- services/spelling/app.coffee | 5 +++++ services/spelling/config/settings.defaults.coffee | 2 ++ services/spelling/package.json | 13 +++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/services/spelling/app.coffee b/services/spelling/app.coffee index 85494a40da..79e7a9ee0b 100644 --- a/services/spelling/app.coffee +++ b/services/spelling/app.coffee @@ -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) -> diff --git a/services/spelling/config/settings.defaults.coffee b/services/spelling/config/settings.defaults.coffee index f02e51ecc7..474be9da88 100644 --- a/services/spelling/config/settings.defaults.coffee +++ b/services/spelling/config/settings.defaults.coffee @@ -12,3 +12,5 @@ module.exports = Settings = mongo: url : 'mongodb://127.0.0.1/sharelatex' + + healthCheckUserId: "53c64d2fd68c8d000010bb5f" \ No newline at end of file diff --git a/services/spelling/package.json b/services/spelling/package.json index f0007a52c7..6d582021ce 100644 --- a/services/spelling/package.json +++ b/services/spelling/package.json @@ -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",