Skip to content

Commit

Permalink
add solr related env vars to service; make threads env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Mar 20, 2024
1 parent fd50c1b commit 8d56112
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 0 additions & 2 deletions umich_catalog_indexing/env.development
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ 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
SOLR_USER=solr
SOLR_PASSWORD=SolrRocks
SOLRCLOUD_ON=true
PROMETHEUS_PUSH_GATEWAY=http://pushgateway:9091
1 change: 1 addition & 0 deletions umich_catalog_indexing/lib/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
require_relative "services/paths"
require_relative "services/logger"
require_relative "services/dbs"
require_relative "services/solr"
7 changes: 7 additions & 0 deletions umich_catalog_indexing/lib/services/solr.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
S.register(:solrcloud_on?) do
(ENV["SOLRCLOUD_ON"] == "true") ? true : false
end
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", 8) }
10 changes: 6 additions & 4 deletions umich_catalog_indexing/writers/solr.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require "traject"
require "traject/solr_json_writer"
require "services"

settings do
provide "solr_writer.basic_auth_user", ENV.fetch("SOLR_USER") if ENV.fetch("SOLRCLOUD_ON") == "true"
provide "solr_writer.basic_auth_password", ENV.fetch("SOLR_PASSWORD") if ENV.fetch("SOLRCLOUD_ON") == "true"
provide "solr_writer.basic_auth_user", S.solr_user if S.solrcloud_on?
provide "solr_writer.basic_auth_password", S.solr_password if S.solrcloud_on?
provide "solr_writer.max_skipped", 1000
provide "solr_writer.commit_on_close", "true"
provide "solr_writer.thread_pool", 2
provide "solr_writer.thread_pool", S.solr_threads
provide "solr_writer.batch_size", 60
provide "writer_class_name", "Traject::SolrJsonWriter"
store "processing_thread_pool", 8
store "processing_thread_pool", S.processing_threads
provide "log.batch_size", 50_000
end

0 comments on commit 8d56112

Please sign in to comment.