diff --git a/CHANGELOG.md b/CHANGELOG.md index cfb563e0..1bedf598 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - After deleting one point from the map, other points can now be deleted as well. #723 +### Added + +- `X-Dawarich-Version` header to the `GET /api/v1/health` endpoint response. + # 0.23.6 - 2025-02-06 ### Added diff --git a/Gemfile.lock b/Gemfile.lock index 4bf8fa71..e0398b56 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -102,7 +102,7 @@ GEM msgpack (~> 1.2) builder (3.3.0) byebug (11.1.3) - chartkick (5.1.2) + chartkick (5.1.3) coderay (1.1.3) concurrent-ruby (1.3.5) connection_pool (2.5.0) @@ -118,7 +118,7 @@ GEM data_migrate (11.2.0) activerecord (>= 6.1) railties (>= 6.1) - database_consistency (2.0.0) + database_consistency (2.0.3) activerecord (>= 3.2) date (3.4.1) debug (1.10.0) @@ -148,7 +148,7 @@ GEM factory_bot (~> 6.5) railties (>= 5.0.0) fakeredis (0.1.4) - ffaker (2.23.0) + ffaker (2.24.0) foreman (0.88.1) fugit (1.11.1) et-orbi (~> 1, >= 1.2.11) @@ -172,7 +172,8 @@ GEM activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.8.0) - irb (1.14.3) + irb (1.15.1) + pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.9.1) @@ -190,7 +191,7 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - language_server-protocol (3.17.0.3) + language_server-protocol (3.17.0.4) logger (1.6.5) lograge (0.14.0) actionpack (>= 4) @@ -249,6 +250,9 @@ GEM patience_diff (1.2.0) optimist (~> 3.0) pg (1.5.9) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) prometheus_exporter (2.2.0) webrick pry (0.14.2) @@ -263,7 +267,7 @@ GEM date stringio public_suffix (6.0.1) - puma (6.5.0) + puma (6.6.0) nio4r (~> 2.0) pundit (2.4.0) activesupport (>= 3.0.0) @@ -355,7 +359,7 @@ GEM rswag-ui (2.16.0) actionpack (>= 5.2, < 8.1) railties (>= 5.2, < 8.1) - rubocop (1.70.0) + rubocop (1.71.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -367,7 +371,7 @@ GEM unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.37.0) parser (>= 3.3.1.0) - rubocop-rails (2.29.0) + rubocop-rails (2.29.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.52.0, < 2.0) @@ -379,7 +383,8 @@ GEM shrine (3.6.0) content_disposition (~> 1.0) down (~> 5.1) - sidekiq (7.3.7) + sidekiq (7.3.8) + base64 connection_pool (>= 2.3.0) logger rack (>= 2.2.4) @@ -407,15 +412,15 @@ GEM stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.2) - strong_migrations (2.1.0) - activerecord (>= 6.1) + strong_migrations (2.2.0) + activerecord (>= 7) super_diff (0.15.0) attr_extras (>= 6.2.4) diff-lcs patience_diff - tailwindcss-rails (3.3.0) + tailwindcss-rails (3.3.1) railties (>= 7.0.0) - tailwindcss-ruby + tailwindcss-ruby (~> 3.0) tailwindcss-ruby (3.4.17) tailwindcss-ruby (3.4.17-aarch64-linux) tailwindcss-ruby (3.4.17-arm-linux) @@ -423,7 +428,7 @@ GEM tailwindcss-ruby (3.4.17-x86_64-darwin) tailwindcss-ruby (3.4.17-x86_64-linux) thor (1.3.2) - timeout (0.4.2) + timeout (0.4.3) turbo-rails (2.0.11) actionpack (>= 6.0.0) railties (>= 6.0.0) diff --git a/app/controllers/api/v1/health_controller.rb b/app/controllers/api/v1/health_controller.rb index 87df7d96..8e13d165 100644 --- a/app/controllers/api/v1/health_controller.rb +++ b/app/controllers/api/v1/health_controller.rb @@ -10,6 +10,8 @@ class Api::V1::HealthController < ApiController response.set_header('X-Dawarich-Response', 'Hey, I\'m alive!') end + response.set_header('X-Dawarich-Version', APP_VERSION) + render json: { status: 'ok' } end end diff --git a/docs/How_to_install_Dawarich_in_k8s.md b/docs/How_to_install_Dawarich_in_k8s.md index f21c8658..71dc40a1 100644 --- a/docs/How_to_install_Dawarich_in_k8s.md +++ b/docs/How_to_install_Dawarich_in_k8s.md @@ -36,37 +36,7 @@ spec: storageClassName: longhorn resources: requests: - storage: 15Gi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - namespace: dawarich - name: gem-cache - labels: - storage.k8s.io/name: longhorn -spec: - accessModes: - - ReadWriteOnce - storageClassName: longhorn - resources: - requests: - storage: 15Gi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - namespace: dawarich - name: gem-sidekiq - labels: - storage.k8s.io/name: longhorn -spec: - accessModes: - - ReadWriteOnce - storageClassName: longhorn - resources: - requests: - storage: 15Gi + storage: 1Gi --- apiVersion: v1 kind: PersistentVolumeClaim @@ -81,7 +51,7 @@ spec: storageClassName: longhorn resources: requests: - storage: 15Gi + storage: 1Gi ``` ### Deployment @@ -143,14 +113,12 @@ spec: image: freikin/dawarich:0.16.4 imagePullPolicy: Always volumeMounts: - - mountPath: /usr/local/bundle/gems - name: gem-app - mountPath: /var/app/public name: public - mountPath: /var/app/tmp/imports/watched name: watched command: - - "dev-entrypoint.sh" + - "web-entrypoint.sh" args: - "bin/rails server -p 3000 -b ::" resources: @@ -199,16 +167,14 @@ spec: image: freikin/dawarich:0.16.4 imagePullPolicy: Always volumeMounts: - - mountPath: /usr/local/bundle/gems - name: gem-sidekiq - mountPath: /var/app/public name: public - mountPath: /var/app/tmp/imports/watched name: watched command: - - "dev-entrypoint.sh" + - "sidekiq-entrypoint.sh" args: - - "sidekiq" + - "bundle exec sidekiq" resources: requests: memory: "1Gi" @@ -216,6 +182,22 @@ spec: limits: memory: "3Gi" cpu: "1500m" + livenessProbe: + httpGet: + path: /api/v1/health + port: 3000 + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + readinessProbe: + httpGet: + path: / + port: 3000 + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 3 + failureThreshold: 3 volumes: - name: gem-cache persistentVolumeClaim: diff --git a/spec/requests/api/v1/health_spec.rb b/spec/requests/api/v1/health_spec.rb index 4861b399..139a207c 100644 --- a/spec/requests/api/v1/health_spec.rb +++ b/spec/requests/api/v1/health_spec.rb @@ -23,5 +23,11 @@ RSpec.describe 'Api::V1::Healths', type: :request do expect(response.headers['X-Dawarich-Response']).to eq('Hey, I\'m alive and authenticated!') end end + + it 'returns the correct version' do + get '/api/v1/health' + + expect(response.headers['X-Dawarich-Version']).to eq(APP_VERSION) + end end end