Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 66 Add health check #75

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a different input parameter, let me do the patch.

- 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
Loading