hyrax 5.0.4 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.dassie/.env +4 -0
  3. data/.dassie/Gemfile +15 -11
  4. data/.dassie/app/controllers/application_controller.rb +4 -0
  5. data/.dassie/app/helpers/hyrax_helper.rb +4 -0
  6. data/.dassie/app/models/ability.rb +4 -0
  7. data/.dassie/app/models/user.rb +11 -0
  8. data/.dassie/app/views/shared/_footer.html.erb +17 -0
  9. data/.dassie/bin/rails +0 -5
  10. data/.dassie/bin/rake +0 -5
  11. data/.dassie/config/application.rb +2 -1
  12. data/.dassie/config/database.yml +18 -0
  13. data/.dassie/config/environments/development.rb +1 -1
  14. data/.dassie/config/environments/production.rb +5 -3
  15. data/.dassie/config/environments/test.rb +1 -1
  16. data/.dassie/config/fedora.yml +6 -6
  17. data/.dassie/config/initializers/profiler.rb +5 -0
  18. data/.dassie/config/initializers/riiif.rb +20 -18
  19. data/.dassie/config/locales/hyrax.en.yml +1 -1
  20. data/.dassie/config/puma.rb +55 -5
  21. data/.dassie/config/routes.rb +2 -0
  22. data/.dassie/db/migrate/20250328100249_user_roles.rb +20 -0
  23. data/.dassie/db/schema.rb +122 -110
  24. data/.github/workflows/lint-build-test.yml +35 -6
  25. data/.github/workflows/main.yml +4 -4
  26. data/.koppie/.env +1 -1
  27. data/.koppie/Gemfile +13 -10
  28. data/.koppie/app/controllers/application_controller.rb +4 -0
  29. data/.koppie/app/helpers/hyrax_helper.rb +4 -0
  30. data/.koppie/app/models/ability.rb +4 -0
  31. data/.koppie/app/models/user.rb +10 -0
  32. data/.koppie/app/views/shared/_footer.html.erb +17 -0
  33. data/.koppie/bin/rails +0 -5
  34. data/.koppie/bin/rake +0 -5
  35. data/.koppie/config/application.rb +2 -1
  36. data/.koppie/config/database.yml +2 -9
  37. data/.koppie/config/environments/development.rb +10 -1
  38. data/.koppie/config/environments/production.rb +5 -3
  39. data/.koppie/config/environments/test.rb +1 -1
  40. data/.koppie/config/initializers/1_valkyrie.rb +5 -5
  41. data/.koppie/config/initializers/hyrax.rb +20 -17
  42. data/.koppie/config/initializers/profiler.rb +5 -0
  43. data/.koppie/config/initializers/riiif.rb +21 -18
  44. data/.koppie/config/locales/hyrax.en.yml +2 -2
  45. data/.koppie/config/puma.rb +26 -7
  46. data/.koppie/config/routes.rb +2 -0
  47. data/.koppie/db/schema.rb +109 -110
  48. data/Dockerfile +110 -51
  49. data/app/actors/hyrax/actors/add_to_work_actor.rb +1 -1
  50. data/app/actors/hyrax/actors/apply_order_actor.rb +1 -1
  51. data/app/assets/stylesheets/hyrax/_tinymce.scss +6 -0
  52. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +1 -0
  53. data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +4 -4
  54. data/app/controllers/hyrax/api/zotero_controller.rb +1 -1
  55. data/app/controllers/hyrax/file_sets_controller.rb +11 -0
  56. data/app/jobs/batch_create_job.rb +2 -2
  57. data/app/models/admin_set.rb +2 -2
  58. data/app/models/concerns/hyrax/permissions/writable.rb +1 -2
  59. data/app/models/concerns/hyrax/valkyrie_lazy_migration.rb +1 -0
  60. data/app/models/hyrax/collection_type.rb +4 -4
  61. data/app/models/single_use_link.rb +1 -1
  62. data/app/services/hyrax/listeners.rb +1 -0
  63. data/app/services/hyrax/statistics/term_query.rb +1 -1
  64. data/app/services/hyrax/user_stat_importer.rb +1 -1
  65. data/app/services/hyrax/workflow.rb +8 -0
  66. data/app/validators/hyrax/has_one_title_validator.rb +1 -1
  67. data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +1 -1
  68. data/bin/db-migrate-seed.sh +1 -1
  69. data/bin/dev-entrypoint.sh +3 -0
  70. data/config/initializers/1_healthz.rb +2 -1
  71. data/config/initializers/ar_test_fixture_monkey_patch.rb +8 -0
  72. data/config/initializers/arel_rails_7_2_monkey_patch.rb +6 -0
  73. data/config/initializers/listeners.rb +4 -2
  74. data/config/initializers/new_framework_defaults_7_2.rb +8 -0
  75. data/docker-compose-dassie.yml +2 -2
  76. data/docker-compose-koppie.yml +2 -2
  77. data/docker-compose-sirenia.yml +3 -3
  78. data/documentation/developing-your-hyrax-based-app.md +6 -6
  79. data/hyrax.gemspec +9 -9
  80. data/lib/generators/hyrax/config_generator.rb +0 -5
  81. data/lib/generators/hyrax/install_generator.rb +1 -6
  82. data/lib/generators/hyrax/templates/.env +1 -1
  83. data/lib/generators/hyrax/templates/config/initializers/1_valkyrie.rb +21 -19
  84. data/lib/generators/hyrax/templates/config/initializers/riiif.rb +21 -19
  85. data/lib/generators/hyrax/templates/db/migrate/20170131142607_add_permission_template_to_sipity_workflow.rb.erb +1 -1
  86. data/lib/generators/hyrax/templates/db/migrate/20170810190549_update_collection_type_column_options.rb.erb +1 -1
  87. data/lib/generators/hyrax/templates/db/migrate/20230821153635_add_fields_to_counter_metric.rb.erb +1 -1
  88. data/lib/hyrax/configuration.rb +1 -0
  89. data/lib/hyrax/controlled_vocabulary/importer/language.rb +1 -1
  90. data/lib/hyrax/engine.rb +15 -10
  91. data/lib/hyrax/version.rb +1 -1
  92. data/lib/hyrax.rb +4 -0
  93. data/lib/tasks/workflow.rake +1 -2
  94. data/template.rb +6 -1
  95. metadata +49 -44
  96. data/.dassie/bin/spring +0 -17
  97. data/.dassie/config/initializers/mini_magick.rb +0 -6
  98. data/.dassie/config/spring.rb +0 -6
  99. data/.koppie/bin/spring +0 -17
  100. data/.koppie/config/initializers/mini_magick.rb +0 -6
  101. data/.koppie/config/spring.rb +0 -6
  102. data/config/initializers/reform_rails_6_1_monkey_patch.rb +0 -27
  103. data/lib/generators/hyrax/templates/config/initializers/mini_magick.rb +0 -6
@@ -1,15 +1,15 @@
1
1
  name: Trigger Nurax build
2
2
  on:
3
3
  workflow_dispatch:
4
- push:
5
- branches:
6
- - 'main'
4
+ # push:
5
+ # branches:
6
+ # - 'main'
7
7
 
8
8
  jobs:
9
9
  trigger:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: peter-evans/repository-dispatch@v2.1.1
12
+ - uses: peter-evans/repository-dispatch@v3
13
13
  with:
14
14
  token: ${{ secrets.NURAX_ACCESS_TOKEN }}
15
15
  event-type: push
data/.koppie/.env CHANGED
@@ -11,7 +11,7 @@ DB_NAME=koppie
11
11
  DB_PASSWORD=hyrax_password
12
12
  DB_PORT=5432
13
13
  DB_USERNAME=hyrax_user
14
- FCREPO_URL=http://fedoraAdmin:fedoraAdmin@fcrepo:8080/fcrepo/rest
14
+ FEDORA_URL=http://fedoraAdmin:fedoraAdmin@fcrepo:8080/fcrepo/rest
15
15
  FITS_SERVLET_URL=http://fits:8080/fits
16
16
  HUB_URL=http://chrome:4444/wd/hub
17
17
  HYRAX_DERIVATIVES_PATH=/app/samvera/hyrax-webapp/derivatives/
data/.koppie/Gemfile CHANGED
@@ -18,27 +18,34 @@ gem 'devise-guests', '~> 0.8'
18
18
  # Required because grpc and google-protobuf gem's binaries are not compatible with Alpine Linux.
19
19
  # To install the package in Alpine: `apk add ruby-grpc`
20
20
  # The pinned versions should match the version provided by the Alpine packages.
21
+
21
22
  if RUBY_PLATFORM =~ /musl/
22
- path '/usr/lib/ruby/gems/3.2.0' do
23
- gem 'google-protobuf', '~> 3.24.4', force_ruby_platform: true
24
- gem 'grpc', '~> 1.59.3', force_ruby_platform: true
25
- end
23
+ # Disabled due to dependency mismatches in Alpine packages (grpc 1.62.1 needs protobuf ~> 3.25)
24
+ # path '/usr/lib/ruby/gems/3.3.0' do
25
+ gem 'google-protobuf', force_ruby_platform: true
26
+ gem 'grpc', force_ruby_platform: true
27
+ # end
26
28
  end
27
29
 
30
+ gem 'hydra-role-management'
28
31
  gemspec name: 'hyrax', path: ENV.fetch('HYRAX_ENGINE_PATH', '..')
29
32
  gem 'jbuilder', '~> 2.5'
30
33
  gem 'jquery-rails'
34
+ gem 'okcomputer'
31
35
  gem 'pg', '~> 1.3'
32
36
  gem 'puma'
33
- gem 'rails', '~> 6.1', '>= 6.1.7.10'
37
+ gem 'rack-mini-profiler', require: ['prepend_net_http_patch']
38
+ gem 'rails', '~> 7.2', '< 8.0'
34
39
  gem 'riiif', '~> 2.1'
35
40
  gem 'rsolr', '>= 1.0', '< 3'
36
41
  gem 'sass-rails', '~> 6.0'
37
- gem 'sidekiq', '~> 6.4'
42
+ gem 'sidekiq', '~> 7.0'
43
+ gem 'stackprof', require: false
38
44
  gem 'turbolinks', '~> 5'
39
45
  gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
40
46
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
41
47
  gem 'uglifier', '>= 1.3.0'
48
+ gem 'activerecord-nulldb-adapter', '~> 1.1'
42
49
 
43
50
  group :development do
44
51
  gem 'better_errors' # add command line in browser when errors
@@ -46,10 +53,6 @@ group :development do
46
53
 
47
54
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
48
55
  gem 'web-console', '>= 3.3.0'
49
- gem 'listen', '>= 3.0.5', '< 3.2'
50
- # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
51
- gem 'spring'
52
- gem 'spring-watcher-listen', '~> 2.0.0'
53
56
  end
54
57
 
55
58
  group :development, :test do
@@ -10,4 +10,8 @@ class ApplicationController < ActionController::Base
10
10
  with_themed_layout '1_column'
11
11
 
12
12
  protect_from_forgery with: :exception
13
+
14
+ before_action do
15
+ Rack::MiniProfiler.authorize_request if current_user&.admin?
16
+ end
13
17
  end
@@ -3,4 +3,8 @@ module HyraxHelper
3
3
  include ::BlacklightHelper
4
4
  include Hyrax::BlacklightOverride
5
5
  include Hyrax::HyraxHelperBehavior
6
+
7
+ def application_name
8
+ ENV.fetch('APP_NAME') { super }.titleize
9
+ end
6
10
  end
@@ -17,5 +17,9 @@ class Ability
17
17
  # if user_groups.include? 'special_group'
18
18
  # can [:create], ActiveFedora::Base
19
19
  # end
20
+
21
+ if current_user.admin?
22
+ can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role
23
+ end
20
24
  end
21
25
  end
@@ -2,6 +2,9 @@ class User < ApplicationRecord
2
2
  # Connects this user object to Hydra behaviors.
3
3
  include Hydra::User
4
4
 
5
+ # Connects this user object to Role-management behaviors.
6
+ include Hydra::RoleManagement::UserRoles
7
+
5
8
  # Connects this user object to Hyrax behaviors.
6
9
  include Hyrax::User
7
10
  include Hyrax::UserUsageStats
@@ -19,4 +22,11 @@ class User < ApplicationRecord
19
22
  def to_s
20
23
  email
21
24
  end
25
+
26
+ # Groups include roles and those set by #groups= (especially in specs)
27
+ def groups
28
+ g = roles.map(&:name)
29
+ g += group_service.fetch_groups(user: self)
30
+ g
31
+ end
22
32
  end
@@ -0,0 +1,17 @@
1
+ <footer class="navbar navbar-dark bg-dark site-footer">
2
+ <div class="container-fluid">
3
+ <div class="navbar-text text-left">
4
+ <p><%= t('hyrax.footer.service_html') %> <%= t('hyrax.product_name') %> v<%= Hyrax::VERSION %></p>
5
+ <p>Commit <%= link_to ENV.fetch('BUILD_GITSHA', "Unknown")[0..6],
6
+ "https://github.com/samvera/hyrax/commit/#{ENV.fetch('BUILD_GITSHA', 'main')}" %>
7
+ Built at <%= ENV.fetch('BUILD_TIMESTAMP', 'Unknown') %>
8
+ </p>
9
+ </div>
10
+ <div class="navbar-right">
11
+ <div class="navbar-text text-right">
12
+ <p><%= t('hyrax.footer.copyright_html', current_year: Time.current.year) %></p>
13
+ <p><%= t('hyrax.background_attribution_html') %></p>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </footer>
data/.koppie/bin/rails CHANGED
@@ -1,9 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path('../spring', __FILE__)
4
- rescue LoadError => e
5
- raise unless e.message.include?('spring')
6
- end
7
2
  APP_PATH = File.expand_path('../config/application', __dir__)
8
3
  require_relative '../config/boot'
9
4
  require 'rails/commands'
data/.koppie/bin/rake CHANGED
@@ -1,9 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path('../spring', __FILE__)
4
- rescue LoadError => e
5
- raise unless e.message.include?('spring')
6
- end
7
2
  require_relative '../config/boot'
8
3
  require 'rake'
9
4
  Rake.application.run
@@ -9,7 +9,8 @@ Bundler.require(*Rails.groups)
9
9
  module Koppie
10
10
  class Application < Rails::Application
11
11
  # Initialize configuration defaults for originally generated Rails version.
12
- config.load_defaults 6.0
12
+ config.load_defaults 7.2
13
+ config.add_autoload_paths_to_load_path = true
13
14
 
14
15
  # Settings in config/environments/* take precedence over those specified here.
15
16
  # Application configuration can go into files in config/initializers
@@ -1,23 +1,16 @@
1
1
  default: &default
2
2
  adapter: postgresql
3
- pool: <%= ENV.fetch('DB_POOL') { 5 } %>
4
- timeout: <%= ENV.fetch('DB_TIMEOUT') { 5000 } %>
5
- database: <%= ENV['APP_DB_NAME'] %>
6
- username: <%= ENV['DB_USERNAME'] %>
7
- password: <%= ENV['DB_PASSWORD'] %>
8
- host: <%= ENV['DB_HOST'] %>
9
- port: <%= ENV['DB_PORT'] %>
3
+ url: <%= ENV.fetch('DATABASE_URL') %>
10
4
 
11
5
  development:
12
6
  <<: *default
13
- database: <%= ENV.fetch('APP_DB_NAME', 'nurax_pg_development') %>
14
7
 
15
8
  # Warning: The database defined as "test" will be erased and
16
9
  # re-generated from your development database when you run "rake".
17
10
  # Do not set this db to the same as development or production.
18
11
  test:
19
12
  <<: *default
20
- database: <%= ENV.fetch('APP_DB_NAME', 'nurax_pg_test') %>
13
+ url: <%= ENV.fetch('DATABASE_TEST_URL') { ENV.fetch('DATABASE_URL') } %>
21
14
 
22
15
  production:
23
16
  <<: *default
@@ -29,6 +29,15 @@ Rails.application.configure do
29
29
  config.cache_store = :null_store
30
30
  end
31
31
 
32
+ # Logging
33
+ #
34
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", 'debug')
35
+ config.log_formatter = ::Logger::Formatter.new
36
+ # log to stdout
37
+ logger = ActiveSupport::Logger.new(STDOUT)
38
+ logger.formatter = config.log_formatter
39
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
40
+
32
41
  # Store uploaded files on the local file system (see config/storage.yml for options)
33
42
  config.active_storage.service = :local
34
43
 
@@ -55,7 +64,7 @@ Rails.application.configure do
55
64
  config.assets.quiet = true
56
65
 
57
66
  # Raises error for missing translations
58
- # config.action_view.raise_on_missing_translations = true
67
+ # config.i18n.raise_on_missing_translations = true
59
68
 
60
69
  # Use an evented file watcher to asynchronously detect changes in source code,
61
70
  # routes, locales, etc. This feature depends on the listen gem.
@@ -26,8 +26,10 @@ Rails.application.configure do
26
26
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
27
27
 
28
28
  # Compress JavaScripts and CSS.
29
- config.assets.js_compressor = Uglifier.new(:harmony => true)
30
- # config.assets.css_compressor = :sass
29
+ config.assets.configure do |env|
30
+ env.js_compressor = :uglifier
31
+ # env.css_compressor = :sass
32
+ end
31
33
 
32
34
  # Do not fallback to assets pipeline if a precompiled asset is missed.
33
35
  config.assets.compile = false
@@ -54,7 +56,7 @@ Rails.application.configure do
54
56
 
55
57
  # Use the lowest log level to ensure availability of diagnostic information
56
58
  # when problems arise.
57
- config.log_level = :debug
59
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", :debug).to_sym
58
60
 
59
61
  # Prepend all log lines with the following tags.
60
62
  config.log_tags = [ :request_id ]
@@ -43,7 +43,7 @@ Rails.application.configure do
43
43
  config.active_support.deprecation = :stderr
44
44
 
45
45
  # Raises error for missing translations
46
- # config.action_view.raise_on_missing_translations = true
46
+ # config.i18n.raise_on_missing_translations = true
47
47
 
48
48
  config.log_level = :warn
49
49
  end
@@ -31,8 +31,8 @@ Valkyrie::MetadataAdapter.register(
31
31
  Valkyrie::MetadataAdapter.register(
32
32
  Valkyrie::Persistence::Fedora::MetadataAdapter.new(
33
33
  connection: ::Ldp::Client.new(Hyrax.config.fedora_connection_builder.call(
34
- ENV.fetch('FCREPO_URL') { "http://localhost:8080/fcrepo/rest" })),
35
- base_path: Rails.env,
34
+ ENV.fetch('FEDORA6_URL') { ENV.fetch('FEDORA_URL') { "http://localhost:8080/fcrepo/rest" } })),
35
+ base_path: ENV.fetch('FEDORA_BASE_PATH', Rails.env).gsub(/^\/|\/$/, ''),
36
36
  schema: Valkyrie::Persistence::Fedora::PermissiveSchema.new(Hyrax::SimpleSchemaLoader.new.permissive_schema_for_valkrie_adapter),
37
37
  fedora_version: 6.5,
38
38
  fedora_pairtree_count: 4,
@@ -64,8 +64,8 @@ Valkyrie.config.metadata_adapter = ENV.fetch('VALKYRIE_METADATA_ADAPTER') { :pg_
64
64
  Valkyrie::StorageAdapter.register(
65
65
  Valkyrie::Storage::Fedora.new(
66
66
  connection: ::Ldp::Client.new(Hyrax.config.fedora_connection_builder.call(
67
- ENV.fetch('FCREPO_URL') { "http://localhost:8080/fcrepo/rest" })),
68
- base_path: Rails.env,
67
+ ENV.fetch('FEDORA6_URL') { ENV.fetch('FEDORA_URL') { "http://localhost:8080/fcrepo/rest" } })),
68
+ base_path: ENV.fetch('FEDORA_BASE_PATH', Rails.env).gsub(/^\/|\/$/, ''),
69
69
  fedora_version: 6.5,
70
70
  fedora_pairtree_count: 4,
71
71
  fedora_pairtree_length: 2
@@ -73,7 +73,7 @@ Valkyrie::StorageAdapter.register(
73
73
  )
74
74
 
75
75
  Valkyrie::StorageAdapter.register(
76
- Valkyrie::Storage::VersionedDisk.new(base_path: Rails.root.join("storage", "files"),
76
+ Valkyrie::Storage::VersionedDisk.new(base_path: ENV.fetch('HYRAX_STORAGE_PATH') { Rails.root.join("storage", "files") },
77
77
  file_mover: FileUtils.method(:cp)),
78
78
  :versioned_disk_storage
79
79
  )
@@ -317,23 +317,26 @@ Qa::Authorities::Local.register_subauthority('subjects', 'Qa::Authorities::Local
317
317
  Qa::Authorities::Local.register_subauthority('languages', 'Qa::Authorities::Local::TableBasedAuthority')
318
318
  Qa::Authorities::Local.register_subauthority('genres', 'Qa::Authorities::Local::TableBasedAuthority')
319
319
 
320
- custom_queries = [Hyrax::CustomQueries::Navigators::CollectionMembers,
321
- Hyrax::CustomQueries::Navigators::ChildCollectionsNavigator,
322
- Hyrax::CustomQueries::Navigators::ParentCollectionsNavigator,
323
- Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator,
324
- Hyrax::CustomQueries::Navigators::ChildWorksNavigator,
325
- Hyrax::CustomQueries::Navigators::ParentWorkNavigator,
326
- Hyrax::CustomQueries::Navigators::FindFiles,
327
- Hyrax::CustomQueries::FindAccessControl,
328
- Hyrax::CustomQueries::FindCollectionsByType,
329
- Hyrax::CustomQueries::FindFileMetadata,
330
- Hyrax::CustomQueries::FindIdsByModel,
331
- Hyrax::CustomQueries::FindManyByAlternateIds,
332
- Hyrax::CustomQueries::FindModelsByAccess,
333
- Hyrax::CustomQueries::FindCountBy,
334
- Hyrax::CustomQueries::FindByDateRange]
335
- custom_queries.each do |handler|
336
- Hyrax.query_service.custom_queries.register_query_handler(handler)
320
+ Rails.application.reloader.to_prepare do
321
+ custom_queries = [Hyrax::CustomQueries::Navigators::CollectionMembers,
322
+ Hyrax::CustomQueries::Navigators::ChildCollectionsNavigator,
323
+ Hyrax::CustomQueries::Navigators::ParentCollectionsNavigator,
324
+ Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator,
325
+ Hyrax::CustomQueries::Navigators::ChildWorksNavigator,
326
+ Hyrax::CustomQueries::Navigators::ParentWorkNavigator,
327
+ Hyrax::CustomQueries::Navigators::FindFiles,
328
+ Hyrax::CustomQueries::FindAccessControl,
329
+ Hyrax::CustomQueries::FindCollectionsByType,
330
+ Hyrax::CustomQueries::FindFileMetadata,
331
+ Hyrax::CustomQueries::FindIdsByModel,
332
+ Hyrax::CustomQueries::FindManyByAlternateIds,
333
+ Hyrax::CustomQueries::FindModelsByAccess,
334
+ Hyrax::CustomQueries::FindCountBy,
335
+ Hyrax::CustomQueries::FindByDateRange]
336
+ custom_queries.each do |handler|
337
+ Hyrax.query_service.custom_queries.register_query_handler(handler)
338
+ end
337
339
  end
338
340
 
341
+
339
342
  ActiveFedora.init(solr_config_path: Rails.root.join('config', 'solr.yml'))
@@ -0,0 +1,5 @@
1
+ require 'stackprof'
2
+ require 'rack-mini-profiler'
3
+
4
+ # initialization is skipped so trigger it
5
+ Rack::MiniProfilerRails.initialize!(Rails.application)
@@ -35,32 +35,35 @@ end
35
35
  module Hyrax
36
36
  # Adds file locking to Riiif::File
37
37
  # @see RiiifFileResolver
38
- class RiiifFile < Riiif::File
39
- include ActiveSupport::Benchmarkable
40
-
41
- attr_reader :id
42
- def initialize(input_path, tempfile = nil, id:)
43
- super(input_path, tempfile)
44
- raise(ArgumentError, "must specify id") if id.blank?
45
- @id = id
46
- end
38
+ Rails.application.reloader.to_prepare do
39
+ class RiiifFile < Riiif::File
40
+ include ActiveSupport::Benchmarkable
41
+
42
+ attr_reader :id
43
+ def initialize(input_path, tempfile = nil, id:)
44
+ super(input_path, tempfile)
45
+ raise(ArgumentError, "must specify id") if id.blank?
46
+ @id = id
47
+ end
47
48
 
48
- # Wrap extract in a read lock and benchmark it
49
- def extract(transformation, image_info = nil)
50
- Riiif::Image.file_resolver.file_locks[id].with_read_lock do
51
- benchmark "RiiifFile extracted #{path} with #{transformation.to_params}", level: :debug do
52
- super
49
+ # Wrap extract in a read lock and benchmark it
50
+ def extract(transformation, image_info = nil)
51
+ Riiif::Image.file_resolver.file_locks[id].with_read_lock do
52
+ benchmark "RiiifFile extracted #{path} with #{transformation.to_params}", level: :debug do
53
+ super
54
+ end
53
55
  end
54
56
  end
55
- end
56
57
 
57
- private
58
+ private
58
59
 
59
- def logger
60
- Hyrax.logger
60
+ def logger
61
+ Hyrax.logger
62
+ end
61
63
  end
62
64
  end
63
65
 
66
+
64
67
  class RiiifFileResolver
65
68
  include ActiveSupport::Benchmarkable
66
69
 
@@ -50,9 +50,9 @@ en:
50
50
  directory:
51
51
  suffix: "@example.org"
52
52
  footer:
53
- copyright_html: "<strong>Copyright &copy; 2022 Samvera</strong> Licensed under the Apache License, Version 2.0"
53
+ copyright_html: "<strong>Copyright &copy; %{current_year} Samvera</strong> Licensed under the Apache License, Version 2.0"
54
54
  service_html: A service of <a href="http://samvera.org/" class="navbar-link" target="_blank">Samvera</a>.
55
55
  institution_name: Institution
56
56
  institution_name_full: The Institution Name
57
- product_name: Koppie
57
+ product_name: Hyrax
58
58
  product_twitter_handle: "@SamveraRepo"
@@ -4,19 +4,20 @@
4
4
  # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
5
  # and maximum; this matches the default thread size of Active Record.
6
6
  #
7
- threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
- threads threads_count, threads_count
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS", 5).to_i
8
+ threads 1, threads_count - 2
9
9
 
10
10
  # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
11
  #
12
- port ENV.fetch("PORT") { 3000 }
12
+ port ENV.fetch("PORT", 3000)
13
13
 
14
14
  # Specifies the `environment` that Puma will run in.
15
15
  #
16
- environment ENV.fetch("RAILS_ENV") { "development" }
16
+ rails_env = ENV.fetch("RAILS_ENV", 'development')
17
+ environment rails_env
17
18
 
18
19
  # Specifies the `pidfile` that Puma will use.
19
- pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
20
+ pidfile ENV.fetch("PIDFILE", 'tmp/pids/server.pid')
20
21
 
21
22
  # Specifies the number of `workers` to boot in clustered mode.
22
23
  # Workers are forked webserver processes. If using threads and workers together
@@ -24,14 +25,32 @@ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
24
25
  # Workers do not work on JRuby or Windows (both of which do not support
25
26
  # processes).
26
27
  #
27
- # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
28
+ workers ENV.fetch('WEB_CONCURRENCY', 1)
28
29
 
29
30
  # Use the `preload_app!` method when specifying a `workers` number.
30
31
  # This directive tells Puma to first boot the application and load code
31
32
  # before forking the application. This takes advantage of Copy On Write
32
33
  # process behavior so workers use less memory.
33
34
  #
34
- # preload_app!
35
+ preload_app!
35
36
 
36
37
  # Allow puma to be restarted by `rails restart` command.
37
38
  plugin :tmp_restart
39
+
40
+ # Embedded Sidekiq https://github.com/sidekiq/sidekiq/wiki/Embedding
41
+ if ENV.fetch('SIDEKIQ_MODE', false) == 'embed'
42
+ embedded_sidekiq = nil
43
+
44
+ on_worker_boot do
45
+ embedded_sidekiq = Sidekiq.configure_embed do |config|
46
+ config.logger.level = ENV.fetch("RAILS_LOG_LEVEL", 'debug')
47
+ config.queues = %w[ingest batch default]
48
+ config.concurrency = ENV.fetch('SIDEKIQ_WORKERS', 2) # Adjust max `threads` above accordingly
49
+ end
50
+ embedded_sidekiq.run
51
+ end
52
+
53
+ on_worker_shutdown do
54
+ embedded_sidekiq&.stop
55
+ end
56
+ end
@@ -12,6 +12,8 @@ Rails.application.routes.draw do
12
12
  concerns :searchable
13
13
  end
14
14
  devise_for :users
15
+ mount Hydra::RoleManagement::Engine => '/'
16
+
15
17
  mount Sidekiq::Web => '/sidekiq'
16
18
  mount Qa::Engine => '/authorities'
17
19
  mount Hyrax::Engine, at: '/'