-
Notifications
You must be signed in to change notification settings - Fork 1
/
health_check.rb
72 lines (53 loc) · 2.88 KB
/
health_check.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
HealthCheck.setup do |config|
# uri prefix (no leading slash)
config.uri = 'health_check'
# Text output upon success
config.success = 'success'
# Timeout in seconds used when checking smtp server
config.smtp_timeout = 30.0
# http status code used when plain text error message is output
# Set to 200 if you want your want to distinguish between partial (text does not include success) and
# total failure of rails application (http status of 500 etc)
config.http_status_for_error_text = 500
# http status code used when an error object is output (json or xml)
# Set to 200 if you want your want to distinguish between partial (healthy property == false) and
# total failure of rails application (http status of 500 etc)
config.http_status_for_error_object = 500
# bucket names to test connectivity - required only if s3 check used, access permissions can be mixed
# config.buckets = {'bucket_name' => [:R, :W, :D]}
# You can customize which checks happen on a standard health check, eg to set an explicit list use:
config.standard_checks = ['database', 'migrations', 'redis', 'sidekiq-redis']
# Or to exclude one check:
# config.standard_checks -= []
# You can set what tests are run with the 'full' or 'all' parameter
config.full_checks = ['database', 'migrations', 'redis', 'sidekiq-redis']
# Add one or more custom checks that return a blank string if ok, or an error message if there is an error
# config.add_custom_check do
# CustomHealthCheck.perform_check # any code that returns blank on success and non blank string upon failure
# end
# Add another custom check with a name, so you can call just specific custom checks. This can also be run using
# the standard 'custom' check.
# You can define multiple tests under the same name - they will be run one after the other.
# config.add_custom_check('sometest') do
# CustomHealthCheck.perform_another_check # any code that returns blank on success and non blank string upon failure
# end
# max-age of response in seconds
# cache-control is public when max_age > 1 and basic_auth_username is not set
# You can force private without authentication for longer max_age by
# setting basic_auth_username but not basic_auth_password
config.max_age = 1
# Protect health endpoints with basic auth
# These default to nil and the endpoint is not protected
# config.basic_auth_username = 'my_username'
# config.basic_auth_password = 'my_password'
# Whitelist requesting IPs
# Defaults to blank and allows any IP
# config.origin_ip_whitelist = %w(123.123.123.123)
# http status code used when the ip is not allowed for the request
config.http_status_for_ip_whitelist_error = 403
# When redis url is non-standard
# config.redis_url = 'redis_url'
# Disable the error message to prevent /health_check from leaking
# sensitive information
# config.include_error_in_response_body = false
end