Sha256: ee2509719ae30b763ab5517c3c806f6132999fd20181d5dae81154e00949ba5a
Contents?: true
Size: 1.22 KB
Versions: 18
Compression:
Stored size: 1.22 KB
Contents
module Roqua module StatusChecks # To use this status controller in a Rails application, add a route: # # get '/status' => 'roqua/status_checks/status#balancer_status' # # If you want to add more logic to the status controller, extend it: # # get '/status' => 'status#balancer_status' # # class StatusController < Roqua::StatusChecks::StatusController # skip_before_action :foo # skip_before_action :bar # end class StatusController < ActionController::Base def balancer_status balancer_member = balancer_member? db_connected = db_connected? http_code = balancer_member && db_connected ? 200 : 503 status = db_connected ? 'ok' : 'error' render json: {status: status, member: balancer_member}, status: http_code rescue CheckLoadBalancerMember::InvalidStatus render json: {status: "unknown status"}, status: 500 end protected def balancer_state_file Rails.root.join('config/balancer_state') end def balancer_member? CheckLoadBalancerMember.balancer_member?(balancer_state_file) end def db_connected? CheckDbConnection.connected? end end end end
Version data entries
18 entries across 18 versions & 1 rubygems