easymon 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +28 -12
- data/Rakefile +1 -1
- data/app/controllers/easymon/checks_controller.rb +6 -6
- data/config/routes.rb +2 -2
- data/lib/easymon/checklist.rb +7 -7
- data/lib/easymon/checks/active_record_check.rb +6 -5
- data/lib/easymon/checks/active_record_mysql_writeable_check.rb +1 -1
- data/lib/easymon/checks/http_check.rb +6 -6
- data/lib/easymon/checks/memcached_check.rb +6 -6
- data/lib/easymon/checks/multi_active_record_check.rb +52 -0
- data/lib/easymon/checks/redis_check.rb +3 -3
- data/lib/easymon/checks/redis_writeable_check.rb +1 -1
- data/lib/easymon/checks/semaphore_check.rb +6 -6
- data/lib/easymon/checks/split_active_record_check.rb +6 -16
- data/lib/easymon/checks/traffic_enabled_check.rb +2 -2
- data/lib/easymon/engine.rb +1 -1
- data/lib/easymon/repository.rb +5 -5
- data/lib/easymon/result.rb +2 -2
- data/lib/easymon/testing.rb +2 -2
- data/lib/easymon/version.rb +1 -1
- data/lib/easymon.rb +10 -9
- data/test/controllers/easymon/checks_controller_test.rb +10 -11
- data/test/dummy/Rakefile +2 -3
- data/test/dummy/app/assets/stylesheets/application.css +6 -4
- data/test/dummy/app/controllers/application_controller.rb +2 -1
- data/test/dummy/app/jobs/application_job.rb +7 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +22 -9
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/app/views/pwa/manifest.json.erb +22 -0
- data/test/dummy/app/views/pwa/service-worker.js +26 -0
- data/test/dummy/bin/dev +2 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +34 -0
- data/test/dummy/config/application.rb +22 -50
- data/test/dummy/config/boot.rb +4 -9
- data/test/dummy/config/database.yml +25 -6
- data/test/dummy/config/environment.rb +4 -4
- data/test/dummy/config/environments/development.rb +55 -25
- data/test/dummy/config/environments/production.rb +64 -42
- data/test/dummy/config/environments/test.rb +35 -25
- data/test/dummy/config/initializers/assets.rb +7 -0
- data/test/dummy/config/initializers/content_security_policy.rb +25 -0
- data/test/dummy/config/initializers/easymon.rb +2 -2
- data/test/dummy/config/initializers/filter_parameter_logging.rb +8 -0
- data/test/dummy/config/initializers/inflections.rb +10 -9
- data/test/dummy/config/locales/en.yml +28 -2
- data/test/dummy/config/puma.rb +38 -0
- data/test/dummy/config/redis.yml +5 -6
- data/test/dummy/config/routes.rb +13 -0
- data/test/dummy/config/storage.yml +34 -0
- data/test/dummy/config.ru +4 -2
- data/test/dummy/log/test.log +0 -8916
- data/test/dummy/public/400.html +114 -0
- data/test/dummy/public/404.html +113 -25
- data/test/dummy/public/406-unsupported-browser.html +114 -0
- data/test/dummy/public/422.html +113 -25
- data/test/dummy/public/500.html +113 -24
- data/test/dummy/public/icon.png +0 -0
- data/test/dummy/public/icon.svg +3 -0
- data/test/dummy/tmp/local_secret.txt +1 -0
- data/test/helpers/easymon/checks_helper_test.rb +1 -1
- data/test/integration/navigation_test.rb +1 -2
- data/test/test_helper.rb +3 -3
- data/test/unit/checklist_test.rb +5 -5
- data/test/unit/checks/active_record_check_on_postgresql_test.rb +1 -2
- data/test/unit/checks/active_record_check_test.rb +1 -2
- data/test/unit/checks/active_record_mysql_writeable_check_test.rb +2 -3
- data/test/unit/checks/http_check_test.rb +3 -3
- data/test/unit/checks/memcached_check_test.rb +6 -8
- data/test/unit/checks/multi_active_record_check_test.rb +73 -0
- data/test/unit/checks/redis_check_test.rb +8 -9
- data/test/unit/checks/redis_writeable_check_test.rb +2 -3
- data/test/unit/checks/semaphore_check_test.rb +2 -3
- data/test/unit/checks/split_active_record_check_test.rb +9 -24
- data/test/unit/checks/traffic_enabled_check_test.rb +2 -3
- data/test/unit/repository_test.rb +2 -3
- metadata +98 -80
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/app/assets/config/manifest.js +0 -0
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/javascripts/easymon.js +0 -2
- data/test/dummy/app/assets/stylesheets/easymon.css +0 -4
- data/test/dummy/app/controllers/easymon_controller.rb +0 -7
- data/test/dummy/app/helpers/easymon_helper.rb +0 -2
- data/test/dummy/app/views/easymon/index.html.erb +0 -2
- data/test/dummy/app/views/easymon/show.html.erb +0 -2
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/log/development.log +0 -24
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/tmp/cache/4D4/7A0/health_check +0 -1
|
@@ -1,43 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# The test environment is used exclusively to run your application's
|
|
2
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
3
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
4
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
#
|
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
|
8
|
-
config.cache_classes = true
|
|
6
|
+
Rails.application.configure do
|
|
7
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
9
8
|
|
|
10
|
-
#
|
|
11
|
-
config.
|
|
12
|
-
config.static_cache_control = "public, max-age=3600"
|
|
9
|
+
# While tests run files are not watched, reloading is not necessary.
|
|
10
|
+
config.enable_reloading = false
|
|
13
11
|
|
|
14
|
-
#
|
|
15
|
-
#
|
|
12
|
+
# Eager loading loads your entire application. When running a single test locally,
|
|
13
|
+
# this is usually not necessary, and can slow down your test suite. However, it's
|
|
14
|
+
# recommended that you enable it in continuous integration systems to ensure eager
|
|
15
|
+
# loading is working properly before deploying your code.
|
|
16
|
+
config.eager_load = ENV["CI"].present?
|
|
16
17
|
|
|
17
|
-
#
|
|
18
|
-
config.
|
|
19
|
-
config.action_controller.perform_caching = false
|
|
18
|
+
# Configure public file server for tests with cache-control for performance.
|
|
19
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
|
|
20
20
|
|
|
21
|
-
#
|
|
22
|
-
config.
|
|
21
|
+
# Show full error reports.
|
|
22
|
+
config.consider_all_requests_local = true
|
|
23
|
+
config.cache_store = :mem_cache_store, YAML.load_file(Rails.root.join("config/memcached.yml"), aliases: true)[Rails.env], { timeout: 1, namespace: "easymon-testing" }
|
|
23
24
|
|
|
24
|
-
#
|
|
25
|
-
config.
|
|
25
|
+
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
|
26
|
+
config.action_dispatch.show_exceptions = :rescuable
|
|
27
|
+
|
|
28
|
+
# Disable request forgery protection in test environment.
|
|
29
|
+
config.action_controller.allow_forgery_protection = false
|
|
30
|
+
|
|
31
|
+
# Store uploaded files on the local file system in a temporary directory.
|
|
32
|
+
config.active_storage.service = :test
|
|
26
33
|
|
|
27
34
|
# Tell Action Mailer not to deliver emails to the real world.
|
|
28
35
|
# The :test delivery method accumulates sent emails in the
|
|
29
36
|
# ActionMailer::Base.deliveries array.
|
|
30
37
|
config.action_mailer.delivery_method = :test
|
|
31
38
|
|
|
32
|
-
#
|
|
33
|
-
|
|
39
|
+
# Set host to be used by links generated in mailer templates.
|
|
40
|
+
config.action_mailer.default_url_options = { host: "example.com" }
|
|
34
41
|
|
|
35
|
-
# Print deprecation notices to the stderr
|
|
42
|
+
# Print deprecation notices to the stderr.
|
|
36
43
|
config.active_support.deprecation = :stderr
|
|
37
44
|
|
|
38
|
-
|
|
45
|
+
# Raises error for missing translations.
|
|
46
|
+
# config.i18n.raise_on_missing_translations = true
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
# Annotate rendered view with file names.
|
|
49
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
|
52
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
|
43
53
|
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
|
4
|
+
# Rails.application.config.assets.version = "1.0"
|
|
5
|
+
|
|
6
|
+
# Add additional assets to the asset load path.
|
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Define an application-wide content security policy.
|
|
4
|
+
# See the Securing Rails Applications Guide for more information:
|
|
5
|
+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
|
6
|
+
|
|
7
|
+
# Rails.application.configure do
|
|
8
|
+
# config.content_security_policy do |policy|
|
|
9
|
+
# policy.default_src :self, :https
|
|
10
|
+
# policy.font_src :self, :https, :data
|
|
11
|
+
# policy.img_src :self, :https, :data
|
|
12
|
+
# policy.object_src :none
|
|
13
|
+
# policy.script_src :self, :https
|
|
14
|
+
# policy.style_src :self, :https
|
|
15
|
+
# # Specify URI for violation reports
|
|
16
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
|
20
|
+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
|
21
|
+
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
|
22
|
+
#
|
|
23
|
+
# # Report violations without enforcing the policy.
|
|
24
|
+
# # config.content_security_policy_report_only = true
|
|
25
|
+
# end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if Rails.env.development?
|
|
2
|
-
Easymon::Repository.add("redis", Easymon::RedisCheck.new(YAML.load_file(Rails.root.join("config/redis.yml"))[Rails.env].symbolize_keys))
|
|
2
|
+
Easymon::Repository.add("redis", Easymon::RedisCheck.new(YAML.load_file(Rails.root.join("config/redis.yml"), aliases: true)[Rails.env].symbolize_keys))
|
|
3
3
|
Easymon::Repository.add("database", Easymon::ActiveRecordCheck.new(ActiveRecord::Base), :critical)
|
|
4
4
|
Easymon::Repository.add("memcached", Easymon::MemcachedCheck.new(Rails.cache))
|
|
5
5
|
Easymon::Repository.add("elasticsearch-http", Easymon::HttpCheck.new("http://localhost:9200"))
|
|
6
|
-
end
|
|
6
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
|
4
|
+
# Use this to limit dissemination of sensitive information.
|
|
5
|
+
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
|
6
|
+
Rails.application.config.filter_parameters += [
|
|
7
|
+
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
|
|
8
|
+
]
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
|
2
2
|
|
|
3
|
-
# Add new inflection rules using the following format
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# inflect.
|
|
8
|
-
# inflect.
|
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
|
4
|
+
# are locale specific, and you may define rules for as many different
|
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
7
|
+
# inflect.plural /^(ox)$/i, "\\1en"
|
|
8
|
+
# inflect.singular /^(ox)en/i, "\\1"
|
|
9
|
+
# inflect.irregular "person", "people"
|
|
9
10
|
# inflect.uncountable %w( fish sheep )
|
|
10
11
|
# end
|
|
11
|
-
|
|
12
|
+
|
|
12
13
|
# These inflection rules are supported but not enabled by default:
|
|
13
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
|
14
|
-
# inflect.acronym
|
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
15
|
+
# inflect.acronym "RESTful"
|
|
15
16
|
# end
|
|
@@ -1,5 +1,31 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
1
|
+
# Files in the config/locales directory are used for internationalization and
|
|
2
|
+
# are automatically loaded by Rails. If you want to use locales other than
|
|
3
|
+
# English, add the necessary files in this directory.
|
|
4
|
+
#
|
|
5
|
+
# To use the locales, use `I18n.t`:
|
|
6
|
+
#
|
|
7
|
+
# I18n.t "hello"
|
|
8
|
+
#
|
|
9
|
+
# In views, this is aliased to just `t`:
|
|
10
|
+
#
|
|
11
|
+
# <%= t("hello") %>
|
|
12
|
+
#
|
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
|
14
|
+
#
|
|
15
|
+
# I18n.locale = :es
|
|
16
|
+
#
|
|
17
|
+
# This would use the information in config/locales/es.yml.
|
|
18
|
+
#
|
|
19
|
+
# To learn more about the API, please read the Rails Internationalization guide
|
|
20
|
+
# at https://guides.rubyonrails.org/i18n.html.
|
|
21
|
+
#
|
|
22
|
+
# Be aware that YAML interprets the following case-insensitive strings as
|
|
23
|
+
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
|
|
24
|
+
# must be quoted to be interpreted as strings. For example:
|
|
25
|
+
#
|
|
26
|
+
# en:
|
|
27
|
+
# "yes": yup
|
|
28
|
+
# enabled: "ON"
|
|
3
29
|
|
|
4
30
|
en:
|
|
5
31
|
hello: "Hello world"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This configuration file will be evaluated by Puma. The top-level methods that
|
|
2
|
+
# are invoked here are part of Puma's configuration DSL. For more information
|
|
3
|
+
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
|
4
|
+
#
|
|
5
|
+
# Puma starts a configurable number of processes (workers) and each process
|
|
6
|
+
# serves each request in a thread from an internal thread pool.
|
|
7
|
+
#
|
|
8
|
+
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
|
|
9
|
+
# should only set this value when you want to run 2 or more workers. The
|
|
10
|
+
# default is already 1.
|
|
11
|
+
#
|
|
12
|
+
# The ideal number of threads per worker depends both on how much time the
|
|
13
|
+
# application spends waiting for IO operations and on how much you wish to
|
|
14
|
+
# prioritize throughput over latency.
|
|
15
|
+
#
|
|
16
|
+
# As a rule of thumb, increasing the number of threads will increase how much
|
|
17
|
+
# traffic a given process can handle (throughput), but due to CRuby's
|
|
18
|
+
# Global VM Lock (GVL) it has diminishing returns and will degrade the
|
|
19
|
+
# response time (latency) of the application.
|
|
20
|
+
#
|
|
21
|
+
# The default is set to 3 threads as it's deemed a decent compromise between
|
|
22
|
+
# throughput and latency for the average Rails application.
|
|
23
|
+
#
|
|
24
|
+
# Any libraries that use a connection pool or another resource pool should
|
|
25
|
+
# be configured to provide at least as many connections as the number of
|
|
26
|
+
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
|
27
|
+
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
|
|
28
|
+
threads threads_count, threads_count
|
|
29
|
+
|
|
30
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
|
31
|
+
port ENV.fetch("PORT", 3000)
|
|
32
|
+
|
|
33
|
+
# Allow puma to be restarted by `bin/rails restart` command.
|
|
34
|
+
plugin :tmp_restart
|
|
35
|
+
|
|
36
|
+
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
|
37
|
+
# In other environments, only set the PID file if requested.
|
|
38
|
+
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
data/test/dummy/config/redis.yml
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
local: &local
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
:inline: true
|
|
2
|
+
host: localhost
|
|
3
|
+
port: 6379
|
|
4
|
+
timeout: 1
|
|
6
5
|
|
|
7
6
|
development: *local
|
|
8
7
|
|
|
9
|
-
# We don't actually connect to localhost, but we need a config block for the
|
|
8
|
+
# We don't actually connect to localhost, but we need a config block for the
|
|
10
9
|
# redis client to use that's under Rails.env, which is test. :)
|
|
11
|
-
test: *local
|
|
10
|
+
test: *local
|
data/test/dummy/config/routes.rb
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
Rails.application.routes.draw do
|
|
2
|
+
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
|
3
|
+
|
|
4
|
+
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
|
5
|
+
# Can be used by load balancers and uptime monitors to verify that the app is live.
|
|
6
|
+
get "up" => "rails/health#show", as: :rails_health_check
|
|
7
|
+
|
|
8
|
+
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
|
|
9
|
+
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
|
|
10
|
+
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
|
|
11
|
+
|
|
12
|
+
# Defines the root path route ("/")
|
|
13
|
+
# root "posts#index"
|
|
14
|
+
|
|
2
15
|
mount Easymon::Engine => "/up"
|
|
3
16
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
test:
|
|
2
|
+
service: Disk
|
|
3
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
|
4
|
+
|
|
5
|
+
local:
|
|
6
|
+
service: Disk
|
|
7
|
+
root: <%= Rails.root.join("storage") %>
|
|
8
|
+
|
|
9
|
+
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
|
10
|
+
# amazon:
|
|
11
|
+
# service: S3
|
|
12
|
+
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
|
13
|
+
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
|
14
|
+
# region: us-east-1
|
|
15
|
+
# bucket: your_own_bucket-<%= Rails.env %>
|
|
16
|
+
|
|
17
|
+
# Remember not to checkin your GCS keyfile to a repository
|
|
18
|
+
# google:
|
|
19
|
+
# service: GCS
|
|
20
|
+
# project: your_project
|
|
21
|
+
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
|
22
|
+
# bucket: your_own_bucket-<%= Rails.env %>
|
|
23
|
+
|
|
24
|
+
# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
|
25
|
+
# microsoft:
|
|
26
|
+
# service: AzureStorage
|
|
27
|
+
# storage_account_name: your_account_name
|
|
28
|
+
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
|
29
|
+
# container: your_container_name-<%= Rails.env %>
|
|
30
|
+
|
|
31
|
+
# mirror:
|
|
32
|
+
# service: Mirror
|
|
33
|
+
# primary: local
|
|
34
|
+
# mirrors: [ amazon, google, microsoft ]
|
data/test/dummy/config.ru
CHANGED