hyrax 3.0.0 → 3.0.1
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/config/initializers/riiif.rb +22 -20
- data/.dassie/package.json +3 -5
- data/Dockerfile +34 -14
- data/app/controllers/hyrax/dashboard/collections_controller.rb +2 -4
- data/app/forms/hyrax/forms/collection_form.rb +5 -3
- data/app/indexers/hyrax/valkyrie_indexer.rb +2 -1
- data/app/presenters/hyrax/collection_presenter.rb +10 -14
- data/app/services/hyrax/listeners.rb +2 -0
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +26 -0
- data/app/services/hyrax/listeners/object_lifecycle_listener.rb +1 -1
- data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +17 -0
- data/app/services/hyrax/persist_derivatives.rb +3 -1
- data/app/services/hyrax/thumbnail_path_service.rb +1 -1
- data/app/services/hyrax/visibility_propagator.rb +30 -1
- data/app/views/hyrax/collections/show.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +1 -1
- data/app/views/hyrax/file_sets/_actions.html.erb +10 -0
- data/chart/hyrax/Chart.yaml +2 -2
- data/chart/hyrax/templates/_helpers.tpl +8 -0
- data/chart/hyrax/templates/branding-pvc.yaml +14 -0
- data/chart/hyrax/templates/configmap-env.yaml +8 -1
- data/chart/hyrax/templates/deployment-worker.yaml +92 -0
- data/chart/hyrax/templates/deployment.yaml +42 -0
- data/chart/hyrax/templates/derivatives-pvc.yaml +14 -0
- data/chart/hyrax/templates/secrets.yaml +1 -0
- data/chart/hyrax/templates/uploads-pvc.yaml +14 -0
- data/chart/hyrax/values.yaml +31 -0
- data/config/features.rb +47 -43
- data/config/initializers/listeners.rb +2 -0
- data/documentation/developing-your-hyrax-based-app.md +4 -4
- data/documentation/legacyREADME.md +4 -4
- data/lib/generators/hyrax/templates/config/initializers/riiif.rb +22 -20
- data/lib/hyrax/configuration.rb +8 -0
- data/lib/hyrax/engine.rb +1 -1
- data/lib/hyrax/valkyrie_can_can_adapter.rb +2 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/wings/converter_value_mapper.rb +2 -2
- data/lib/wings/valkyrie/persister.rb +7 -5
- data/lib/wings/valkyrie/query_service.rb +60 -17
- data/template.rb +1 -1
- metadata +8 -2
@@ -13,15 +13,22 @@ data:
|
|
13
13
|
{{- if .Values.memcached.enabled }}
|
14
14
|
MEMCACHED_HOST: {{ template "hyrax.memcached.fullname" . }}
|
15
15
|
{{- end }}
|
16
|
+
{{- if .Values.derivativesVolume.enabled }}
|
17
|
+
HYRAX_BRANDING_PATH: "/app/samvera/branding"
|
18
|
+
HYRAX_DERIVATIVES_PATH: "/app/samvera/derivatives"
|
19
|
+
HYRAX_CACHE_PATH: "/app/samvera/file_cache"
|
20
|
+
HYRAX_UPLOAD_PATH: "/app/samvera/uploads"
|
21
|
+
{{- end }}
|
16
22
|
RACK_ENV: production
|
17
23
|
RAILS_ENV: production
|
18
24
|
{{- if .Values.redis.enabled }}
|
19
|
-
REDIS_HOST: {{ template "hyrax.redis.
|
25
|
+
REDIS_HOST: {{ template "hyrax.redis.host" . }}
|
20
26
|
{{- end }}
|
21
27
|
FCREPO_BASE_PATH: {{ .Values.fcrepoBasePathOverride | default (printf "/%s" (include "hyrax.fullname" .)) | quote }}
|
22
28
|
FCREPO_HOST: {{ template "hyrax.fcrepo.host" . }}
|
23
29
|
FCREPO_PORT: {{ .Values.fcrepo.servicePort | default 8080 | quote }}
|
24
30
|
FCREPO_REST_PATH: {{ .Values.fcrepo.restPath | default "rest" }}
|
31
|
+
REDIS_PROVIDER: SIDEKIQ_REDIS_URL
|
25
32
|
SOLR_ADMIN_USER: {{ template "hyrax.solr.username" . }}
|
26
33
|
SOLR_ADMIN_PASSWORD: {{ template "hyrax.solr.password" . }}
|
27
34
|
SOLR_COLLECTION_NAME: {{ template "hyrax.solr.collectionName" . }}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
apiVersion: apps/v1
|
2
|
+
kind: Deployment
|
3
|
+
metadata:
|
4
|
+
name: {{ include "hyrax.fullname" . }}-worker
|
5
|
+
labels:
|
6
|
+
{{- include "hyrax.labels" . | nindent 4 }}
|
7
|
+
spec:
|
8
|
+
replicas: {{ .Values.worker.replicaCount }}
|
9
|
+
selector:
|
10
|
+
matchLabels:
|
11
|
+
{{- include "hyrax.selectorLabels" . | nindent 6 }}
|
12
|
+
template:
|
13
|
+
metadata:
|
14
|
+
{{- with .Values.podAnnotations }}
|
15
|
+
annotations:
|
16
|
+
{{- toYaml . | nindent 8 }}
|
17
|
+
{{- end }}
|
18
|
+
labels:
|
19
|
+
{{- include "hyrax.selectorLabels" . | nindent 8 }}
|
20
|
+
spec:
|
21
|
+
initContainers:
|
22
|
+
- name: db-wait
|
23
|
+
image: "{{ .Values.worker.image.repository }}:{{ .Values.worker.image.tag | default .Chart.AppVersion }}"
|
24
|
+
imagePullPolicy: {{ .Values.worker.image.pullPolicy }}
|
25
|
+
envFrom:
|
26
|
+
- configMapRef:
|
27
|
+
name: {{ include "hyrax.fullname" . }}-env
|
28
|
+
- secretRef:
|
29
|
+
name: {{ template "hyrax.fullname" . }}
|
30
|
+
command:
|
31
|
+
- sh
|
32
|
+
- -c
|
33
|
+
- db-wait.sh "$DB_HOST:$DB_PORT"
|
34
|
+
- db-wait.sh "$FCREPO_HOST:$FCREPO_PORT"
|
35
|
+
- db-wait.sh "$SOLR_HOST:$SOLR_PORT"
|
36
|
+
serviceAccountName: {{ include "hyrax.serviceAccountName" . }}
|
37
|
+
securityContext:
|
38
|
+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
39
|
+
containers:
|
40
|
+
- name: {{ .Chart.Name }}-worker
|
41
|
+
image: "{{ .Values.worker.image.repository }}:{{ .Values.worker.image.tag | default .Chart.AppVersion }}"
|
42
|
+
imagePullPolicy: {{ .Values.worker.image.pullPolicy }}
|
43
|
+
envFrom:
|
44
|
+
- configMapRef:
|
45
|
+
name: {{ include "hyrax.fullname" . }}-env
|
46
|
+
- secretRef:
|
47
|
+
name: {{ template "hyrax.fullname" . }}
|
48
|
+
volumeMounts:
|
49
|
+
- name: derivatives
|
50
|
+
mountPath: /app/samvera/derivatives
|
51
|
+
- name: uploads
|
52
|
+
subPath: file_cache
|
53
|
+
mountPath: /app/samvera/file_cache
|
54
|
+
- name: uploads
|
55
|
+
subPath: uploads
|
56
|
+
mountPath: /app/samvera/uploads
|
57
|
+
resources:
|
58
|
+
{{- toYaml .Values.worker.resources | nindent 12 }}
|
59
|
+
volumes:
|
60
|
+
- name: "derivatives"
|
61
|
+
{{- if and .Values.derivativesVolume.enabled .Values.derivativesVolume.existingClaim }}
|
62
|
+
persistentVolumeClaim:
|
63
|
+
claimName: {{ .Values.derivativesVolume.existingClaim }}
|
64
|
+
{{- else if .Values.derivativesVolume.enabled }}
|
65
|
+
persistentVolumeClaim:
|
66
|
+
claimName: {{ template "hyrax.fullname" . }}-derivatives
|
67
|
+
{{ else }}
|
68
|
+
emptyDir: {}
|
69
|
+
{{ end }}
|
70
|
+
- name: "uploads"
|
71
|
+
{{- if and .Values.uploadsVolume.enabled .Values.uploadsVolume.existingClaim }}
|
72
|
+
persistentVolumeClaim:
|
73
|
+
claimName: {{ .Values.uploadsVolume.existingClaim }}
|
74
|
+
{{- else if .Values.uploadsVolume.enabled }}
|
75
|
+
persistentVolumeClaim:
|
76
|
+
claimName: {{ template "hyrax.fullname" . }}-uploads
|
77
|
+
{{ else }}
|
78
|
+
emptyDir: {}
|
79
|
+
{{ end }}
|
80
|
+
|
81
|
+
{{- with .Values.worker.nodeSelector }}
|
82
|
+
nodeSelector:
|
83
|
+
{{- toYaml . | nindent 8 }}
|
84
|
+
{{- end }}
|
85
|
+
{{- with .Values.worker.affinity }}
|
86
|
+
affinity:
|
87
|
+
{{- toYaml . | nindent 8 }}
|
88
|
+
{{- end }}
|
89
|
+
{{- with .Values.worker.tolerations }}
|
90
|
+
tolerations:
|
91
|
+
{{- toYaml . | nindent 8 }}
|
92
|
+
{{- end }}
|
@@ -95,8 +95,50 @@ spec:
|
|
95
95
|
path: {{ .Values.readinessProbe.path | default "/" }}
|
96
96
|
port: 3000
|
97
97
|
{{- end }}
|
98
|
+
volumeMounts:
|
99
|
+
- name: branding
|
100
|
+
mountPath: /app/samvera/branding
|
101
|
+
- name: derivatives
|
102
|
+
mountPath: /app/samvera/derivatives
|
103
|
+
- name: uploads
|
104
|
+
subPath: file_cache
|
105
|
+
mountPath: /app/samvera/file_cache
|
106
|
+
- name: uploads
|
107
|
+
subPath: uploads
|
108
|
+
mountPath: /app/samvera/uploads
|
98
109
|
resources:
|
99
110
|
{{- toYaml .Values.resources | nindent 12 }}
|
111
|
+
volumes:
|
112
|
+
- name: "branding"
|
113
|
+
{{- if and .Values.brandingVolume.enabled .Values.brandingVolume.existingClaim }}
|
114
|
+
persistentVolumeClaim:
|
115
|
+
claimName: {{ .Values.brandingVolume.existingClaim }}
|
116
|
+
{{- else if .Values.brandingVolume.enabled }}
|
117
|
+
persistentVolumeClaim:
|
118
|
+
claimName: {{ template "hyrax.fullname" . }}-branding
|
119
|
+
{{ else }}
|
120
|
+
emptyDir: {}
|
121
|
+
{{ end }}
|
122
|
+
- name: "derivatives"
|
123
|
+
{{- if and .Values.derivativesVolume.enabled .Values.derivativesVolume.existingClaim }}
|
124
|
+
persistentVolumeClaim:
|
125
|
+
claimName: {{ .Values.derivativesVolume.existingClaim }}
|
126
|
+
{{- else if .Values.derivativesVolume.enabled }}
|
127
|
+
persistentVolumeClaim:
|
128
|
+
claimName: {{ template "hyrax.fullname" . }}-derivatives
|
129
|
+
{{ else }}
|
130
|
+
emptyDir: {}
|
131
|
+
{{ end }}
|
132
|
+
- name: "uploads"
|
133
|
+
{{- if and .Values.uploadsVolume.enabled .Values.uploadsVolume.existingClaim }}
|
134
|
+
persistentVolumeClaim:
|
135
|
+
claimName: {{ .Values.uploadsVolume.existingClaim }}
|
136
|
+
{{- else if .Values.uploadsVolume.enabled }}
|
137
|
+
persistentVolumeClaim:
|
138
|
+
claimName: {{ template "hyrax.fullname" . }}-uploads
|
139
|
+
{{ else }}
|
140
|
+
emptyDir: {}
|
141
|
+
{{ end }}
|
100
142
|
{{- with .Values.nodeSelector }}
|
101
143
|
nodeSelector:
|
102
144
|
{{- toYaml . | nindent 8 }}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{{- if and .Values.derivativesVolume.enabled (not .Values.derivativesVolume.existingClaim) }}
|
2
|
+
apiVersion: v1
|
3
|
+
kind: PersistentVolumeClaim
|
4
|
+
metadata:
|
5
|
+
name: {{ template "hyrax.fullname" . }}-derivatives
|
6
|
+
labels:
|
7
|
+
{{- include "hyrax.labels" . | nindent 4 }}
|
8
|
+
spec:
|
9
|
+
accessModes:
|
10
|
+
- ReadWriteMany
|
11
|
+
resources:
|
12
|
+
requests:
|
13
|
+
storage: {{ .Values.derivativesVolume.size }}
|
14
|
+
{{- end }}
|
@@ -10,4 +10,5 @@ data:
|
|
10
10
|
DATABASE_URL: {{ printf "postgresql://%s:%s@%s/%s?pool=5" ( include "hyrax.postgresql.username" . ) ( include "hyrax.postgresql.password" . ) ( include "hyrax.postgresql.host" . ) ( include "hyrax.postgresql.database" . ) | b64enc }}
|
11
11
|
{{- if .Values.redis.enabled }}
|
12
12
|
REDIS_PASSWORD: {{ .Values.redis.password | b64enc}}
|
13
|
+
SIDEKIQ_REDIS_URL: {{ include "hyrax.redis.url" . | b64enc }}
|
13
14
|
{{- end }}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{{- if and .Values.uploadsVolume.enabled (not .Values.uploadsVolume.existingClaim) }}
|
2
|
+
apiVersion: v1
|
3
|
+
kind: PersistentVolumeClaim
|
4
|
+
metadata:
|
5
|
+
name: {{ template "hyrax.fullname" . }}-uploads
|
6
|
+
labels:
|
7
|
+
{{- include "hyrax.labels" . | nindent 4 }}
|
8
|
+
spec:
|
9
|
+
accessModes:
|
10
|
+
- ReadWriteMany
|
11
|
+
resources:
|
12
|
+
requests:
|
13
|
+
storage: {{ .Values.uploadsVolume.size }}
|
14
|
+
{{- end }}
|
data/chart/hyrax/values.yaml
CHANGED
@@ -19,6 +19,24 @@ externalSolrUser: ""
|
|
19
19
|
externalSolrPassword: ""
|
20
20
|
externalSolrCollection: "hyrax"
|
21
21
|
|
22
|
+
brandingVolume:
|
23
|
+
enabled: true
|
24
|
+
existingClaim: ""
|
25
|
+
size: 2Gi
|
26
|
+
storageClass: ""
|
27
|
+
|
28
|
+
derivativesVolume:
|
29
|
+
enabled: true
|
30
|
+
existingClaim: ""
|
31
|
+
size: 10Gi
|
32
|
+
storageClass: ""
|
33
|
+
|
34
|
+
uploadsVolume:
|
35
|
+
enabled: true
|
36
|
+
existingClaim: ""
|
37
|
+
size: 20Gi
|
38
|
+
storageClass: ""
|
39
|
+
|
22
40
|
# configuration for an external/existing fcrepo service;
|
23
41
|
# ignored if `fcrepo.enabled` is true
|
24
42
|
externalFcrepoHost: ""
|
@@ -98,6 +116,19 @@ readinessProbe:
|
|
98
116
|
|
99
117
|
resources: {}
|
100
118
|
|
119
|
+
worker:
|
120
|
+
replicaCount: 3
|
121
|
+
image:
|
122
|
+
repository: samveralabs/dassie-worker
|
123
|
+
pullPolicy: IfNotPresent
|
124
|
+
tag: ""
|
125
|
+
imagePullSecrets: []
|
126
|
+
podSecurityContext: {}
|
127
|
+
nodeSelector: {}
|
128
|
+
tolerations: []
|
129
|
+
affinity: {}
|
130
|
+
resources: {}
|
131
|
+
|
101
132
|
fcrepo:
|
102
133
|
enabled: true
|
103
134
|
externalDatabaseUsername: "hyrax"
|
data/config/features.rb
CHANGED
@@ -1,46 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
Flipflop.configure do
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
3
|
+
begin
|
4
|
+
# Strategies will be used in the order listed here.
|
5
|
+
strategy :cookie
|
6
|
+
strategy :active_record, class: Hyrax::Feature
|
7
|
+
strategy Hyrax::Strategies::YamlStrategy, config: Hyrax.config.feature_config_path
|
8
|
+
strategy :default
|
9
|
+
|
10
|
+
feature :proxy_deposit,
|
11
|
+
default: true,
|
12
|
+
description: "Depositors may designate proxies to deposit works on their behalf"
|
13
|
+
|
14
|
+
feature :transfer_works,
|
15
|
+
default: true,
|
16
|
+
description: "Depositors may transfer their works to another user"
|
17
|
+
|
18
|
+
# Note, if this is deactivated, a default admin set will be created and all
|
19
|
+
# works will be assigned to it when they are created.
|
20
|
+
feature :assign_admin_set,
|
21
|
+
default: true,
|
22
|
+
description: "Ability to assign uploaded items to an admin set"
|
23
|
+
|
24
|
+
feature :show_deposit_agreement,
|
25
|
+
default: true,
|
26
|
+
description: "Show a deposit agreement to users creating works"
|
27
|
+
|
28
|
+
feature :active_deposit_agreement_acceptance,
|
29
|
+
default: Hyrax.config.active_deposit_agreement_acceptance?,
|
30
|
+
description: "Require an active acceptance of the deposit agreement by checking a checkbox"
|
31
|
+
|
32
|
+
feature :batch_upload,
|
33
|
+
default: false,
|
34
|
+
description: "Enable uploading batches of works"
|
35
|
+
|
36
|
+
feature :hide_private_items,
|
37
|
+
default: false,
|
38
|
+
description: "Do not show the private items."
|
39
|
+
|
40
|
+
feature :hide_users_list,
|
41
|
+
default: true,
|
42
|
+
description: "Do not show users list unless user has authenticated."
|
43
|
+
|
44
|
+
feature :cache_work_iiif_manifest,
|
45
|
+
default: false,
|
46
|
+
description: "Use Rails.cache to cache the JSON document for IIIF manifests"
|
47
|
+
rescue Flipflop::StrategyError, Flipflop::FeatureError => err
|
48
|
+
Rails.logger.warn "Ignoring #{err}: #{err.message}"
|
49
|
+
end
|
46
50
|
end
|
@@ -2,12 +2,14 @@
|
|
2
2
|
|
3
3
|
Hyrax.publisher.subscribe(Hyrax::Listeners::AclIndexListener.new)
|
4
4
|
Hyrax.publisher.subscribe(Hyrax::Listeners::ActiveFedoraAclIndexListener.new)
|
5
|
+
Hyrax.publisher.subscribe(Hyrax::Listeners::MemberCleanupListener.new)
|
5
6
|
Hyrax.publisher.subscribe(Hyrax::Listeners::MetadataIndexListener.new)
|
6
7
|
Hyrax.publisher.subscribe(Hyrax::Listeners::BatchNotificationListener.new)
|
7
8
|
Hyrax.publisher.subscribe(Hyrax::Listeners::ObjectLifecycleListener.new)
|
8
9
|
Hyrax.publisher.subscribe(Hyrax::Listeners::FileSetLifecycleListener.new)
|
9
10
|
Hyrax.publisher.subscribe(Hyrax::Listeners::FileSetLifecycleNotificationListener.new)
|
10
11
|
Hyrax.publisher.subscribe(Hyrax::Listeners::ProxyDepositListener.new)
|
12
|
+
Hyrax.publisher.subscribe(Hyrax::Listeners::TrophyCleanupListener.new)
|
11
13
|
Hyrax.publisher.subscribe(Hyrax::Listeners::WorkflowListener.new)
|
12
14
|
|
13
15
|
# Publish events from old style Hyrax::Callbacks to trigger the listeners
|
@@ -30,7 +30,7 @@ A Hyrax-based application includes lots of dependencies. We provide a [Docker im
|
|
30
30
|
You can also try [Running Hyrax-based application in local VM](https://github.com/samvera/hyrax/wiki/Hyrax-Development-Guide#running-hyrax-based-application-in-local-vm) which uses Ubuntu.
|
31
31
|
|
32
32
|
This document contains instructions specific to setting up an app with __Hyrax
|
33
|
-
v3.0.
|
33
|
+
v3.0.1__. If you are looking for instructions on installing a different
|
34
34
|
version, be sure to select the appropriate branch or tag from the drop-down
|
35
35
|
menu above.
|
36
36
|
|
@@ -105,11 +105,11 @@ Starting up Redis will depend on your operating system, and may in fact already
|
|
105
105
|
|
106
106
|
## Rails
|
107
107
|
|
108
|
-
Hyrax requires Rails 5. We recommend the latest Rails 5.2 release.
|
108
|
+
Hyrax requires Rails 5. We recommend the latest Rails 5.2.5 release.
|
109
109
|
|
110
110
|
```
|
111
111
|
# If you don't already have Rails at your disposal...
|
112
|
-
gem install rails -v 5.2.
|
112
|
+
gem install rails -v 5.2.5
|
113
113
|
```
|
114
114
|
|
115
115
|
### JavaScript runtime
|
@@ -125,7 +125,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
|
|
125
125
|
Generate a new Rails application using the template.
|
126
126
|
|
127
127
|
```
|
128
|
-
rails _5.2.
|
128
|
+
rails _5.2.5_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v3.0.1/template.rb
|
129
129
|
```
|
130
130
|
|
131
131
|
Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
|
@@ -50,7 +50,7 @@ The Samvera community is here to help. Please see our [support guide](./.github/
|
|
50
50
|
# Getting started
|
51
51
|
|
52
52
|
This document contains instructions specific to setting up an app with __Hyrax
|
53
|
-
v3.0.
|
53
|
+
v3.0.1__. If you are looking for instructions on installing a different
|
54
54
|
version, be sure to select the appropriate branch or tag from the drop-down
|
55
55
|
menu above.
|
56
56
|
|
@@ -139,11 +139,11 @@ Starting up Redis will depend on your operating system, and may in fact already
|
|
139
139
|
|
140
140
|
## Rails
|
141
141
|
|
142
|
-
Hyrax requires Rails 5. We recommend the latest Rails 5.2 release.
|
142
|
+
Hyrax requires Rails 5. We recommend the latest Rails 5.2.5 release.
|
143
143
|
|
144
144
|
```
|
145
145
|
# If you don't already have Rails at your disposal...
|
146
|
-
gem install rails -v 5.2.
|
146
|
+
gem install rails -v 5.2.5
|
147
147
|
```
|
148
148
|
|
149
149
|
### JavaScript runtime
|
@@ -159,7 +159,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
|
|
159
159
|
Generate a new Rails application using the template.
|
160
160
|
|
161
161
|
```
|
162
|
-
rails _5.2.
|
162
|
+
rails _5.2.5_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v3.0.1/template.rb
|
163
163
|
```
|
164
164
|
|
165
165
|
Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
|
@@ -1,27 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Riiif::Image.
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
ActiveSupport::Reloader.to_prepare do
|
3
|
+
Riiif::Image.file_resolver = Riiif::HttpFileResolver.new
|
4
|
+
Riiif::Image.info_service = lambda do |id, _file|
|
5
|
+
# id will look like a path to a pcdm:file
|
6
|
+
# (e.g. rv042t299%2Ffiles%2F6d71677a-4f80-42f1-ae58-ed1063fd79c7)
|
7
|
+
# but we just want the id for the FileSet it's attached to.
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
9
|
+
# Capture everything before the first slash
|
10
|
+
fs_id = id.sub(/\A([^\/]*)\/.*/, '\1')
|
11
|
+
resp = Hyrax::SolrService.get("id:#{fs_id}")
|
12
|
+
doc = resp['response']['docs'].first
|
13
|
+
raise "Unable to find solr document with id:#{fs_id}" unless doc
|
14
|
+
{ height: doc['height_is'], width: doc['width_is'], format: doc['mime_type_ssi'], channels: doc['alpha_channels_ssi'] }
|
15
|
+
end
|
15
16
|
|
16
|
-
Riiif::Image.file_resolver.id_to_uri = lambda do |id|
|
17
|
-
|
18
|
-
|
17
|
+
Riiif::Image.file_resolver.id_to_uri = lambda do |id|
|
18
|
+
Hyrax::Base.id_to_uri(CGI.unescape(id)).tap do |url|
|
19
|
+
Rails.logger.info "Riiif resolved #{id} to #{url}"
|
20
|
+
end
|
19
21
|
end
|
20
|
-
end
|
21
22
|
|
22
|
-
Riiif::Image.authorization_service = Hyrax::IIIFAuthorizationService
|
23
|
+
Riiif::Image.authorization_service = Hyrax::IIIFAuthorizationService
|
23
24
|
|
24
|
-
Riiif.not_found_image = Rails.root.join('app', 'assets', 'images', 'us_404.svg')
|
25
|
-
Riiif.unauthorized_image = Rails.root.join('app', 'assets', 'images', 'us_404.svg')
|
25
|
+
Riiif.not_found_image = Rails.root.join('app', 'assets', 'images', 'us_404.svg')
|
26
|
+
Riiif.unauthorized_image = Rails.root.join('app', 'assets', 'images', 'us_404.svg')
|
26
27
|
|
27
|
-
Riiif::Engine.config.cache_duration = 365.days
|
28
|
+
Riiif::Engine.config.cache_duration = 365.days
|
29
|
+
end
|