Skip to content

Commit 2146793

Browse files
committed
Support MongoDB-based Snoty
1 parent 54d59e2 commit 2146793

File tree

11 files changed

+92
-60
lines changed

11 files changed

+92
-60
lines changed

backend/Chart.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
dependencies:
22
- name: common
33
repository: oci://registry-1.docker.io/bitnamicharts
4-
version: 2.19.2
5-
- name: postgresql
4+
version: 2.22.0
5+
- name: mongodb
66
repository: https://charts.bitnami.com/bitnami
7-
version: 15.2.7
7+
version: 15.6.22
88
- name: keycloak
99
repository: https://charts.bitnami.com/bitnami
10-
version: 21.1.0
11-
digest: sha256:ca11fe2fc2cc24913bcc633ca927e4b30a48870285a3c8ae95a140ce19b44d1e
12-
generated: "2024-04-30T19:14:29.317387727+02:00"
10+
version: 22.1.2
11+
digest: sha256:d12da76a8e37e2c842d48c0243765f275070a3b7d4876637280594aaa8d3035c
12+
generated: "2024-09-07T22:00:15.851075091+02:00"

backend/Chart.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: backend
3-
version: 0.1.1
3+
version: 0.2.0
44
description: Backend of the Snoty application suite
55
type: application
66
home: https://snoty.me
@@ -12,17 +12,17 @@ maintainers:
1212
1313
url: https://github.com/SIMULATAN
1414
icon: https://avatars.githubusercontent.com/u/163506575
15-
appVersion: "0.0.1-39"
15+
appVersion: "0.0.1-133"
1616
dependencies:
1717
- name: common
1818
version: 2.x.x
1919
repository: oci://registry-1.docker.io/bitnamicharts
20-
- name: postgresql
21-
version: ~15.2.5
20+
- name: mongodb
21+
version: ~15.6.19
2222
repository: https://charts.bitnami.com/bitnami
23-
condition: postgresql.deploy
23+
condition: mongodb.deploy
2424
- name: keycloak
25-
version: 21.1.0
25+
version: 22.1.2
2626
repository: https://charts.bitnami.com/bitnami
2727
condition: keycloak.deploy
2828

backend/charts/common-2.19.2.tgz

-15.3 KB
Binary file not shown.

backend/charts/common-2.22.0.tgz

15.8 KB
Binary file not shown.

backend/charts/keycloak-21.1.0.tgz

-127 KB
Binary file not shown.

backend/charts/keycloak-22.1.2.tgz

132 KB
Binary file not shown.

backend/charts/mongodb-15.6.22.tgz

92.9 KB
Binary file not shown.
-72.1 KB
Binary file not shown.

backend/templates/_config.tpl

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,53 @@
11
{{- define "snoty.baseConfig" -}}
22
{{- with $.Values.appConfig }}
33
environment: {{ .environment }}
4+
corsHosts:
5+
{{ range .corsHosts }}
6+
- {{ . | quote }}
7+
{{ end }}
8+
featureFlags:
9+
{{- toYaml .featureFlags | nindent 12 -}}
10+
{{- if and .featureFlags.flags (ne .featureFlags.type "InMemory") -}}
11+
{{- fail "Error: custom feature flag values are only supported when using the InMemory provider" -}}
12+
{{- end -}}
413
{{- end }}
514
{{- with $.Values.ingress }}
615
publicHost: {{ ternary "https" "http" .tls }}://{{ .hostname }}{{ .path }}
716
{{- end }}
8-
database:
9-
# if `appConfig.database` is set, it overrides the config from `postgresql`.
10-
{{- if and $.Values.postgresql.deploy (not (kindIs "map" $.Values.appConfig.database)) }}
11-
{{- with $.Values.postgresql }}
12-
username: {{ .auth.username }}
13-
password: {{ .auth.password }}
14-
jdbcUrl: jdbc:postgresql://{{ $.Release.Name }}-postgresql:{{ .primary.service.ports.postgresql | default 5432 }}/{{ .auth.database }}
17+
mongodb:
18+
# if `appConfig.mongodb` is set, it overrides the config from `mongodb`.
19+
{{- if and $.Values.mongodb.deploy (not (kindIs "map" $.Values.appConfig.mongodb)) }}
20+
{{- with $.Values.mongodb }}
21+
{{- if .auth.existingSecret }}
22+
connection:
23+
type: Split
24+
srv: {{ eq .architecture "replicaset" }}
25+
host: {{ .service.nameOverride }}.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}
26+
port: {{ .service.ports.mongodb }}
27+
database: {{ index .auth.databases 0 }}
28+
additionalOptions: tls={{ .tls.enabled }}&ssl={{ .tls.enabled }}
29+
authentication:
30+
username: {{ index .auth.usernames 0 }}
31+
authDatabase: {{ index .auth.databases 0 }}
32+
# password is loaded from existingSecret
33+
{{- else }}
34+
connection:
35+
# does not support architecture=replicaset, prefer using externalSecret
36+
type: ConnectionString
37+
connectionString: mongodb://{{ index .auth.usernames 0 }}:{{ index .auth.passwords 0 }}@{{ $.Release.Name }}-mongodb/{{ index .auth.databases 0 }}
1538
{{- end }}
16-
{{- else }}
17-
{{- with $.Values.appConfig.database }}
18-
{{- if kindIs "string" .username }}
19-
username: {{ .username }}
20-
{{- end }}
21-
{{- if kindIs "string" .password }}
22-
password: {{ .password }}
2339
{{- end }}
24-
{{- if kindIs "string" .jdbcUrl }}
25-
jdbcUrl: {{ .jdbcUrl }}
40+
{{- else }}
41+
{{- with $.Values.appConfig.mongodb }}
42+
{{- if kindIs "string" .connectionString }}
43+
connectionString: {{ .connectionString }}
2644
{{- end }}
2745
{{- end }}
2846
{{- end }}
2947
authentication:
3048
{{- if $.Values.keycloak.deploy }}
3149
{{- with $.Values.keycloak }}
32-
serverUrl: {{ ternary "https" "http" .ingress.tls }}://{{ .ingress.hostname }}/{{ trimPrefix "/" ($.Values.appConfig.authentication.path | default .ingress.path) }}
50+
serverUrl: {{ ternary "https" "http" .ingress.tls }}://{{ .ingress.hostname }}/{{ trimPrefix "/" (($.Values.appConfig.authentication).path | default .ingress.path) }}
3351
clientId: {{ $.Values.appConfig.authentication.clientId }}
3452
clientSecret: {{ $.Values.appConfig.authentication.clientSecret }}
3553
{{- end }}
@@ -38,6 +56,9 @@
3856
{{- if kindIs "string" .serverUrl }}
3957
serverUrl: {{ .serverUrl }}/{{ trimPrefix "/" (.path | default "") }}
4058
{{- end }}
59+
{{- if kindIs "string" .issuerUrl }}
60+
issuerUrl: {{ .issuerUrl }}{{ trimSuffix "/" (.path | default "") }}
61+
{{- end }}
4162
{{- if kindIs "string" .clientId }}
4263
clientId: {{ .clientId }}
4364
{{- end }}

backend/templates/deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ spec:
3535
{{- include "common.tplvalues.render" (dict "value" .Values.extraContainerPorts "context" $) | nindent 12 }}
3636
{{- end }}
3737
env:
38+
- name: mongodb.authentication.password
39+
valueFrom:
40+
secretKeyRef:
41+
name: {{ .Values.mongodb.auth.existingSecret }}
42+
key: mongodb-passwords
3843
{{- $envLoaders := include "snoty.envLoaders" . | nindent 8 | trim }}
3944
{{- if $envLoaders }}
4045
{{ $envLoaders }}

0 commit comments

Comments
 (0)