Healthcheck added

https://github.com/linqueta/rails-healthcheck
This commit is contained in:
Christoph Haas 2021-02-14 16:41:19 +01:00
parent e9062012dd
commit eb2a5c6e19
5 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,21 @@
# frozen_string_literal: true
Healthcheck.configure do |config|
config.success = 200
config.error = 503
config.verbose = false
config.route = '/healthcheck'
config.method = :get
# -- Custom Response --
# config.custom = lambda { |controller, checker|
# controller.render json: my_custom_response unless checker.errored?
# ...
# }
# -- Checks --
# config.add_check :database, -> { ActiveRecord::Base.connection.execute('select 1') }
# config.add_check :migrations, -> { ActiveRecord::Migration.check_pending! }
# config.add_check :cache, -> { Rails.cache.read('some_key') }
# config.add_check :environments, -> { Dotenv.require_keys('ENV_NAME', 'ANOTHER_ENV') }
end

View file

@ -1,5 +1,6 @@
Rails.application.routes.draw do
Healthcheck.routes(self)
get 'admin/status'
get 'admin/screenshots'