Skip to content

Commit

Permalink
Merge pull request #10 from nfdi4health/feat/dataverse6-1
Browse files Browse the repository at this point in the history
feat(k8s.dataverse): Upgrade to dataverse 6.1
  • Loading branch information
vera authored Mar 6, 2024
2 parents 1bce2f8 + ee0c85c commit 553e5fa
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 48 deletions.
4 changes: 2 additions & 2 deletions k8s/dataverse/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.3.4
version: 0.3.6

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "5.13.0"
appVersion: "6.1.0"
23 changes: 2 additions & 21 deletions k8s/dataverse/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
# Install dataverse
`helm install my-dataverse ./dataverse`

# Access dataverse via localhost port forwarding
`export DATAVERSE_POD="my-dataverse-dataverse-0"`

`kubectl port-forward pods/${DATAVERSE_POD} 8080:8080`
# Configure custom schema
## Update SOLR fields with custom metadata info
The charts persona contains a valid solr schema which is used by default.
If you alter a MDS block you manually need to refresh the solr core.
### Login into the solr helper container and execute the update
`export SOLR_POD="my-dataverse-dataverse-solr-0"`

`kubectl exec -i -t $SOLR_POD --container dataverse-solr-config -- /bin/sh`

`curl "http://${DATAVERSE_HOSTNAME}:8080/api/admin/index/solr/schema" | /scripts/update-fields.sh /template/conf/schema.xml`

`cp /template/conf/schema.xml /var/solr/data/collection1/schema.xml `

`curl "http://localhost:8983/solr/admin/cores?action=RELOAD&core=collection1"`

# Backup & Restore
## Restore database backup

Expand Down Expand Up @@ -74,8 +55,8 @@ Postgres is configured to automatically create and store a logical backup in S3.

7. Configure and sync postgres secrets with k8s.

The default postgres deployment creates at least three k8s secrets. Since you just loaded a backup they are out of sync.
Either those secrets must be updated with the values of the backup or the values within the db mut be updated.
The postgres deployment creates at least three k8s secrets. Since you just loaded a backup they (k8s secret) are out of sync.
Either those k8s secrets must be updated with the values from the just loaded backup or the database must be adapted to the values of the k8s secrets
We update the values within the db. First, we obtain list of accounts to update, then we obtain the passwords and update the db values.

Get the list of accounts:
Expand Down
2 changes: 1 addition & 1 deletion k8s/dataverse/persona/nfdi4health/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SELF_LOCATION=${BOOTSTRAP_DIR}/${PERSONA}/
echo "SELF_LOCATION"
echo $SELF_LOCATION

echo "Running dev setup-all.sh (INSECURE MODE)"
echo "Running base setup-all.sh (INSECURE MODE)"
"${BOOTSTRAP_DIR}"/base/setup-all.sh --insecure -p=admin1 | tee /tmp/setup-all.sh.out
API_TOKEN=$(grep apiToken "/tmp/setup-all.sh.out" | jq ".data.apiToken" | tr -d \")
export API_TOKEN
Expand Down
2 changes: 1 addition & 1 deletion k8s/dataverse/persona/nfdi4health/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
<!-- SCHEMA-FIELDS::BEGIN -->
<field name="accessToSources" type="text_en" multiValued="false" stored="true" indexed="true"/>
<field name="actionsToMinimizeLoss" type="text_en" multiValued="false" stored="true" indexed="true"/>
<field name="alternativeTitle" type="text_en" multiValued="false" stored="true" indexed="true"/>
<field name="alternativeTitle" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="alternativeURL" type="text_en" multiValued="false" stored="true" indexed="true"/>
<field name="astroFacility" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="astroInstrument" type="text_en" multiValued="true" stored="true" indexed="true"/>
Expand Down
21 changes: 16 additions & 5 deletions k8s/dataverse/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,32 @@ Thank you for installing {{ .Chart.Name }}.

Your release is named {{ .Release.Name }}.

Here are some tasks to perform :)
## Interact with the instance

## Enable admin api via localhost port forwarding
### Allow all API calls
`kubectl port-forward pods/{{ .Release.Name }}-dataverse-0 8080:8080`
Once the port forward is active you can interact with dataverse UI via http://localhost:8080 and via API.
API request are treated by dataverse as they originate from localhost.

`curl -X PUT -d allow http://localhost:8080/api/admin/settings/:BlockedApiPolicy`

## Update SOLR fields with custom metadata info
Login into the solr helper container and execute the update
The `schema.xml` file within the persona nfdi4health contains adaptions for the included custom metadata blocks.
This means SOLR is configured for the personal out of the box! Once you alter a metadata blocks via the API,
the change must be manually adapted to the solr configuration. The following snippet will walk you through the task:

Connect to the solr helper container, and open a remote shell:
`kubectl exec -i -t {{ .Release.Name }}-dataverse-solr-0 --container dataverse-solr-config -- /bin/sh`

In the shell you can invoke the following commands:

Depending on your change it may be necessary to drop the complete index. You can use this call.
`curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/collection1/update?commit=true' -d '{ "delete": {"query":"*:*"} }'`

Obtains the schema from dataverse and apply it to the default solr template
`curl "http://${DATAVERSE_HOSTNAME}:8080/api/admin/index/solr/schema" | /scripts/update-fields.sh /template/conf/schema.xml`

Copies the schema into the core
`cp /template/conf/schema.xml /var/solr/data/collection1/schema.xml`

Tell SOLR to reload the configuration.
`curl "http://localhost:8983/solr/admin/cores?action=RELOAD&core=collection1"`

6 changes: 3 additions & 3 deletions k8s/dataverse/templates/dataverse-baker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app.kubernetes.io/name: dataverse
app.kubernetes.io/instance: dataverse-{{ .Release.Name }}
app.kubernetes.io/version: "5.13"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: bootstrap
app.kubernetes.io/part-of: dataverse
annotations:
Expand All @@ -18,12 +18,12 @@ spec:
labels:
app.kubernetes.io/name: dataverse
app.kubernetes.io/instance: dataverse-{{ .Release.Name }}
app.kubernetes.io/version: "5.13"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: bootstrap
app.kubernetes.io/part-of: dataverse
spec:
containers:
- image: gdcc/configbaker:alpha
- image: {{ .Values.images.configbaker}}
name: dataverse-configbaker
command: [ "bootstrap.sh", "-u", "http://{{ .Release.Name }}-dataverse-svc:8080","nfdi4health" ]
env:
Expand Down
10 changes: 5 additions & 5 deletions k8s/dataverse/templates/dataverse-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app.kubernetes.io/name: dataverse
app.kubernetes.io/instance: dataverse-{{ .Release.Name }}
app.kubernetes.io/version: "5.13"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: dataverse
app.kubernetes.io/part-of: dataverse
spec:
Expand All @@ -25,7 +25,7 @@ spec:
selector:
app.kubernetes.io/name: dataverse
app.kubernetes.io/instance: dataverse-{{ .Release.Name }}
app.kubernetes.io/version: "5.13"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: dataverse
app.kubernetes.io/part-of: dataverse
---
Expand All @@ -36,7 +36,7 @@ metadata:
labels:
app.kubernetes.io/name: dataverse
app.kubernetes.io/instance: dataverse-{{ .Release.Name }}
app.kubernetes.io/version: "5.13"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: dataverse
app.kubernetes.io/part-of: dataverse
spec:
Expand All @@ -45,15 +45,15 @@ spec:
matchLabels:
app.kubernetes.io/name: dataverse
app.kubernetes.io/instance: dataverse-{{ .Release.Name }}
app.kubernetes.io/version: "5.13"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: dataverse
app.kubernetes.io/part-of: dataverse
template:
metadata:
labels:
app.kubernetes.io/name: dataverse
app.kubernetes.io/instance: dataverse-{{ .Release.Name }}
app.kubernetes.io/version: "5.13"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: dataverse
app.kubernetes.io/part-of: dataverse
spec:
Expand Down
2 changes: 1 addition & 1 deletion k8s/dataverse/templates/solr-config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app.kubernetes.io/name: solr
app.kubernetes.io/instance: solr-{{ .Release.Name }}
app.kubernetes.io/version: "8.11.2"
app.kubernetes.io/version: "9.5.0"
app.kubernetes.io/component: solr
app.kubernetes.io/part-of: dataverse
data:
Expand Down
16 changes: 8 additions & 8 deletions k8s/dataverse/templates/solr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
selector:
app.kubernetes.io/name: solr
app.kubernetes.io/instance: solr-{{ .Release.Name }}
app.kubernetes.io/version: "8.11.2"
app.kubernetes.io/version: "9.5.0"
app.kubernetes.io/component: solr
app.kubernetes.io/part-of: dataverse
---
Expand All @@ -21,7 +21,7 @@ metadata:
labels:
app.kubernetes.io/name: solr
app.kubernetes.io/instance: solr-{{ .Release.Name }}
app.kubernetes.io/version: "8.11.2"
app.kubernetes.io/version: "9.5.0"
app.kubernetes.io/component: solr
app.kubernetes.io/part-of: dataverse
spec:
Expand All @@ -38,7 +38,7 @@ metadata:
labels:
app.kubernetes.io/name: solr
app.kubernetes.io/instance: solr-{{ .Release.Name }}
app.kubernetes.io/version: "8.11.2"
app.kubernetes.io/version: "9.5.0"
app.kubernetes.io/component: solr
app.kubernetes.io/part-of: dataverse
spec:
Expand All @@ -55,7 +55,7 @@ metadata:
labels:
app.kubernetes.io/name: solr
app.kubernetes.io/instance: solr-{{ .Release.Name }}
app.kubernetes.io/version: "8.11.2"
app.kubernetes.io/version: "9.5.0"
app.kubernetes.io/component: solr
app.kubernetes.io/part-of: dataverse
spec:
Expand All @@ -64,22 +64,22 @@ spec:
matchLabels:
app.kubernetes.io/name: solr
app.kubernetes.io/instance: solr-{{ .Release.Name }}
app.kubernetes.io/version: "8.11.2"
app.kubernetes.io/version: "9.5.0"
app.kubernetes.io/component: solr
app.kubernetes.io/part-of: dataverse
template:
metadata:
labels:
app.kubernetes.io/name: solr
app.kubernetes.io/instance: solr-{{ .Release.Name }}
app.kubernetes.io/version: "8.11.2"
app.kubernetes.io/version: "9.5.0"
app.kubernetes.io/component: solr
app.kubernetes.io/part-of: dataverse
spec:
securityContext:
fsGroup: 8983
containers:
- image: gdcc/configbaker:unstable
- image: {{.Values.images.configbaker}}
name: dataverse-solr-config
env:
- name: DATAVERSE_SOLR_HOST
Expand All @@ -97,7 +97,7 @@ spec:
- mountPath: /schema/
name: cfgmap
- name: solr
image: solr:8.11.2
image: solr:9.5.0
command: [ "/bin/bash", "-c" ]
args: [ "sleep 30; precreate-core collection1 /solr-template; solr-foreground -Djetty.host=0.0.0.0" ]
env:
Expand Down
3 changes: 2 additions & 1 deletion k8s/dataverse/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ dataverse:
requests:
memory: "500Mi"
images:
backend: gitlab.zbmed.de:5050/km/nfdi4health/registersearch/dataverse:a8a721be01ff4953061f1eb00337ef187bcf5c4f
backend: gdcc/dataverse:alpha
configbaker: gdcc/configbaker:alpha

0 comments on commit 553e5fa

Please sign in to comment.