Skip to content

Commit

Permalink
Refine default Solr config settings post external Solr transition
Browse files Browse the repository at this point in the history
Deprecated irrelevant :solr_home_directory.
Updated solr_url comment to be more appropriate.
Set no. of backups to 0 by default. Since external transition the
snapshot feature wouldn't work without cfg updates anyway and it's
now more difficult to assume there's a standard deployment config
for Solr backups that will be generally applicable.
Set :solr_index_directory to a reasonable looking "default" should
backups be enabled.
Abort the snapshot if the :solr_index_directory is not found.
  • Loading branch information
mark-cooper committed Mar 4, 2022
1 parent 97ef868 commit d82bfa5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions common/config/config-aliases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@

AppConfig.add_deprecated(:bulk_import_rows)
AppConfig.add_deprecated(:bulk_import_size)
AppConfig.add_deprecated(:solr_home_directory)

# AppConfig.ensure_false(:enable_custom_reports)
13 changes: 8 additions & 5 deletions common/config/config-defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
# set it to something else below.
AppConfig[:oai_url] = "http://localhost:8082"

# The ArchivesSpace Solr index listens on port 8090 by default. You can
# set it to something else below.
# The ArchivesSpace Solr index url default. You can set it to something else below.
AppConfig[:solr_url] = "http://localhost:8983/solr/archivesspace"

# The ArchivesSpace indexer listens on port 8091 by default. You can
Expand Down Expand Up @@ -74,7 +73,9 @@
# By default, Solr backups will run at midnight. See https://crontab.guru/ for
# information about the schedule syntax.
AppConfig[:solr_backup_schedule] = "0 0 * * *"
AppConfig[:solr_backup_number_to_keep] = 1
# By default no backups. If enabling (by setting > 0) then you must also ensure
# that AppConfig[:solr_index_directory] is set to the correct path
AppConfig[:solr_backup_number_to_keep] = 0
AppConfig[:solr_backup_directory] = proc { File.join(AppConfig[:data_directory], "solr_backups") }
# add default solr params, i.e. use AND for search: AppConfig[:solr_params] = { 'mm' => '100%' }
# Another example below sets the boost query value (bq) to boost the relevancy for the query string in the title,
Expand Down Expand Up @@ -148,8 +149,10 @@
AppConfig[:data_directory] = File.join(Dir.home, "ArchivesSpace")

AppConfig[:backup_directory] = proc { File.join(AppConfig[:data_directory], "demo_db_backups") }
AppConfig[:solr_index_directory] = proc { File.join(AppConfig[:data_directory], "solr_index") }
AppConfig[:solr_home_directory] = proc { File.join(AppConfig[:data_directory], "solr_home") }
# Set the path to the solr index for the external Solr instance.
# This setting is used by the solr backups configuration but only
# applies if the solr index directory is accessible to ArchivesSpace.
AppConfig[:solr_index_directory] = File.join('', 'var', 'solr', 'data', 'archivesspace', 'data')
AppConfig[:solr_indexing_frequency_seconds] = 30
AppConfig[:solr_facet_limit] = 100

Expand Down
5 changes: 5 additions & 0 deletions common/solr_snapshotter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ def self.wait_for_snapshot_to_finish(starting_status, starting_snapshot)


def self.do_snapshot(identifier = nil)
unless File.directory?(AppConfig[:solr_index_directory])
log(:info, "Skipping Solr snapshot, not a directory: #{AppConfig[:solr_index_directory]}")
return
end

identifier ||= Time.now.to_i

target = File.join(AppConfig[:solr_backup_directory], "solr.#{identifier}")
Expand Down

0 comments on commit d82bfa5

Please sign in to comment.