Skip to content

Commit

Permalink
adds some env vars to services
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Oct 4, 2024
1 parent 9e5896d commit c359a9b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion umich_catalog_indexing/env.development
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ MACC_PRODUCTION_SOLR_URL=http://solr:8983/solr/biblio
HATCHER_PRODUCTION_SOLR_URL=http://solr:8983/solr/biblio
LIVE_SOLR_URL=http://solr:8983/solr/biblio
REINDEX_SOLR_URL=http://solr:8983/solr/biblio
SIDEKIQ_SUPERVISOR_HOST=http://supervisor:3000
SOLRCLOUD_ON=true
PROMETHEUS_PUSH_GATEWAY=http://pushgateway:9091
HLB_XML_ENDPOINT=https://apps.lib.umich.edu/browse/categories/xml.php
Expand Down
6 changes: 3 additions & 3 deletions umich_catalog_indexing/lib/services/solr.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
S.register(:solrcloud_on?) do
(ENV["SOLRCLOUD_ON"] == "true") ? true : false
end
S.register(:solrcloud_on?) { ENV["SOLRCLOUD_ON"] == "true" }
S.register(:solr_threads) { ENV.fetch("SOLR_THREADS", 1).to_i }
S.register(:solr_user) { ENV.fetch("SOLR_USER", "solr") }
S.register(:solr_password) { ENV.fetch("SOLR_PASSWORD", "SolrRocks") }
S.register(:processing_threads) { ENV.fetch("PROCESSING_THREADS", 1) }
S.register(:supervisor_on?) { ENV["SUPERVISOR_ON"] == "true" }
S.register(:sidekiq_supervisor_host) { ENV.fetch("SIDEKIQ_SUPERVISOR_HOST", "http://supervisor:3000") }
10 changes: 5 additions & 5 deletions umich_catalog_indexing/lib/sidekiq_jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class JobQueued
def call(worker, job, queue, redis_pool)
Faraday.post("#{ENV.fetch("SIDEKIQ_SUPERVISOR_HOST")}/api/v1/jobs", {
Faraday.post("#{S.sidekiq_supervisor_host}/api/v1/jobs", {
job_id: job["jid"],
arguments: job["args"].to_json,
job_class: job["class"],
Expand All @@ -17,19 +17,19 @@ def call(worker, job, queue, redis_pool)

Sidekiq.configure_client do |config|
config.client_middleware do |chain|
chain.add JobQueued if ENV.fetch("SUPERVISOR_ON") == "true"
chain.add JobQueued if S.supervisor_on?
end
end

class CheckInCheckOut
def call(worker, job, queue)
Faraday.post("#{ENV.fetch("SIDEKIQ_SUPERVISOR_HOST")}/api/v1/jobs/#{job["jid"]}/started", {
Faraday.post("#{S.sidekiq_supervisor_host}/api/v1/jobs/#{job["jid"]}/started", {
arguments: job["args"].to_json,
job_class: job["class"],
queue: queue
})
yield
Faraday.post("#{ENV.fetch("SIDEKIQ_SUPERVISOR_HOST")}/api/v1/jobs/#{job["jid"]}/complete", {
Faraday.post("#{S.sidekiq_supervisor_host}/api/v1/jobs/#{job["jid"]}/complete", {
arguments: job["args"].to_json,
job_class: job["class"],
queue: queue
Expand All @@ -39,7 +39,7 @@ def call(worker, job, queue)

Sidekiq.configure_server do |config|
config.server_middleware do |chain|
chain.add CheckInCheckOut if ENV.fetch("SUPERVISOR_ON") == "true"
chain.add CheckInCheckOut if S.supervisor_on?
end
end

Expand Down

0 comments on commit c359a9b

Please sign in to comment.