parent
e9062012dd
commit
eb2a5c6e19
5 changed files with 27 additions and 0 deletions
1
CHECKS
Normal file
1
CHECKS
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/healthcheck
|
||||||
1
Gemfile
1
Gemfile
|
|
@ -40,6 +40,7 @@ gem 'jbuilder', '~> 2.5'
|
||||||
# Use Capistrano for deployment
|
# Use Capistrano for deployment
|
||||||
# gem 'capistrano-rails', group: :development
|
# gem 'capistrano-rails', group: :development
|
||||||
|
|
||||||
|
gem 'rails-healthcheck'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
||||||
|
|
|
||||||
|
|
@ -285,6 +285,8 @@ GEM
|
||||||
activesupport (>= 4.2)
|
activesupport (>= 4.2)
|
||||||
choice (~> 0.2.0)
|
choice (~> 0.2.0)
|
||||||
ruby-graphviz (~> 1.2)
|
ruby-graphviz (~> 1.2)
|
||||||
|
rails-healthcheck (1.2.0)
|
||||||
|
rails
|
||||||
rails-html-sanitizer (1.3.0)
|
rails-html-sanitizer (1.3.0)
|
||||||
loofah (~> 2.3)
|
loofah (~> 2.3)
|
||||||
railties (6.1.2.1)
|
railties (6.1.2.1)
|
||||||
|
|
@ -447,6 +449,7 @@ DEPENDENCIES
|
||||||
puma (~> 3.0)
|
puma (~> 3.0)
|
||||||
rails (~> 6.0)
|
rails (~> 6.0)
|
||||||
rails-erd
|
rails-erd
|
||||||
|
rails-healthcheck
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
|
|
|
||||||
21
config/initializers/healthcheck.rb
Normal file
21
config/initializers/healthcheck.rb
Normal 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
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
Healthcheck.routes(self)
|
||||||
get 'admin/status'
|
get 'admin/status'
|
||||||
|
|
||||||
get 'admin/screenshots'
|
get 'admin/screenshots'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue