Skip to content

Commit

Permalink
WIP: Solr 8 update
Browse files Browse the repository at this point in the history
  • Loading branch information
elohanlon committed Oct 7, 2023
1 parent 444c933 commit 8122f15
Show file tree
Hide file tree
Showing 67 changed files with 5,835 additions and 257 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
- name: Set up default config files
run: bundle exec rake hyacinth:setup:config_files
- name: Run CI task
run: bundle exec rake hyacinth:ci
run: bundle exec rake hyacinth:ci_nocop
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.6.10
2.6.10
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ gem 'nokogiri', '~> 1.10.10' # can't update to 1.11 because our server version

# For authentication
gem 'devise', '>= 3.4.1'
gem 'childprocess', '~> 2.0'

# CUL Fedora Dependencies and Content Models
gem 'cul_hydra', '~> 1.5.0'
gem 'cul_hydra', '~> 1.8.0'
# gem 'cul_hydra', path: '../cul_hydra'
gem 'rubydora', git: 'https://github.com/elohanlon/rubydora', branch: 'datastream_dissemination_with_headers'
# gem 'cul_hydra', path: '../cul_hydra'
# Temporarily use specific commit because new version of gem hasn't been released yet. Latest is 1.1.3.
Expand Down
24 changes: 13 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ GEM
sass (>= 3.3.4)
builder (3.2.4)
byebug (9.0.6)
cancancan (1.12.0)
cancancan (3.5.0)
capistrano (3.5.0)
airbrussh (>= 1.0.0)
capistrano-harrow
Expand Down Expand Up @@ -142,7 +142,8 @@ GEM
regexp_parser (~> 1.5)
xpath (~> 3.2)
charlock_holmes (0.7.6)
childprocess (4.1.0)
childprocess (2.0.0)
rake (< 13.0)
chosen-rails (1.5.2)
coffee-rails (>= 3.2)
railties (>= 3.0)
Expand All @@ -158,14 +159,13 @@ GEM
concurrent-ruby (1.1.7)
connection_pool (2.2.1)
crass (1.0.6)
cul_hydra (1.5.0)
active-fedora (~> 7.0)
cul_hydra (1.8.0)
active-fedora (>= 7.3.1)
active-triples (~> 0.2.2)
active_fedora_finders (>= 0.5.0)
active_fedora_relsint (~> 0.4)
autoprefixer-rails (<= 6.1.1)
blacklight
cancancan (~> 1.12.0)
bootstrap-sass (~> 3.3.7)
cul_image_props
httpclient
hydra-head (~> 7)
Expand All @@ -174,7 +174,8 @@ GEM
rake (<= 11.3)
rdf (>= 1.1.5)
rubydora (~> 2.0.0)
sparql (= 1.1.4)
sparql
sprockets (~> 3.0)
thread
cul_image_props (0.3.6)
nokogiri
Expand All @@ -195,8 +196,8 @@ GEM
ebnf (0.3.9)
rdf (~> 1.1)
sxp (~> 0.1, >= 0.1.3)
edtf (3.0.4)
activesupport (>= 3.0, < 6.0)
edtf (3.1.1)
activesupport (>= 3.0, < 8.0)
encryptor (1.3.0)
equivalent-xml (0.6.0)
nokogiri (>= 1.4.3)
Expand Down Expand Up @@ -241,7 +242,7 @@ GEM
rails (>= 3.2.6)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
iso-639 (0.2.8)
iso-639 (0.3.6)
jaro_winkler (1.5.1)
jbuilder (1.5.3)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -588,10 +589,11 @@ DEPENDENCIES
capistrano-rvm (~> 0.1)
capybara (~> 3.32)
charlock_holmes
childprocess (~> 2.0)
chosen-rails
coderay
coffee-rails
cul_hydra (~> 1.5.0)
cul_hydra (~> 1.8.0)
devise (>= 3.4.1)
diffy (~> 3.1)
equivalent-xml
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Un-comment this for full stack traces in Rake tasks
# Rake.application.options.trace = true

Rake.application.options.trace = true

require File.expand_path('../config/application', __FILE__)

Hyacinth::Application.load_tasks
17 changes: 16 additions & 1 deletion app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,29 @@ def create_associated_fedora_object!
pid = next_pid
concept = Concept.new(pid: pid)
@fedora_object = concept
puts "Creating Fedora object with pid: #{@fedora_object.pid}"
self.pid = @fedora_object.pid
end

def update_fedora_object!
puts 'got here 1'
fedora_object.datastreams["DC"].dc_identifier = [pid]
puts 'got here 2'
fedora_object.datastreams["DC"].dc_type = 'Project'
puts 'got here 3'
fedora_object.datastreams["DC"].dc_title = display_label
puts 'got here 4'
fedora_object.label = Hyacinth::Utils::StringUtils.escape_four_byte_utf8_characters_as_html_entities(display_label)
fedora_object.save(update_index: false)
puts 'got here 5'
begin
fedora_object.save(update_index: false)
rescue => e
puts "Problem during fobj save: #{e.message}"
puts "Problem during fobj save: #{e.backtrace}"
# raise e
end
puts 'got here 6'
fedora_object
end

def mark_fedora_object_as_deleted!
Expand All @@ -69,6 +83,7 @@ def asset_directory
end

def ensure_that_title_fields_are_enabled_and_required
puts 'got here too 1'
changes_require_save = false

# For all DigitalObjectTypes that contain ANY enabled dynamic fields, ensure that the title fields are always enabled (and that title_non_sort_portion is always required)
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Hyacinth::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.

config.log_level = :error
config.log_level = :debug

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/backtrace_silencers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }

# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
Rails.backtrace_cleaner.remove_silencers!
195 changes: 1 addition & 194 deletions db/migrate/20161130002750_create_core_objects.rb
Original file line number Diff line number Diff line change
@@ -1,198 +1,5 @@
class CreateCoreObjects < ActiveRecord::Migration
def change

# If there are no DigitalObjectTypes the system, run the setup code below.
# This conditional is here to accommodate existing Hyacinth installations
# that ran seeds.rb before the code below was removed from there and put
# into this migration instead.
if DigitalObjectType.count == 0
# Create default PidGenerator
puts 'Creating default PidGenerator...'
PidGenerator.create!(namespace: HYACINTH['default_pid_generator_namespace'])

puts 'Creating default DigitalObjectTypes...'
# Create DigitalObjectTypes
DigitalObjectType.create!(string_key: 'item', display_label: 'Item', sort_order: 0)
DigitalObjectType.create!(string_key: 'group', display_label: 'Group', sort_order: 1)
DigitalObjectType.create!(string_key: 'asset', display_label: 'Asset', sort_order: 2)
DigitalObjectType.create!(string_key: 'file_system', display_label: 'FileSystem', sort_order: 3)

# Create default user accounts
puts 'Creating default user accounts...'
YAML.load_file('config/default_user_accounts.yml').each {|service_user_entry, service_user_info|
User.create!(
:email => service_user_info['email'],
:password => service_user_info['password'],
:password_confirmation => service_user_info['password'],
:first_name => service_user_info['first_name'],
:last_name => service_user_info['last_name'],
:is_admin => service_user_info['is_admin']
)
}

puts 'Creating default XmlDatastream...'
# Create XmlDatastreams
XmlDatastream.create(string_key: 'descMetadata', display_label: 'descMetadata',
xml_translation: {
"element" => "mods:mods",
"attrs" => {
"xmlns:xlink" => "http://www.w3.org/1999/xlink",
"version" => "3.5",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xmlns:mods" => "http://www.loc.gov/mods/v3",
"xsi:schemaLocation" => "http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd"
},
"content" => [
{
"yield" => "title"
},
{
"yield" => "name"
},
{
"element" => "mods:originInfo"
}
]
}.to_json
)

# Create DynamicFieldGroupCategories
puts 'Creating default DynamicFieldGroupCategories...'
dfc_descriptive_metadata = DynamicFieldGroupCategory.create!(display_label: 'Descriptive Metadata')
dfc_identifiers = DynamicFieldGroupCategory.create!(display_label: 'Identifiers')
dfc_physical_information = DynamicFieldGroupCategory.create!(display_label: 'Physical Information')
dfc_location_and_holdings = DynamicFieldGroupCategory.create!(display_label: 'Location and Holdings')
dfc_subject_data = DynamicFieldGroupCategory.create!(display_label: 'Subject Data')
dfc_geographic_data = DynamicFieldGroupCategory.create!(display_label: 'Geographic Data')
dfc_notes = DynamicFieldGroupCategory.create!(display_label: 'Notes')
dfc_digitization = DynamicFieldGroupCategory.create!(display_label: 'Digitization')
dfc_contextual_data = DynamicFieldGroupCategory.create!(display_label: 'Contextual Data')
dfc_record_info = DynamicFieldGroupCategory.create!(display_label: 'Record Information')
dfc_other = DynamicFieldGroupCategory.create!(display_label: 'Other')
dfc_asset_data = DynamicFieldGroupCategory.create!(display_label: 'Asset Data')

puts 'Creating default DynamicFieldGroups, DynamicFields and controlled vocabularies...'
# Create core DynamicFieldGroups and DynamicFields
title = DynamicFieldGroup.create!(string_key: 'title', display_label: 'Title', dynamic_field_group_category: dfc_descriptive_metadata, is_repeatable: false,
dynamic_fields: [
DynamicField.new(string_key: 'title_non_sort_portion', display_label: 'Non-Sort Portion', dynamic_field_type: DynamicField::Type::STRING),
DynamicField.new(string_key: 'title_sort_portion', display_label: 'Sort Portion', dynamic_field_type: DynamicField::Type::STRING, is_keyword_searchable: true, is_searchable_title_field: true)
],
xml_translation: {
"element" => "mods:titleInfo",
"content" => [
{
"element" => "mods:nonSort",
"content" => "{{title_non_sort_portion}}"
},
{
"element" => "mods:title",
"content" => "{{title_sort_portion}}"
}
]
}.to_json
)

# Create various controlled vocabularies if they don't already exist
{
'collection' => 'Collection',
'form' => 'Form',
'genre' => 'Genre',
'language' => 'Language',
'location' => 'Location',
'name' => 'Name',
'name_role' => 'Name Role',
'subject_geographic' => 'Subject Geographic',
'subject_name' => 'Subject Name',
'subject_temporal' => 'Subject Temporal',
'subject_title' => 'Subject Title',
'subject_topic' => 'Subject Topic'
}.each do |string_key, display_label|
if UriService.client.find_vocabulary(string_key).nil?
@controlled_vocabulary = ControlledVocabulary.new
@controlled_vocabulary.string_key = string_key
@controlled_vocabulary.display_label = display_label
@controlled_vocabulary.save
end
end

#collection
collection = DynamicFieldGroup.create!(string_key: 'collection', display_label: 'Collection', dynamic_field_group_category: dfc_descriptive_metadata,
dynamic_fields: [
DynamicField.new(string_key: 'collection_term', display_label: 'Value', dynamic_field_type: DynamicField::Type::CONTROLLED_TERM, controlled_vocabulary_string_key: 'collection', is_facet_field: true, is_single_field_searchable: true, standalone_field_label: 'Collection'),
#DynamicField.new(string_key: 'collection_preferred_label', display_label: 'Preferred Label', dynamic_field_type: DynamicField::Type::STRING),
]
)

#form
form = DynamicFieldGroup.create!(string_key: 'form', display_label: 'Form', dynamic_field_group_category: dfc_physical_information, is_repeatable: true,
dynamic_fields: [
DynamicField.new(string_key: 'form_term', display_label: 'Value', dynamic_field_type: DynamicField::Type::CONTROLLED_TERM, controlled_vocabulary_string_key: 'form', is_facet_field: true, standalone_field_label: 'Format'),
#DynamicField.new(string_key: 'form_preferred_label', display_label: 'Preferred Label', dynamic_field_type: DynamicField::Type::STRING),
]
)

#location
location = DynamicFieldGroup.create!(string_key: 'location', display_label: 'Location', dynamic_field_group_category: dfc_location_and_holdings, is_repeatable: true,
dynamic_fields: [
DynamicField.new(string_key: 'location_term', display_label: 'Value', dynamic_field_type: DynamicField::Type::CONTROLLED_TERM, controlled_vocabulary_string_key: 'location', is_facet_field: true, standalone_field_label: 'Location'),
#DynamicField.new(string_key: 'location_preferred_label', display_label: 'Preferred Label', dynamic_field_type: DynamicField::Type::STRING),
]
)

#name
name = DynamicFieldGroup.create!(string_key: 'name', display_label: 'Name', dynamic_field_group_category: dfc_descriptive_metadata, is_repeatable: true,
dynamic_fields: [
DynamicField.new(string_key: 'name_term', display_label: 'Value', dynamic_field_type: DynamicField::Type::CONTROLLED_TERM, controlled_vocabulary_string_key: 'name', is_facet_field: true, standalone_field_label: 'Name'),
#DynamicField.new(string_key: 'name_preferred_label', display_label: 'Preferred Label', dynamic_field_type: DynamicField::Type::STRING),
],
xml_translation: {
"element" => "mods:name",
"attrs" => {
"valueUri" => "{{name_term.uri}}"
},
"content" => [
{
"element" => "mods:namePart",
"content" => "{{name_term.value}}"
},
{
"yield" => "name_role"
}
]
}.to_json
)
# --> Child DynamicFieldGroups for name
DynamicFieldGroup.create!(string_key: 'name_role', display_label: 'Role', is_repeatable: true, parent_dynamic_field_group: name,
dynamic_fields: [
DynamicField.new(string_key: 'name_role_term', display_label: 'Value', dynamic_field_type: DynamicField::Type::CONTROLLED_TERM, controlled_vocabulary_string_key: 'name_role')
],
xml_translation: {
"element" => "mods:role",
"content" => [
{
"element" => "mods:roleTerm",
"attrs" => {
"valueUri" => "{{name_role_term.uri}}"
},
"content" => "{{name_role_term.value}}"
}
]
}.to_json
)
end

if DigitalObjectType.find_by(string_key: 'publish_target').nil?
puts 'Creating default publish targets...'
DigitalObjectType.create!(string_key: 'publish_target', display_label: 'Publish Target', sort_order: 4)
publish_targets_project = Project.create!(string_key: 'publish_targets', display_label: 'Publish Targets', pid_generator: PidGenerator.default_pid_generator)

# Enable title field for publish targets
dot_publish_target = DigitalObjectType.find_by(string_key: 'publish_target')
# Enable title fields for Items, Groups and Assets
(DynamicFieldGroup.find_by(string_key: 'title').dynamic_fields).each do |dynamic_field|
publish_targets_project.enabled_dynamic_fields << EnabledDynamicField.new(dynamic_field: dynamic_field, digital_object_type: dot_publish_target)
end
end
# This no longer does anything. The logic here has been moved into a rake task.
end
end
9 changes: 4 additions & 5 deletions docker/fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ ENV FEDORA_HOME /opt/fedora
ENV CATALINA_HOME /opt/fedora/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH

RUN curl -L https://github.com/fcrepo3/fcrepo/releases/download/v3.8.1/fcrepo-installer-3.8.1.jar -o /opt/fcrepo-installer.jar
WORKDIR /opt

COPY ./install.properties /opt/install.properties
RUN java -jar /opt/fcrepo-installer.jar /opt/install.properties
COPY ./setup-and-start.sh /opt/setup-and-start.sh

EXPOSE 8080
WORKDIR $FEDORA_HOME
RUN curl -L https://github.com/fcrepo3/fcrepo/releases/download/v3.8.1/fcrepo-installer-3.8.1.jar -o /opt/fcrepo-installer.jar

CMD ["catalina.sh", "run"]
CMD /bin/bash ./setup-and-start.sh
10 changes: 10 additions & 0 deletions docker/fedora/setup-and-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Install Fedora if it has not already been installed. The check below ensure that this
# installation only runs once (whenever the /opt/fedora volume is re-created).
if [ ! -f /opt/fedora/tomcat/bin/catalina.sh ]; then
java -jar /opt/fcrepo-installer.jar /opt/install.properties
echo 'Done running installer jar...'
fi

/opt/fedora/tomcat/bin/catalina.sh run
Loading

0 comments on commit 8122f15

Please sign in to comment.