Add simple health check
This commit is contained in:
parent
cbd80f50cb
commit
96abf0536a
|
|
@ -0,0 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class HealthController < ApplicationController
|
||||
def index
|
||||
errors = []
|
||||
errors << 'database not conneected' unless database_connected?
|
||||
status = errors.empty? ? :ok : :internal_server_error
|
||||
render json: { errors: }, status:
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def database_connected?
|
||||
ApplicationRecord.connection.select_value('SELECT 1') == 1
|
||||
rescue StandardError
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
@ -34,13 +34,9 @@ spec:
|
|||
secretKeyRef:
|
||||
name: rails-master-key
|
||||
key: master.key
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
path: /healthz
|
||||
port: http
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
|
|
|
|||
|
|
@ -17,4 +17,6 @@ Rails.application.routes.draw do
|
|||
end
|
||||
resources :match_scores, only: %i[show update]
|
||||
resources :groups, only: %i[show]
|
||||
|
||||
get 'healthz', to: 'health#index'
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue