Skip to content

Commit ac7c582

Browse files
committed
Add deploy health check
1 parent 0a3be6d commit ac7c582

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

app.json

+12
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,17 @@
44
"predeploy": "bundle exec rails db:migrate && bundle exec rails assets:precompile",
55
"postdeploy": "if [ -n \"$DISCORD_WEBHOOK_URL\" ]; then JSON_STRING=\"{\\\"content\\\":\\\"[$GIT_REV](https://github.com/jcraigk/phishin/commit/$GIT_REV) successfully deployed\\\"}\"; curl -X POST -H 'Content-Type: application/json' --data \"$JSON_STRING\" $DISCORD_WEBHOOK_URL; fi"
66
}
7+
},
8+
"healthchecks": {
9+
"web": [
10+
{
11+
"type": "startup",
12+
"name": "web check",
13+
"path": "/health",
14+
"timeout": 3,
15+
"attempts": 3,
16+
"wait": 5
17+
}
18+
]
719
}
820
}

config/routes.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
require "sidekiq/web"
22

33
Rails.application.routes.draw do
4+
get "/health", to: proc { [200, {}, ["OK"]] }
5+
46
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
57
ActiveSupport::SecurityUtils.secure_compare(
68
::Digest::SHA256.hexdigest(username), ::Digest::SHA256.hexdigest(ENV["SIDEKIQ_USERNAME"])

0 commit comments

Comments
 (0)