mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
Add health check endpoint
This commit is contained in:
parent
0038f72155
commit
98520b0287
15 changed files with 81 additions and 29 deletions
|
|
@ -1 +1 @@
|
||||||
0.13.0
|
0.13.1
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ orbs:
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/ruby:3.2.3
|
- image: cimg/ruby:3.3.5
|
||||||
environment:
|
environment:
|
||||||
RAILS_ENV: test
|
RAILS_ENV: test
|
||||||
- image: circleci/postgres:13.3
|
- image: circleci/postgres:13.3
|
||||||
|
|
|
||||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -35,7 +35,7 @@ jobs:
|
||||||
- name: Set up Ruby
|
- name: Set up Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: '3.2.3'
|
ruby-version: '3.3.5'
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
|
|
||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
|
|
|
||||||
12
CHANGELOG.md
12
CHANGELOG.md
|
|
@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## [0.13.1] — 2024-09-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- `GET /api/v1/health` endpoint to check the health of the application with swagger docs
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Ruby version updated to 3.3.5
|
||||||
|
- Visits suggestion process now will try to merge consecutive visits to the same place into one visit.
|
||||||
|
|
||||||
|
|
||||||
## [0.13.0] — 2024-09-03
|
## [0.13.0] — 2024-09-03
|
||||||
|
|
||||||
The GPX and GeoJSON export release
|
The GPX and GeoJSON export release
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM ruby:3.2.3-alpine
|
FROM ruby:3.3.5-alpine
|
||||||
|
|
||||||
ENV APP_PATH /var/app
|
ENV APP_PATH /var/app
|
||||||
ENV BUNDLE_VERSION 2.5.9
|
ENV BUNDLE_VERSION 2.5.9
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM ruby:3.2.3-alpine
|
FROM ruby:3.3.5-alpine
|
||||||
|
|
||||||
ENV APP_PATH /var/app
|
ENV APP_PATH /var/app
|
||||||
ENV BUNDLE_VERSION 2.5.9
|
ENV BUNDLE_VERSION 2.5.9
|
||||||
|
|
|
||||||
1
Gemfile
1
Gemfile
|
|
@ -47,7 +47,6 @@ group :test do
|
||||||
gem 'shoulda-matchers'
|
gem 'shoulda-matchers'
|
||||||
gem 'simplecov', require: false
|
gem 'simplecov', require: false
|
||||||
gem 'super_diff'
|
gem 'super_diff'
|
||||||
gem 'timecop'
|
|
||||||
gem 'webmock'
|
gem 'webmock'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,6 @@ GEM
|
||||||
tailwindcss-rails (2.7.3-x86_64-linux)
|
tailwindcss-rails (2.7.3-x86_64-linux)
|
||||||
railties (>= 7.0.0)
|
railties (>= 7.0.0)
|
||||||
thor (1.3.2)
|
thor (1.3.2)
|
||||||
timecop (0.9.10)
|
|
||||||
timeout (0.4.1)
|
timeout (0.4.1)
|
||||||
turbo-rails (2.0.6)
|
turbo-rails (2.0.6)
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
|
|
@ -458,7 +457,6 @@ DEPENDENCIES
|
||||||
stimulus-rails
|
stimulus-rails
|
||||||
super_diff
|
super_diff
|
||||||
tailwindcss-rails
|
tailwindcss-rails
|
||||||
timecop
|
|
||||||
turbo-rails
|
turbo-rails
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
webmock
|
webmock
|
||||||
|
|
|
||||||
9
app/controllers/api/v1/health_controller.rb
Normal file
9
app/controllers/api/v1/health_controller.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Api::V1::HealthController < ApiController
|
||||||
|
skip_before_action :authenticate_api_key
|
||||||
|
|
||||||
|
def index
|
||||||
|
render json: { status: 'ok' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -56,6 +56,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
namespace :api do
|
namespace :api do
|
||||||
namespace :v1 do
|
namespace :v1 do
|
||||||
|
get 'health', to: 'health#index'
|
||||||
patch 'settings', to: 'settings#update'
|
patch 'settings', to: 'settings#update'
|
||||||
get 'settings', to: 'settings#index'
|
get 'settings', to: 'settings#index'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
version: '3'
|
|
||||||
networks:
|
networks:
|
||||||
dawarich:
|
dawarich:
|
||||||
services:
|
services:
|
||||||
|
|
|
||||||
15
spec/requests/api/v1/health_spec.rb
Normal file
15
spec/requests/api/v1/health_spec.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe 'Api::V1::Healths', type: :request do
|
||||||
|
describe 'GET /index' do
|
||||||
|
context 'when user is not authenticated' do
|
||||||
|
it 'returns http success' do
|
||||||
|
get '/api/v1/health'
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:success)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -27,9 +27,6 @@ RSpec.describe Visits::Prepare do
|
||||||
subject { described_class.new(points).call }
|
subject { described_class.new(points).call }
|
||||||
|
|
||||||
it 'returns correct visits' do
|
it 'returns correct visits' do
|
||||||
freezed_time = Time.current
|
|
||||||
|
|
||||||
Timecop.freeze(freezed_time) do
|
|
||||||
expect(subject).to eq [
|
expect(subject).to eq [
|
||||||
{
|
{
|
||||||
date: 1.day.ago.to_date.to_s,
|
date: 1.day.ago.to_date.to_s,
|
||||||
|
|
@ -48,5 +45,4 @@ RSpec.describe Visits::Prepare do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
15
spec/swagger/api/v1/health_controller_spec.rb
Normal file
15
spec/swagger/api/v1/health_controller_spec.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'swagger_helper'
|
||||||
|
|
||||||
|
describe 'Health API', type: :request do
|
||||||
|
path '/api/v1/health' do
|
||||||
|
get 'Retrieves application status' do
|
||||||
|
tags 'Health'
|
||||||
|
produces 'application/json'
|
||||||
|
response '200', 'areas found' do
|
||||||
|
run_test!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -106,6 +106,14 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: area deleted
|
description: area deleted
|
||||||
|
"/api/v1/health":
|
||||||
|
get:
|
||||||
|
summary: Retrieves application status
|
||||||
|
tags:
|
||||||
|
- Health
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: areas found
|
||||||
"/api/v1/overland/batches":
|
"/api/v1/overland/batches":
|
||||||
post:
|
post:
|
||||||
summary: Creates a batch of points
|
summary: Creates a batch of points
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue