Add runner management health check for /ping

Even though we can check the health of the runner management, we would like to ensure an external health check validates the availability of all required services.
This commit is contained in:
Sebastian Serth
2023-03-13 22:54:14 +01:00
parent 0643bc8c0c
commit 0dd931fba1
5 changed files with 42 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class PingController < ApplicationController
before_action :postgres_connected!
before_action :postgres_connected!, :runner_manager_healthy!
after_action :verify_authorized, except: %i[index]
def index
@ -20,4 +20,11 @@ class PingController < ApplicationController
raise ActiveRecord::ConnectionNotEstablished
end
def runner_manager_healthy!
# any unhandled exception leads to a HTTP 500 response.
return if Runner.strategy_class.health == true
raise Runner::Error::InternalServerError
end
end