mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-08 08:44:27 +00:00
Add healthcheck endpoint for web (#11770)
This commit is contained in:
parent
e445a8af64
commit
d7268befa8
1
Gemfile
1
Gemfile
|
@ -50,6 +50,7 @@ gem 'fastimage'
|
||||||
gem 'goldfinger', '~> 2.1'
|
gem 'goldfinger', '~> 2.1'
|
||||||
gem 'hiredis', '~> 0.6'
|
gem 'hiredis', '~> 0.6'
|
||||||
gem 'redis-namespace', '~> 1.5'
|
gem 'redis-namespace', '~> 1.5'
|
||||||
|
gem 'health_check', '~> 3.0'
|
||||||
gem 'htmlentities', '~> 4.3'
|
gem 'htmlentities', '~> 4.3'
|
||||||
gem 'http', '~> 3.3'
|
gem 'http', '~> 3.3'
|
||||||
gem 'http_accept_language', '~> 2.1'
|
gem 'http_accept_language', '~> 2.1'
|
||||||
|
|
|
@ -278,6 +278,8 @@ GEM
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
hashdiff (1.0.0)
|
hashdiff (1.0.0)
|
||||||
hashie (3.6.0)
|
hashie (3.6.0)
|
||||||
|
health_check (3.0.0)
|
||||||
|
railties (>= 5.0)
|
||||||
heapy (0.1.4)
|
heapy (0.1.4)
|
||||||
highline (2.0.1)
|
highline (2.0.1)
|
||||||
hiredis (0.6.3)
|
hiredis (0.6.3)
|
||||||
|
@ -706,6 +708,7 @@ DEPENDENCIES
|
||||||
fuubar (~> 2.4)
|
fuubar (~> 2.4)
|
||||||
goldfinger (~> 2.1)
|
goldfinger (~> 2.1)
|
||||||
hamlit-rails (~> 0.2)
|
hamlit-rails (~> 0.2)
|
||||||
|
health_check (~> 3.0)
|
||||||
hiredis (~> 0.6)
|
hiredis (~> 0.6)
|
||||||
htmlentities (~> 4.3)
|
htmlentities (~> 4.3)
|
||||||
http (~> 3.3)
|
http (~> 3.3)
|
||||||
|
|
|
@ -41,7 +41,7 @@ class ApplicationController < ActionController::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def https_enabled?
|
def https_enabled?
|
||||||
Rails.env.production?
|
Rails.env.production? && !request.path.start_with?('/health')
|
||||||
end
|
end
|
||||||
|
|
||||||
def authorized_fetch_mode?
|
def authorized_fetch_mode?
|
||||||
|
|
6
config/initializers/health_check.rb
Normal file
6
config/initializers/health_check.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
HealthCheck.setup do |config|
|
||||||
|
config.uri = 'health'
|
||||||
|
|
||||||
|
config.standard_checks = %w(database migrations cache)
|
||||||
|
config.full_checks = %w(database migrations cache)
|
||||||
|
end
|
|
@ -10,6 +10,8 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
mount LetterOpenerWeb::Engine, at: 'letter_opener' if Rails.env.development?
|
mount LetterOpenerWeb::Engine, at: 'letter_opener' if Rails.env.development?
|
||||||
|
|
||||||
|
health_check_routes
|
||||||
|
|
||||||
authenticate :user, lambda { |u| u.admin? } do
|
authenticate :user, lambda { |u| u.admin? } do
|
||||||
mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq
|
mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq
|
||||||
mount PgHero::Engine, at: 'pghero', as: :pghero
|
mount PgHero::Engine, at: 'pghero', as: :pghero
|
||||||
|
|
|
@ -43,7 +43,7 @@ services:
|
||||||
- external_network
|
- external_network
|
||||||
- internal_network
|
- internal_network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "wget -q --spider --header 'x-forwarded-proto: https' --proxy=off localhost:3000/api/v1/instance || exit 1"]
|
test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost:3000/health || exit 1"]
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:3000:3000"
|
- "127.0.0.1:3000:3000"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -63,7 +63,7 @@ services:
|
||||||
- external_network
|
- external_network
|
||||||
- internal_network
|
- internal_network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "wget -q --spider --header 'x-forwarded-proto: https' --proxy=off localhost:4000/api/v1/streaming/health || exit 1"]
|
test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1"]
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:4000:4000"
|
- "127.0.0.1:4000:4000"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
Loading…
Reference in a new issue