Skip to content

Commit bcd14f9

Browse files
committed
feat(backend): support SQL config & JVM debugging using jdwp
1 parent 0430f02 commit bcd14f9

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

backend/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: backend
3-
version: 0.4.3
3+
version: 0.5.0
44
description: Backend of the Snoty application suite
55
type: application
66
home: https://snoty.me

backend/templates/_config.tpl

+30-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@
7676
{{- end }}
7777

7878
{{- define "snoty.envLoaders" -}}
79-
{{- if kindIs "map" .Values.mongodb.auth }}
79+
- name: JAVA_TOOL_OPTIONS
80+
value: >
81+
{{ if .Values.appConfig.jvmDebug.enabled -}}
82+
'-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend={{ .Values.appConfig.jvmDebug.suspend | ternary "y" "n" }}'
83+
{{ end }}
84+
85+
{{ if kindIs "map" .Values.mongodb.auth }}
8086
{{- with .Values.mongodb.auth -}}
8187
{{- if .existingSecret -}}
8288
- name: mongodb.authentication.password
@@ -104,5 +110,28 @@
104110
key: {{ .clientSecret.secretKey | default "clientSecret" }}
105111
{{- end -}}
106112
{{- end -}}
113+
{{- with .sql -}}
114+
{{- if kindIs "map" .username }}
115+
- name: sql.username
116+
valueFrom:
117+
secretKeyRef:
118+
name: {{ .username.secretName }}
119+
key: {{ .username.secretKey | default "username" }}
120+
{{- end -}}
121+
{{- if kindIs "map" .password }}
122+
- name: sql.password
123+
valueFrom:
124+
secretKeyRef:
125+
name: {{ .password.secretName }}
126+
key: {{ .password.secretKey | default "password" }}
127+
{{- end -}}
128+
{{- if kindIs "map" .jdbcUrl }}
129+
- name: sql.jdbcUrl
130+
valueFrom:
131+
secretKeyRef:
132+
name: {{ .jdbcUrl.secretName }}
133+
key: {{ .jdbcUrl.secretKey | default "jdbcUrl" }}
134+
{{- end -}}
135+
{{- end -}}
107136
{{- end -}}
108137
{{- end -}}

backend/templates/deployment.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
initContainers:
2727
{{- if .Values.download.integrations }}
2828
- name: download-integrations
29-
image: alpine:3.20
29+
image: alpine:3.21
3030
volumeMounts:
3131
- name: scripts
3232
mountPath: /scripts
@@ -41,6 +41,10 @@ spec:
4141
- name: {{ include "common.names.fullname" . }}
4242
image: {{ template "snoty.image" . }}
4343
ports:
44+
{{ if .Values.appConfig.jvmDebug.enabled -}}
45+
- name: jdwp
46+
containerPort: 8000
47+
{{- end }}
4448
- name: api
4549
containerPort: {{ .Values.containerPorts.api }}
4650
- name: monitoring

backend/values.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,20 @@ service:
117117
replicas: 1
118118

119119
appConfig:
120+
jvmDebug:
121+
enabled: false
122+
suspend: true
120123
environment: PRODUCTION
121124
corsHosts:
122125
- '*'
123126
featureFlags:
124127
type: InMemory
125128
## @param appConfig.database mongodb configuration
126129
## @param appConfig.mongodb.connectionString mongodb connection string
130+
## @param appConfig.sql SQL configuration
131+
## @param appConfig.sql.jdbcUrl JDBC connection url
132+
## @param appConfig.sql.username SQL DB username
133+
## @param appConfig.sql.password SQL DB password
127134
## @param extraAppConfig Add your own settings, to be added to the `configuration.yml`
128135
extraAppConfig: {}
129136

0 commit comments

Comments
 (0)