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.
- checksums.yaml +4 -4
- data/.dassie/.env +4 -0
- data/.dassie/Gemfile +15 -11
- data/.dassie/app/controllers/application_controller.rb +4 -0
- data/.dassie/app/helpers/hyrax_helper.rb +4 -0
- data/.dassie/app/models/ability.rb +4 -0
- data/.dassie/app/models/user.rb +11 -0
- data/.dassie/app/views/shared/_footer.html.erb +17 -0
- data/.dassie/bin/rails +0 -5
- data/.dassie/bin/rake +0 -5
- data/.dassie/config/application.rb +2 -1
- data/.dassie/config/database.yml +18 -0
- data/.dassie/config/environments/development.rb +1 -1
- data/.dassie/config/environments/production.rb +5 -3
- data/.dassie/config/environments/test.rb +1 -1
- data/.dassie/config/fedora.yml +6 -6
- data/.dassie/config/initializers/profiler.rb +5 -0
- data/.dassie/config/initializers/riiif.rb +20 -18
- data/.dassie/config/locales/hyrax.en.yml +1 -1
- data/.dassie/config/puma.rb +55 -5
- data/.dassie/config/routes.rb +2 -0
- data/.dassie/db/migrate/20250328100249_user_roles.rb +20 -0
- data/.dassie/db/schema.rb +122 -110
- data/.github/workflows/lint-build-test.yml +35 -6
- data/.github/workflows/main.yml +4 -4
- data/.koppie/.env +1 -1
- data/.koppie/Gemfile +13 -10
- data/.koppie/app/controllers/application_controller.rb +4 -0
- data/.koppie/app/helpers/hyrax_helper.rb +4 -0
- data/.koppie/app/models/ability.rb +4 -0
- data/.koppie/app/models/user.rb +10 -0
- data/.koppie/app/views/shared/_footer.html.erb +17 -0
- data/.koppie/bin/rails +0 -5
- data/.koppie/bin/rake +0 -5
- data/.koppie/config/application.rb +2 -1
- data/.koppie/config/database.yml +2 -9
- data/.koppie/config/environments/development.rb +10 -1
- data/.koppie/config/environments/production.rb +5 -3
- data/.koppie/config/environments/test.rb +1 -1
- data/.koppie/config/initializers/1_valkyrie.rb +5 -5
- data/.koppie/config/initializers/hyrax.rb +20 -17
- data/.koppie/config/initializers/profiler.rb +5 -0
- data/.koppie/config/initializers/riiif.rb +21 -18
- data/.koppie/config/locales/hyrax.en.yml +2 -2
- data/.koppie/config/puma.rb +26 -7
- data/.koppie/config/routes.rb +2 -0
- data/.koppie/db/schema.rb +109 -110
- data/Dockerfile +110 -51
- data/app/actors/hyrax/actors/add_to_work_actor.rb +1 -1
- data/app/actors/hyrax/actors/apply_order_actor.rb +1 -1
- data/app/assets/stylesheets/hyrax/_tinymce.scss +6 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +1 -0
- data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +4 -4
- data/app/controllers/hyrax/api/zotero_controller.rb +1 -1
- data/app/controllers/hyrax/file_sets_controller.rb +11 -0
- data/app/jobs/batch_create_job.rb +2 -2
- data/app/models/admin_set.rb +2 -2
- data/app/models/concerns/hyrax/permissions/writable.rb +1 -2
- data/app/models/concerns/hyrax/valkyrie_lazy_migration.rb +1 -0
- data/app/models/hyrax/collection_type.rb +4 -4
- data/app/models/single_use_link.rb +1 -1
- data/app/services/hyrax/listeners.rb +1 -0
- data/app/services/hyrax/statistics/term_query.rb +1 -1
- data/app/services/hyrax/user_stat_importer.rb +1 -1
- data/app/services/hyrax/workflow.rb +8 -0
- data/app/validators/hyrax/has_one_title_validator.rb +1 -1
- data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +1 -1
- data/bin/db-migrate-seed.sh +1 -1
- data/bin/dev-entrypoint.sh +3 -0
- data/config/initializers/1_healthz.rb +2 -1
- data/config/initializers/ar_test_fixture_monkey_patch.rb +8 -0
- data/config/initializers/arel_rails_7_2_monkey_patch.rb +6 -0
- data/config/initializers/listeners.rb +4 -2
- data/config/initializers/new_framework_defaults_7_2.rb +8 -0
- data/docker-compose-dassie.yml +2 -2
- data/docker-compose-koppie.yml +2 -2
- data/docker-compose-sirenia.yml +3 -3
- data/documentation/developing-your-hyrax-based-app.md +6 -6
- data/hyrax.gemspec +9 -9
- data/lib/generators/hyrax/config_generator.rb +0 -5
- data/lib/generators/hyrax/install_generator.rb +1 -6
- data/lib/generators/hyrax/templates/.env +1 -1
- data/lib/generators/hyrax/templates/config/initializers/1_valkyrie.rb +21 -19
- data/lib/generators/hyrax/templates/config/initializers/riiif.rb +21 -19
- data/lib/generators/hyrax/templates/db/migrate/20170131142607_add_permission_template_to_sipity_workflow.rb.erb +1 -1
- data/lib/generators/hyrax/templates/db/migrate/20170810190549_update_collection_type_column_options.rb.erb +1 -1
- data/lib/generators/hyrax/templates/db/migrate/20230821153635_add_fields_to_counter_metric.rb.erb +1 -1
- data/lib/hyrax/configuration.rb +1 -0
- data/lib/hyrax/controlled_vocabulary/importer/language.rb +1 -1
- data/lib/hyrax/engine.rb +15 -10
- data/lib/hyrax/version.rb +1 -1
- data/lib/hyrax.rb +4 -0
- data/lib/tasks/workflow.rake +1 -2
- data/template.rb +6 -1
- metadata +49 -44
- data/.dassie/bin/spring +0 -17
- data/.dassie/config/initializers/mini_magick.rb +0 -6
- data/.dassie/config/spring.rb +0 -6
- data/.koppie/bin/spring +0 -17
- data/.koppie/config/initializers/mini_magick.rb +0 -6
- data/.koppie/config/spring.rb +0 -6
- data/config/initializers/reform_rails_6_1_monkey_patch.rb +0 -27
- data/lib/generators/hyrax/templates/config/initializers/mini_magick.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddbf266b8b67364db933bf1b60129204b7f9055c3ff396d36bbfd5ba0a752868
|
4
|
+
data.tar.gz: a0f8fca6c5cfb7213ffaf321be7930e80a2a974ee4b33b5c8b3cc3ab24816409
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
@@ -18,27 +18,35 @@ 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
|
+
|
22
|
+
|
21
23
|
if RUBY_PLATFORM =~ /musl/
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
# # Disabled due to dependency mismatches in Alpine packages (grpc 1.62.1 needs protobuf ~> 3.25)
|
25
|
+
# path '/usr/lib/ruby/gems/3.3.0' do
|
26
|
+
gem 'google-protobuf', force_ruby_platform: true
|
27
|
+
gem 'grpc', force_ruby_platform: true
|
28
|
+
# end
|
26
29
|
end
|
27
30
|
|
31
|
+
gem 'hydra-role-management'
|
28
32
|
gemspec name: 'hyrax', path: ENV.fetch('HYRAX_ENGINE_PATH', '..')
|
29
33
|
gem 'jbuilder', '~> 2.5'
|
30
34
|
gem 'jquery-rails'
|
35
|
+
gem 'okcomputer'
|
31
36
|
gem 'pg', '~> 1.3'
|
32
37
|
gem 'puma'
|
33
|
-
gem '
|
38
|
+
gem 'rack-mini-profiler', require: ['prepend_net_http_patch']
|
39
|
+
gem 'rails', '~> 7.2', '< 8.0'
|
34
40
|
gem 'riiif', '~> 2.1'
|
35
41
|
gem 'rsolr', '>= 1.0', '< 3'
|
36
42
|
gem 'sass-rails', '~> 6.0'
|
37
|
-
gem 'sidekiq', '~>
|
43
|
+
gem 'sidekiq', '~> 7.0'
|
44
|
+
gem 'stackprof', require: false
|
38
45
|
gem 'turbolinks', '~> 5'
|
39
46
|
gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
|
40
47
|
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
41
48
|
gem 'uglifier', '>= 1.3.0'
|
49
|
+
gem 'activerecord-nulldb-adapter', '~> 1.1'
|
42
50
|
|
43
51
|
group :development do
|
44
52
|
gem 'better_errors' # add command line in browser when errors
|
@@ -46,10 +54,6 @@ group :development do
|
|
46
54
|
|
47
55
|
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
48
56
|
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
57
|
end
|
54
58
|
|
55
59
|
group :development, :test do
|
@@ -57,4 +61,4 @@ group :development, :test do
|
|
57
61
|
gem 'pry-doc'
|
58
62
|
gem 'pry-rails'
|
59
63
|
gem 'pry-rescue'
|
60
|
-
end
|
64
|
+
end
|
data/.dassie/app/models/user.rb
CHANGED
@@ -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>
|
data/.dassie/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/.dassie/bin/rake
CHANGED
@@ -9,7 +9,8 @@ Bundler.require(*Rails.groups)
|
|
9
9
|
module Dassie
|
10
10
|
class Application < Rails::Application
|
11
11
|
# Initialize configuration defaults for originally generated Rails version.
|
12
|
-
config.load_defaults
|
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
|
@@ -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
|
@@ -65,7 +65,7 @@ Rails.application.configure do
|
|
65
65
|
config.assets.prefix = '/dev-assets'
|
66
66
|
|
67
67
|
# Raises error for missing translations
|
68
|
-
config.
|
68
|
+
config.i18n.raise_on_missing_translations = true
|
69
69
|
|
70
70
|
# Use an evented file watcher to asynchronously detect changes in source code,
|
71
71
|
# routes, locales, etc. This feature depends on the listen gem.
|
@@ -23,8 +23,10 @@ Rails.application.configure do
|
|
23
23
|
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
24
24
|
|
25
25
|
# Compress JavaScripts and CSS.
|
26
|
-
config.assets.
|
27
|
-
|
26
|
+
config.assets.configure do |env|
|
27
|
+
env.js_compressor = :uglifier
|
28
|
+
# env.css_compressor = :sass
|
29
|
+
end
|
28
30
|
|
29
31
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
32
|
config.assets.compile = false
|
@@ -51,7 +53,7 @@ Rails.application.configure do
|
|
51
53
|
|
52
54
|
# Use the lowest log level to ensure availability of diagnostic information
|
53
55
|
# when problems arise.
|
54
|
-
config.log_level = :debug
|
56
|
+
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", :debug).to_sym
|
55
57
|
|
56
58
|
# Prepend all log lines with the following tags.
|
57
59
|
config.log_tags = [ :request_id ]
|
data/.dassie/config/fedora.yml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
development:
|
2
2
|
user: fedoraAdmin
|
3
3
|
password: fedoraAdmin
|
4
|
-
url:
|
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:
|
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:
|
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' %>
|
@@ -35,29 +35,31 @@ end
|
|
35
35
|
module Hyrax
|
36
36
|
# Adds file locking to Riiif::File
|
37
37
|
# @see RiiifFileResolver
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
58
|
+
private
|
58
59
|
|
59
|
-
|
60
|
-
|
60
|
+
def logger
|
61
|
+
Hyrax.logger
|
62
|
+
end
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
@@ -50,7 +50,7 @@ en:
|
|
50
50
|
directory:
|
51
51
|
suffix: "@example.org"
|
52
52
|
footer:
|
53
|
-
copyright_html: "<strong>Copyright ©
|
53
|
+
copyright_html: "<strong>Copyright © %{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
|
data/.dassie/config/puma.rb
CHANGED
@@ -1,6 +1,56 @@
|
|
1
|
-
|
2
|
-
threads
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
data/.dassie/config/routes.rb
CHANGED
@@ -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
|