Skip to content

Commit

Permalink
Merge pull request #75 from tungleduyxyz/issue_66_add_health_check
Browse files Browse the repository at this point in the history
Issue 66 Add health check
  • Loading branch information
pierre authored May 9, 2024
2 parents 6a3a028 + 384b5a2 commit b219ea3
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
with:
ruby-version: 'jruby-9.4.2.0'
bundler-cache: false
- name: Tag repository
run: |
bundle exec gem bump -c -p -t -v ${{ github.event.inputs.perform_version }}
- name: Configure Sonatype mirror
uses: s4u/[email protected]
# Go to Sonatype directly to avoid delay syncs (could get rid of this if actions/setup-java were to support mirrors).
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ group :assets do
end

group :development do
gem 'gem-release'
gem 'listen'
gem 'puma'
gem 'rubocop'
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/health_check_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

class HealthCheckController < ActionController::Base
def health
response = { version: KauiStandalone::VERSION, status: 'UP' }
render json: response, status: 200
end
end
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# The original function requires permission [100600 100400] which did not work with the Windows system
# See this PR: https://github.com/killbill/killbill-admin-ui-standalone/pull/72
require_relative 'initializers/symmetric_file_permission_override'
require_relative '../lib/kaui_standalone/version'
require 'rails/all'
require 'avatax'
require 'kanaui'
Expand Down
1 change: 1 addition & 0 deletions config/initializers/application_controller_renderer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# ApplicationController.renderer.defaults.merge!(
Expand Down
1 change: 1 addition & 0 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Version of your assets, change this if you want to expire all your assets.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/backtrace_silencers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Define an application-wide content security policy.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/inflections.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Add new inflection rules using the following format. Inflections
Expand Down
1 change: 1 addition & 0 deletions config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Add new mime types for use in respond_to blocks:
Expand Down
1 change: 1 addition & 0 deletions config/initializers/new_framework_defaults_7_0.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.0 framework defaults upgrade.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/permissions_policy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
Rails.application.routes.draw do
root to: (ENV['KAUI_ROOT'].present? ? ENV['KAUI_ROOT'] : 'kaui/home#index')

get '/health', to: 'health_check#health'

# We mount KAUI as root, since this is the primary engine
mount Kaui::Engine => '/', :as => 'kaui_engine'

Expand Down
1 change: 1 addition & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
Expand Down
5 changes: 5 additions & 0 deletions lib/kaui_standalone/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module KauiStandalone
VERSION = '3.0.7'
end
7 changes: 7 additions & 0 deletions test/integration/homepage_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@ class HomepageTest < ActionDispatch::IntegrationTest
assert_redirected_to SIGN_IN_PATH
assert_equal 'You need to sign in before continuing.', flash[:alert]
end

test 'Healthcheck' do
get "#{BASE_PATH}/health"
json_response = JSON.parse(response.body)
assert_equal 'UP', json_response['status']
assert_response :success
end
end
1 change: 1 addition & 0 deletions test/performance/browsing_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# require 'test_helper'
# require 'rails/performance_test_help'
#
Expand Down

0 comments on commit b219ea3

Please sign in to comment.