Skip to content

Commit

Permalink
[sophora-server]: postgres support (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-schoener authored Jun 13, 2023
1 parent dc00f48 commit 0989441
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 14 deletions.
4 changes: 2 additions & 2 deletions charts/sophora-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ 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: 1.1.1
version: 1.2.0

# 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.
appVersion: 4.16.0
appVersion: 4.16.3
8 changes: 7 additions & 1 deletion charts/sophora-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ The required secrets must be present before you install the server.

Starting with Sophora 5 the archive repository is no longer available.
To disable all archive related storage options, set `sophora.server.persistence.archiveType` to `none`.
In later chart versions this will be the default.
In later chart versions this will be the default.

## Postgres connection

Starting with Sophora 5 the installation requires postgres.
You can provide the credentials via a secret: `sophora.server.persistence.postgres.secret`.
For all other configuration options use `sophora.server.properties`.

## Tips for productive installations

Expand Down
7 changes: 7 additions & 0 deletions charts/sophora-server/templates/sophora-init-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ data:
sophora.remote.api.external.protocol=https
{{- end }}
{{- if .Values.sophora.server.persistence.postgres.secret.name }}
# postgres authentication
sophora.persistence.postgres.username=${SOPHORA_PERSISTENCE_POSTGRES_USERNAME}
sophora.persistence.postgres.password=${SOPHORA_PERSISTENCE_POSTGRES_PASSWORD}
{{- end }}
# custom config
{{- toString (required "A valid sophora.properties configuration needs to be provided." .Values.sophora.server.properties) | nindent 4 }}
Expand Down
14 changes: 14 additions & 0 deletions charts/sophora-server/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ spec:
- name: EXTERNAL_HOSTS
value: {{ range $i, $ingress := .Values.clusterReplication.ingresses }}{{ if $ingress.hosts }}{{ (index $ingress.hosts 0).host }} {{ end }}{{ end }}
{{- end }}
{{- if .Values.sophora.server.persistence.postgres.secret.name }}
- name: SOPHORA_PERSISTENCE_POSTGRES_USERNAME
valueFrom:
secretKeyRef:
key: {{ .Values.sophora.server.persistence.postgres.secret.usernameKey }}
name: {{ .Values.sophora.server.persistence.postgres.secret.name }}
optional: false
- name: SOPHORA_PERSISTENCE_POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
key: {{ .Values.sophora.server.persistence.postgres.secret.passwordKey }}
name: {{ .Values.sophora.server.persistence.postgres.secret.name }}
optional: false
{{- end }}
{{ if .Values.configInitializer.env -}}
{{- toYaml .Values.configInitializer.env | nindent 12 }}
{{- end }}
Expand Down
13 changes: 6 additions & 7 deletions charts/sophora-server/test-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@ sophora:
storage: 200Gi
persistence:
repositoryType: mysql
archiveType: mysql
archiveType: none
mysql:
repositories:
- secretName: repository-secret01
hostnameKey: new-hostname
- secretName: repository-secret02
- secretName: repository-secret03
archives:
- secretName: archive-secret01
- secretName: archive-secret02
- secretName: archive-secret03
postgres:
secret:
name: postgres-auth
usernameKey: user1
passwordKey: pass1
binaryStore:
s3:
secret:
Expand Down
16 changes: 12 additions & 4 deletions charts/sophora-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ sophora:
## usernameKey:
## passwordKey:
archives: []

## @param sophora.server.persistence.postgres postgres authentication via secret. Required for Sophora Server >5.0.0.
postgres:
secret:
name:
usernameKey: username
passwordKey: password

binaryStore:
s3:
secret:
Expand All @@ -199,10 +207,10 @@ sophora:
accessKeyIdKey: accessKeyId

authentication:
secret:
name:
usernameKey: username
passwordKey: password
secret:
name:
usernameKey: username
passwordKey: password

# Additional environment variables can be defined here
env:
Expand Down

0 comments on commit 0989441

Please sign in to comment.