Skip to content

Commit 6b607af

Browse files
Adds healthchecks using the OKComputer gem
1 parent 89a0fe7 commit 6b607af

File tree

7 files changed

+21
-20
lines changed

7 files changed

+21
-20
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,5 @@ group :test do
5353
gem 'simplecov', '~> 0.21', require: false
5454
gem 'simplecov-rcov', '~> 0.2', require: false
5555
end
56+
57+
gem "okcomputer", "~> 1.19"

Gemfile.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ GEM
166166
faraday-retry (2.2.1)
167167
faraday (~> 2.0)
168168
ffi (1.17.0-aarch64-linux-gnu)
169+
ffi (1.17.0-arm64-darwin)
169170
ffi (1.17.0-x86_64-darwin)
170171
ffi (1.17.0-x86_64-linux-gnu)
171172
ffi (1.17.0-x86_64-linux-musl)
@@ -281,13 +282,16 @@ GEM
281282
nio4r (2.7.4)
282283
nokogiri (1.16.7-aarch64-linux)
283284
racc (~> 1.4)
285+
nokogiri (1.16.7-arm64-darwin)
286+
racc (~> 1.4)
284287
nokogiri (1.16.7-x86_64-darwin)
285288
racc (~> 1.4)
286289
nokogiri (1.16.7-x86_64-linux)
287290
racc (~> 1.4)
288291
oj (3.16.7)
289292
bigdecimal (>= 3.0)
290293
ostruct (>= 0.2)
294+
okcomputer (1.19.0)
291295
omniauth (2.1.2)
292296
hashie (>= 3.4.6)
293297
rack (>= 2.2.3)
@@ -542,6 +546,7 @@ DEPENDENCIES
542546
importmap-rails
543547
jbuilder
544548
jquery-rails
549+
okcomputer (~> 1.19)
545550
omniauth
546551
omniauth-cas (= 3.0.0)
547552
omniauth-rails_csrf_protection (~> 1.0)

config/initializers/okcomputer.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# initializers/okcomputer.rb
2+
# Health checks configuration
3+
4+
OkComputer.mount_at = '/health'
5+
OkComputer.logger = Rails.logger
6+
OkComputer.check_in_parallel = true
7+
8+
# Check the Solr connection
9+
# Requires the ping handler on the solr core (<core>/admin/ping).
10+
core_baseurl = Blacklight.default_index.connection.uri.to_s.chomp('/')
11+
OkComputer::Registry.register 'solr', OkComputer::SolrCheck.new(core_baseurl)
12+
13+
# Check that DB migrations have run
14+
OkComputer::Registry.register 'database-migrations', OkComputer::ActiveRecordMigrationsCheck.new

docker-compose.ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22

33
services:
4-
adminer: !reset
5-
64
app:
75
build: !reset
86
environment:

docker-compose.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
---
22

33
services:
4-
adminer:
5-
image: adminer
6-
restart: always
7-
ports:
8-
- 8080:8080
9-
104
app:
115
build:
126
context: .

solr/geodata-test/solrconfig.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,6 @@
177177
<lst name="defaults">
178178
<str name="echoParams">all</str>
179179
</lst>
180-
<!-- An optional feature of the PingRequestHandler is to configure the
181-
handler with a "healthcheckFile" which can be used to enable/disable
182-
the PingRequestHandler.
183-
relative paths are resolved against the data dir
184-
-->
185-
<str name="healthcheckFile">server-enabled.txt</str>
186180
</requestHandler>
187181

188182
<requestHandler name="/analysis/field"

solr/geodata/solrconfig.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,6 @@
177177
<lst name="defaults">
178178
<str name="echoParams">all</str>
179179
</lst>
180-
<!-- An optional feature of the PingRequestHandler is to configure the
181-
handler with a "healthcheckFile" which can be used to enable/disable
182-
the PingRequestHandler.
183-
relative paths are resolved against the data dir
184-
-->
185-
<str name="healthcheckFile">server-enabled.txt</str>
186180
</requestHandler>
187181

188182
<requestHandler name="/analysis/field"

0 commit comments

Comments
 (0)