From ae4cc7aa3085faab82d65aab0dd49ed3d0111812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20A=2E=20Matienzo?= Date: Wed, 3 Dec 2025 16:48:42 -0800 Subject: [PATCH] AP-520: convert healthcheck to okcomputer --- Gemfile | 2 +- Gemfile.lock | 7 +++---- config/initializers/healthcheck.rb | 15 --------------- config/initializers/okcomputer.rb | 5 +++++ config/routes.rb | 2 +- lib/tasks/health.rake | 9 --------- 6 files changed, 10 insertions(+), 30 deletions(-) delete mode 100644 config/initializers/healthcheck.rb create mode 100644 config/initializers/okcomputer.rb delete mode 100644 lib/tasks/health.rake diff --git a/Gemfile b/Gemfile index 2d86b82..0303b16 100644 --- a/Gemfile +++ b/Gemfile @@ -15,10 +15,10 @@ gem 'jquery-rails', '~> 4.4' gem 'lograge', '~> 0.11' gem 'mysql2', '~> 0.5.4' gem 'nokogiri', '~> 1.18' +gem 'okcomputer', '~> 1.19' gem 'ougai', '~> 1.8' gem 'puma', '~> 6.6.1' gem 'rails', '~> 8.0.0' -gem 'rails-healthcheck' gem 'rake' gem 'sass-rails', '>= 6' gem 'webpacker', '~> 5.4.3' diff --git a/Gemfile.lock b/Gemfile.lock index c9ac258..8fddd33 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -193,6 +193,8 @@ GEM oj (3.16.12) bigdecimal (>= 3.0) ostruct (>= 0.2) + okcomputer (1.19.1) + benchmark ostruct (0.6.3) ougai (1.9.1) oj (~> 3.10) @@ -239,9 +241,6 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-healthcheck (1.4.0) - actionpack - railties rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) @@ -408,10 +407,10 @@ DEPENDENCIES lograge (~> 0.11) mysql2 (~> 0.5.4) nokogiri (~> 1.18) + okcomputer (~> 1.19) ougai (~> 1.8) puma (~> 6.6.1) rails (~> 8.0.0) - rails-healthcheck rake rspec-rails (~> 8.0) rspec_junit_formatter (~> 0.4.1) diff --git a/config/initializers/healthcheck.rb b/config/initializers/healthcheck.rb deleted file mode 100644 index a8a1bd5..0000000 --- a/config/initializers/healthcheck.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -Healthcheck.configure do |config| - config.success = 200 - config.error = 503 - config.verbose = false - config.route = '/healthcheck' - config.method = :get - - # -- Response -- - config.custom = ->(controller, checker) { - controller.render json: 'App Healthy' unless checker.errored? - } - -end diff --git a/config/initializers/okcomputer.rb b/config/initializers/okcomputer.rb new file mode 100644 index 0000000..8494625 --- /dev/null +++ b/config/initializers/okcomputer.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +# Health check configuration +OkComputer.logger = Rails.logger +OkComputer.check_in_parallel = true diff --git a/config/routes.rb b/config/routes.rb index 12cebf7..c927db2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ # frozen_string_literal:true Rails.application.routes.draw do - Healthcheck.routes(self) + get 'health', to: 'ok_computer/ok_computer#index', defaults: { format: :json } resources :nara_casefile resources :search_casefiles diff --git a/lib/tasks/health.rake b/lib/tasks/health.rake deleted file mode 100644 index bb8796e..0000000 --- a/lib/tasks/health.rake +++ /dev/null @@ -1,9 +0,0 @@ -namespace :health do - desc 'Query the healthcheck endpoint' - task check: :environment do - session = ActionDispatch::Integration::Session.new(Rails.application) - session.get(Rails.application.routes.url_helpers.health_path) - puts session.response.body - exit 1 if session.response.server_error? - end -end