hyrax 5.1.0.pre.beta1 → 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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/.dassie/.env +4 -0
  3. data/.dassie/Gemfile +11 -6
  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/config/database.yml +18 -0
  10. data/.dassie/config/environments/production.rb +1 -1
  11. data/.dassie/config/fedora.yml +6 -6
  12. data/.dassie/config/initializers/profiler.rb +5 -0
  13. data/.dassie/config/locales/hyrax.en.yml +1 -1
  14. data/.dassie/config/puma.rb +55 -5
  15. data/.dassie/config/routes.rb +2 -0
  16. data/.dassie/db/migrate/20250328100249_user_roles.rb +20 -0
  17. data/.dassie/db/schema.rb +14 -1
  18. data/.github/workflows/lint-build-test.yml +34 -5
  19. data/.github/workflows/main.yml +4 -4
  20. data/.koppie/.env +1 -1
  21. data/.koppie/Gemfile +10 -6
  22. data/.koppie/app/controllers/application_controller.rb +4 -0
  23. data/.koppie/app/helpers/hyrax_helper.rb +4 -0
  24. data/.koppie/app/models/ability.rb +4 -0
  25. data/.koppie/app/models/user.rb +10 -0
  26. data/.koppie/app/views/shared/_footer.html.erb +17 -0
  27. data/.koppie/config/database.yml +2 -9
  28. data/.koppie/config/environments/development.rb +9 -0
  29. data/.koppie/config/environments/production.rb +1 -1
  30. data/.koppie/config/initializers/1_valkyrie.rb +5 -5
  31. data/.koppie/config/initializers/profiler.rb +5 -0
  32. data/.koppie/config/locales/hyrax.en.yml +2 -2
  33. data/.koppie/config/puma.rb +26 -7
  34. data/.koppie/config/routes.rb +2 -0
  35. data/.koppie/db/schema.rb +109 -110
  36. data/Dockerfile +108 -50
  37. data/app/controllers/hyrax/file_sets_controller.rb +11 -0
  38. data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +1 -1
  39. data/bin/db-migrate-seed.sh +1 -1
  40. data/bin/dev-entrypoint.sh +3 -0
  41. data/docker-compose-dassie.yml +2 -2
  42. data/docker-compose-koppie.yml +2 -2
  43. data/docker-compose-sirenia.yml +2 -2
  44. data/documentation/developing-your-hyrax-based-app.md +1 -1
  45. data/hyrax.gemspec +1 -1
  46. data/lib/generators/hyrax/install_generator.rb +0 -5
  47. data/lib/generators/hyrax/templates/.env +1 -1
  48. data/lib/generators/hyrax/templates/config/initializers/1_valkyrie.rb +21 -19
  49. data/lib/generators/hyrax/templates/db/migrate/20170131142607_add_permission_template_to_sipity_workflow.rb.erb +1 -1
  50. data/lib/generators/hyrax/templates/db/migrate/20170810190549_update_collection_type_column_options.rb.erb +1 -1
  51. data/lib/generators/hyrax/templates/db/migrate/20230821153635_add_fields_to_counter_metric.rb.erb +1 -1
  52. data/lib/hyrax/version.rb +1 -1
  53. data/lib/tasks/workflow.rake +1 -2
  54. data/template.rb +1 -1
  55. metadata +10 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08508f785d195263cfe808e128a93f0144a0da56aa7e8d5fbd08a1ddd543c448'
4
- data.tar.gz: 0e64095cd09810042c20ade46070ae392a4c0506c14acf5ea99e5fc9453ec8e9
3
+ metadata.gz: ddbf266b8b67364db933bf1b60129204b7f9055c3ff396d36bbfd5ba0a752868
4
+ data.tar.gz: a0f8fca6c5cfb7213ffaf321be7930e80a2a974ee4b33b5c8b3cc3ab24816409
5
5
  SHA512:
6
- metadata.gz: c7d0e18940b7243f192e9d03c8b59b7918aed1fbead26089a92471731c7affe71dd4a82d1d750ceac28c3577ef75c904eb0255f6ced70453be8433639ba51a8e
7
- data.tar.gz: c76473bb4d5b0f8fc7ab8c795aa2f8f44f392c5f9e6f423767375c5218b4afec97608e40ebb67b232eb9d4e1ae8158e73726f3932e95912bab699bf58dc56cac
6
+ metadata.gz: 2ffab98229bd3ee47dc292dce9a71db483326125cc76419b386e7fc34c4698a9b288926f2f1bf572730f9f8249c205b2a5fce46a93f002e0d23fa47b97b89bf5
7
+ data.tar.gz: 47beca282a262f8016054dba544b273e0b7206d2e5f6dce83441189354fa1ef99188545fa270ce6449e8ce50019136e8b7b0cd02ab536f90d544c16c68a19841
data/.dassie/.env CHANGED
@@ -1,4 +1,5 @@
1
1
  ANALYTICS_START_DATE=2021-08-21
2
+ APP_NAME=dassie
2
3
  BUNDLE_GEMFILE=Gemfile.dassie
3
4
  BUNDLE_PATH=/app/bundle
4
5
  CH12N_TOOL=fits_servlet
@@ -38,7 +39,10 @@ SOLR_TEST_URL=http://solr:8983/solr/hyrax_test
38
39
  SOLR_URL=http://solr:8983/solr/hyrax
39
40
  TB_RSPEC_OPTIONS=--force-color --format RspecJunitFormatter --out rspec.xml
40
41
  TB_RSPEC_FORMATTER=progress
42
+ VALKYRIE_FCREPO_URL=http://fedoraAdmin:fedoraAdmin@fedora6:8080/fcrepo/rest
41
43
  VALKYRIE_ID_TYPE=string
44
+ VALKYRIE_METADATA_ADAPTER=pg_metadata
42
45
  VALKYRIE_SOLR_HOST=solr
43
46
  VALKYRIE_SOLR_PORT=8983
47
+ VALKYRIE_STORAGE_ADAPTER=versioned_disk_storage
44
48
  VALKYRIE_TRANSITION=false
data/.dassie/Gemfile CHANGED
@@ -19,24 +19,29 @@ gem 'devise-guests', '~> 0.8'
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
- # Disabled due to dependency mismatches in Alpine packages (grpc 1.62.1 needs protobuf ~> 3.25)
23
- # if RUBY_PLATFORM =~ /musl/
22
+
23
+ if RUBY_PLATFORM =~ /musl/
24
+ # # Disabled due to dependency mismatches in Alpine packages (grpc 1.62.1 needs protobuf ~> 3.25)
24
25
  # path '/usr/lib/ruby/gems/3.3.0' do
25
- # gem 'google-protobuf', '~> 3.24.4', force_ruby_platform: true
26
- # gem 'grpc', '~> 1.62.1', force_ruby_platform: true
26
+ gem 'google-protobuf', force_ruby_platform: true
27
+ gem 'grpc', force_ruby_platform: true
27
28
  # end
28
- # end
29
+ end
29
30
 
31
+ gem 'hydra-role-management'
30
32
  gemspec name: 'hyrax', path: ENV.fetch('HYRAX_ENGINE_PATH', '..')
31
33
  gem 'jbuilder', '~> 2.5'
32
34
  gem 'jquery-rails'
35
+ gem 'okcomputer'
33
36
  gem 'pg', '~> 1.3'
34
37
  gem 'puma'
38
+ gem 'rack-mini-profiler', require: ['prepend_net_http_patch']
35
39
  gem 'rails', '~> 7.2', '< 8.0'
36
40
  gem 'riiif', '~> 2.1'
37
41
  gem 'rsolr', '>= 1.0', '< 3'
38
42
  gem 'sass-rails', '~> 6.0'
39
- gem 'sidekiq', '~> 6.4'
43
+ gem 'sidekiq', '~> 7.0'
44
+ gem 'stackprof', require: false
40
45
  gem 'turbolinks', '~> 5'
41
46
  gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
42
47
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
@@ -9,4 +9,8 @@ class ApplicationController < ActionController::Base
9
9
  include Hyrax::ThemedLayoutController
10
10
 
11
11
  with_themed_layout '1_column'
12
+
13
+ before_action do
14
+ Rack::MiniProfiler.authorize_request if current_user&.admin?
15
+ end
12
16
  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
@@ -1,6 +1,10 @@
1
1
  class User < ApplicationRecord
2
2
  # Connects this user object to Hydra behaviors.
3
3
  include Hydra::User
4
+
5
+ # Connects this user object to Role-management behaviors.
6
+ include Hydra::RoleManagement::UserRoles
7
+
4
8
  # Connects this user object to Hyrax behaviors.
5
9
  include Hyrax::User
6
10
  include Hyrax::UserUsageStats
@@ -18,4 +22,11 @@ class User < ApplicationRecord
18
22
  def to_s
19
23
  email
20
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
21
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>
@@ -0,0 +1,18 @@
1
+ default: &default
2
+ adapter: postgresql
3
+ url: <%= ENV.fetch('DATABASE_URL') %>
4
+
5
+ development:
6
+ <<: *default
7
+
8
+ # Warning: The database defined as "test" will be erased and
9
+ # re-generated from your development database when you run "rake".
10
+ # Do not set this db to the same as development or production.
11
+ test:
12
+ <<: *default
13
+ url: <%= ENV.fetch('DATABASE_TEST_URL') { ENV.fetch('DATABASE_URL') } %>
14
+
15
+ production:
16
+ <<: *default
17
+ encoding: unicode
18
+ pool: 50
@@ -53,7 +53,7 @@ Rails.application.configure do
53
53
 
54
54
  # Use the lowest log level to ensure availability of diagnostic information
55
55
  # when problems arise.
56
- config.log_level = :debug
56
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", :debug).to_sym
57
57
 
58
58
  # Prepend all log lines with the following tags.
59
59
  config.log_tags = [ :request_id ]
@@ -1,15 +1,15 @@
1
1
  development:
2
2
  user: fedoraAdmin
3
3
  password: fedoraAdmin
4
- url: http://<%= ENV['FCREPO_HOST'] || 'localhost' %>:<%= ENV['FCREPO_DEVELOPMENT_PORT'] || ENV['FCREPO_PORT'] || 8984 %>/<%= ENV['FCREPO_REST_PATH'] || 'rest' %>
5
- base_path: <%= ENV['FCREPO_DEV_BASE_PATH'] || ENV['FCREPO_BASE_PATH'] || '/dev' %>
4
+ url: <%= ENV.fetch('FEDORA_URL') { "http://#{ENV['FCREPO_HOST'] || 'localhost'}:#{ENV['FCREPO_DEVELOPMENT_PORT'] || ENV['FCREPO_PORT'] || 8984 }/#{ENV['FCREPO_REST_PATH'] || 'rest'}" } %>
5
+ base_path: <%= ENV['FEDORA_BASE_PATH'] || ENV['FCREPO_DEV_BASE_PATH'] || ENV['FCREPO_BASE_PATH'] || '/dev' %>
6
6
  test:
7
7
  user: fedoraAdmin
8
8
  password: fedoraAdmin
9
- url: http://<%= ENV['FCREPO_HOST'] || 'localhost' %>:<%= ENV['FCREPO_DEVELOPMENT_PORT'] || ENV['FCREPO_PORT'] || 8986 %>/<%= ENV['FCREPO_REST_PATH'] || 'rest' %>
10
- base_path: <%= ENV['FCREPO_TEST_BASE_PATH'] || ENV['FCREPO_BASE_PATH'] || '/test' %>
9
+ url: <%= ENV.fetch('FEDORA_URL') { "http://#{ENV['FCREPO_HOST'] || 'localhost'}:#{ENV['FCREPO_DEVELOPMENT_PORT'] || ENV['FCREPO_PORT'] || 8986 }/#{ENV['FCREPO_REST_PATH'] || 'rest'}" } %>
10
+ base_path: <%= ENV['FEDORA_BASE_PATH'] || ENV['FCREPO_TEST_BASE_PATH'] || ENV['FCREPO_BASE_PATH'] || '/test' %>
11
11
  production:
12
12
  user: fedoraAdmin
13
13
  password: fedoraAdmin
14
- url: http://<%= ENV['FCREPO_HOST'] || 'localhost' %>:<%= ENV['FCREPO_DEVELOPMENT_PORT'] || ENV['FCREPO_PORT'] || 8983 %>/<%= ENV['FCREPO_REST_PATH'] || 'rest' %>
15
- base_path: <%= ENV['FCREPO_BASE_PATH'] || '/prod' %>
14
+ url: <%= ENV.fetch('FEDORA_URL') { "http://#{ENV['FCREPO_HOST'] || 'localhost'}:#{ENV['FCREPO_PORT'] || 8984 }/#{ENV['FCREPO_REST_PATH'] || 'rest'}" } %>
15
+ base_path: <%= ENV['FEDORA_BASE_PATH'] || ENV['FCREPO_BASE_PATH'] || '/prod' %>
@@ -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)
@@ -50,7 +50,7 @@ en:
50
50
  directory:
51
51
  suffix: "@example.org"
52
52
  footer:
53
- copyright_html: "<strong>Copyright &copy; 2018 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
@@ -1,6 +1,56 @@
1
- threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
2
- threads threads_count, threads_count
3
- port ENV.fetch("PORT") { 3000 }
4
- environment ENV.fetch("RAILS_ENV") { "development" }
5
- pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS", 5).to_i
8
+ threads 1, threads_count - 2
9
+
10
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
+ #
12
+ port ENV.fetch("PORT", 3000)
13
+
14
+ # Specifies the `environment` that Puma will run in.
15
+ #
16
+ rails_env = ENV.fetch("RAILS_ENV", 'development')
17
+ environment rails_env
18
+
19
+ # Specifies the `pidfile` that Puma will use.
20
+ pidfile ENV.fetch("PIDFILE", 'tmp/pids/server.pid')
21
+
22
+ # Specifies the number of `workers` to boot in clustered mode.
23
+ # Workers are forked webserver processes. If using threads and workers together
24
+ # the concurrency of the application would be max `threads` * `workers`.
25
+ # Workers do not work on JRuby or Windows (both of which do not support
26
+ # processes).
27
+ #
28
+ workers ENV.fetch('WEB_CONCURRENCY', 1)
29
+
30
+ # Use the `preload_app!` method when specifying a `workers` number.
31
+ # This directive tells Puma to first boot the application and load code
32
+ # before forking the application. This takes advantage of Copy On Write
33
+ # process behavior so workers use less memory.
34
+ #
35
+ preload_app!
36
+
37
+ # Allow puma to be restarted by `rails restart` command.
6
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
@@ -13,6 +13,8 @@ Rails.application.routes.draw do
13
13
  concerns :searchable
14
14
  end
15
15
  devise_for :users
16
+ mount Hydra::RoleManagement::Engine => '/'
17
+
16
18
  mount Qa::Engine => '/authorities'
17
19
  mount Hyrax::Engine, at: '/'
18
20
  resources :welcome, only: 'index'
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UserRoles < ActiveRecord::Migration[5.0]
4
+ def up
5
+ create_table :roles do |t|
6
+ t.string :name
7
+ end
8
+ create_table :roles_users, id: false do |t|
9
+ t.references :role
10
+ t.references :user
11
+ end
12
+ add_index :roles_users, %i[role_id user_id]
13
+ add_index :roles_users, %i[user_id role_id]
14
+ end
15
+
16
+ def down
17
+ drop_table :roles_users
18
+ drop_table :roles
19
+ end
20
+ end
data/.dassie/db/schema.rb CHANGED
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema[7.2].define(version: 2024_05_06_070809) do
13
+ ActiveRecord::Schema[7.2].define(version: 2025_03_28_100249) do
14
14
  # These are extensions that must be enabled in order to support this database
15
15
  enable_extension "plpgsql"
16
16
  enable_extension "uuid-ossp"
@@ -323,6 +323,19 @@ ActiveRecord::Schema[7.2].define(version: 2024_05_06_070809) do
323
323
  t.index ["uri"], name: "index_qa_local_authority_entries_on_uri", unique: true
324
324
  end
325
325
 
326
+ create_table "roles", id: :serial, force: :cascade do |t|
327
+ t.string "name"
328
+ end
329
+
330
+ create_table "roles_users", id: false, force: :cascade do |t|
331
+ t.integer "role_id"
332
+ t.integer "user_id"
333
+ t.index ["role_id", "user_id"], name: "index_roles_users_on_role_id_and_user_id"
334
+ t.index ["role_id"], name: "index_roles_users_on_role_id"
335
+ t.index ["user_id", "role_id"], name: "index_roles_users_on_user_id_and_role_id"
336
+ t.index ["user_id"], name: "index_roles_users_on_user_id"
337
+ end
338
+
326
339
  create_table "searches", id: :serial, force: :cascade do |t|
327
340
  t.binary "query_params"
328
341
  t.integer "user_id"
@@ -17,6 +17,7 @@ on:
17
17
 
18
18
  env:
19
19
  REGISTRY: ghcr.io
20
+ IMAGE_NAME: ${{ github.repository }}-dev
20
21
  DOCKER_BUILDKIT: 1
21
22
  COMPOSE_DOCKER_CLI_BUILD: 1
22
23
 
@@ -47,22 +48,50 @@ jobs:
47
48
  steps:
48
49
  - name: Checkout
49
50
  uses: actions/checkout@v4
51
+ - name: Auth to ghcr.io
52
+ uses: docker/login-action@v3
53
+ with:
54
+ registry: ${{ env.REGISTRY }}
55
+ username: ${{ github.actor }}
56
+ password: ${{ secrets.GITHUB_TOKEN }}
50
57
  - name: Set up Docker Buildx
51
58
  uses: docker/setup-buildx-action@v3
59
+ - name: Setup image tags
60
+ id: image-meta
61
+ uses: docker/metadata-action@v5
62
+ with:
63
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
64
+ tags: |
65
+ type=raw,value=latest,enable={{is_default_branch}}
66
+ type=ref,event=pr
67
+ type=sha,format=long,prefix=
52
68
  - name: Build and export
53
69
  uses: docker/build-push-action@v6
54
70
  with:
71
+ build-args: |
72
+ BUILD_TIMESTAMP=${{ fromJSON(steps.image-meta.outputs.json).labels['org.opencontainers.image.created'] }}
73
+ BUILD_GITSHA=${{ github.sha }}
55
74
  cache-from: type=gha
56
75
  cache-to: type=gha, mode=max
57
76
  context: .
58
77
  target: hyrax-engine-dev
59
- tags: samvera/hyrax-dev:latest,samvera/hyrax-dev:${{ github.sha }}
60
- outputs: type=docker,dest=/tmp/hyrax-dev-${{ github.sha }}.tar
78
+ push: true # ${{ github.event_name != 'pull_request' }}
79
+ tags: ${{ steps.image-meta.outputs.tags }}
80
+ labels: ${{ steps.image-meta.outputs.labels }}
81
+ outputs: type=docker,dest=${{runner.temp}}/hyrax-dev-${{ github.sha }}.tar
82
+ - name: Trigger Nurax Deployment
83
+ uses: peter-evans/repository-dispatch@v3
84
+ if: ${{ github.ref == 'refs/heads/main' }}
85
+ with:
86
+ token: ${{ secrets.NURAX_ACCESS_TOKEN }}
87
+ event-type: deploy
88
+ repository: samvera-labs/nurax
89
+ client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
61
90
  - name: Upload built image artifact
62
91
  uses: actions/upload-artifact@v4
63
92
  with:
64
93
  name: hyrax-dev
65
- path: /tmp/hyrax-dev-${{ github.sha }}.tar
94
+ path: ${{runner.temp}}/hyrax-dev-${{ github.sha }}.tar
66
95
 
67
96
  test:
68
97
  needs: build
@@ -86,10 +115,10 @@ jobs:
86
115
  uses: actions/download-artifact@v4
87
116
  with:
88
117
  name: hyrax-dev
89
- path: /tmp
118
+ path: ${{runner.temp}}
90
119
  - name: Start containers
91
120
  run: |
92
- docker load --input /tmp/hyrax-dev-${{ github.sha }}.tar
121
+ docker load --input ${{runner.temp}}/hyrax-dev-${{ github.sha }}.tar
93
122
  docker image ls -a
94
123
  docker compose -f docker-compose-${{ matrix.ci_test_app }}.yml up -d --quiet-pull --pull missing --no-build
95
124
  - name: RSpec
@@ -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
@@ -19,24 +19,28 @@ gem 'devise-guests', '~> 0.8'
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
- # Disabled due to dependency mismatches in Alpine packages (grpc 1.62.1 needs protobuf ~> 3.25)
23
- # if RUBY_PLATFORM =~ /musl/
22
+ if RUBY_PLATFORM =~ /musl/
23
+ # Disabled due to dependency mismatches in Alpine packages (grpc 1.62.1 needs protobuf ~> 3.25)
24
24
  # path '/usr/lib/ruby/gems/3.3.0' do
25
- # gem 'google-protobuf', '~> 3.24.4', force_ruby_platform: true
26
- # gem 'grpc', '~> 1.62.1', force_ruby_platform: true
25
+ gem 'google-protobuf', force_ruby_platform: true
26
+ gem 'grpc', force_ruby_platform: true
27
27
  # end
28
- # end
28
+ end
29
29
 
30
+ gem 'hydra-role-management'
30
31
  gemspec name: 'hyrax', path: ENV.fetch('HYRAX_ENGINE_PATH', '..')
31
32
  gem 'jbuilder', '~> 2.5'
32
33
  gem 'jquery-rails'
34
+ gem 'okcomputer'
33
35
  gem 'pg', '~> 1.3'
34
36
  gem 'puma'
37
+ gem 'rack-mini-profiler', require: ['prepend_net_http_patch']
35
38
  gem 'rails', '~> 7.2', '< 8.0'
36
39
  gem 'riiif', '~> 2.1'
37
40
  gem 'rsolr', '>= 1.0', '< 3'
38
41
  gem 'sass-rails', '~> 6.0'
39
- gem 'sidekiq', '~> 6.4'
42
+ gem 'sidekiq', '~> 7.0'
43
+ gem 'stackprof', require: false
40
44
  gem 'turbolinks', '~> 5'
41
45
  gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
42
46
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
@@ -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>
@@ -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
 
@@ -56,7 +56,7 @@ Rails.application.configure do
56
56
 
57
57
  # Use the lowest log level to ensure availability of diagnostic information
58
58
  # when problems arise.
59
- config.log_level = :debug
59
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", :debug).to_sym
60
60
 
61
61
  # Prepend all log lines with the following tags.
62
62
  config.log_tags = [ :request_id ]
@@ -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
  )
@@ -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)