Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add health check #80

Merged
merged 2 commits into from
May 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/bot.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ LookQueryRunner = require('./repliers/look_query_runner')
versionChecker = require('./version_checker')
ScheduleReceiver = require('./schedule_receiver')
DataActionReceiver = require('./data_action_receiver')
HealthCheckReceiver = require('./health_check_receiver')

if process.env.DEV == "true"
# Allow communicating with Lookers running on localhost with self-signed certificates
Expand Down Expand Up @@ -206,6 +207,7 @@ controller.setupWebserver process.env.PORT || 3333, (err, expressWebserver) ->
controller.createWebhookEndpoints(expressWebserver)
ScheduleReceiver.listen(expressWebserver, defaultBot, lookers)
DataActionReceiver.listen(expressWebserver, defaultBot, lookers)
HealthCheckReceiver.listen(expressWebserver, defaultBot, lookers)

controller.on 'rtm_reconnect_failed', ->
throw new Error("Failed to reconnect to the Slack RTM API.")
Expand Down
10 changes: 10 additions & 0 deletions lib/health_check_receiver.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports =

listen: (server, bot, lookers) ->
server.get("/health_check", (req, res) =>

reply = (json) ->
res.setHeader 'Content-Type', 'application/json'
res.send JSON.stringify(json)
reply {success: true, reason: "Healthy"}
)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "looker-slackbot",
"version": "0.0.9",
"version": "0.0.10",
"description": "Slackbot for Looker integration",
"main": "index.js",
"scripts": {
Expand Down