Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/self-hosting/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ TRIGGER_IMAGE_TAG=v4.5.0

We patch the latest released version line only, so keep an eye on new releases to receive security fixes. See [Security & vulnerability reporting](/self-hosting/security).

You can also lock the versions of the bundled services, for example with `CLICKHOUSE_IMAGE_TAG`. If you do, or if you bring your own ClickHouse via `CLICKHOUSE_URL`, note that Trigger.dev requires ClickHouse 25.8 or newer.

<Note>
Trigger.dev 4.5.0 is the last version we officially support for running v3 (SDK v3) tasks. If
you still have v3 tasks, pin `TRIGGER_IMAGE_TAG` to exactly `v4.5.0` or [migrate to
Expand Down
14 changes: 12 additions & 2 deletions docs/self-hosting/kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,24 @@ redis:

#### ClickHouse

<Note>Trigger.dev requires ClickHouse 25.8 or newer.</Note>

<Note>
When upgrading from a chart version that bundled ClickHouse via the Bitnami subchart, the chart
automatically adopts the existing data volume, so no manual migration is needed. If you render
manifests without cluster access (for example with GitOps tools that use `helm template`), set
`clickhouse.persistence.existingClaim` to the old PVC name
(`data-<release>-clickhouse-shard0-0`) to keep your data.
</Note>

**Direct configuration:**

```yaml
clickhouse:
deploy: false
external:
host: "my-clickhouse.example.com"
port: 8123
httpPort: 8123
username: "my-username"
password: "my-password"
```
Expand All @@ -276,7 +286,7 @@ clickhouse:
deploy: false
external:
host: "my-clickhouse.example.com"
port: 8123
httpPort: 8123
username: "my-username"
existingSecret: "clickhouse-credentials"
# existingSecretKey: "clickhouse-password" # default (optional)
Expand Down
2 changes: 1 addition & 1 deletion hosting/docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ OBJECT_STORE_SECRET_ACCESS_KEY=very-safe-password
# POSTGRES_IMAGE_TAG=14
# REDIS_IMAGE_TAG=7
# ELECTRIC_IMAGE_TAG=1.0.13
# CLICKHOUSE_IMAGE_TAG=latest
# CLICKHOUSE_IMAGE_TAG=26.2
# REGISTRY_IMAGE_TAG=2
# MINIO_IMAGE_TAG=latest
# DOCKER_PROXY_IMAGE_TAG=latest
Expand Down
17 changes: 17 additions & 0 deletions hosting/docker/clickhouse/data-paths.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
Keeps ClickHouse's on-disk layout compatible with data volumes created by
the previous Bitnami-based setup, which stored everything under a data/
subdirectory of the volume. Fresh installs get the same layout. tmp lives
outside data/ because old volumes contain a dangling tmp symlink there.
-->
<clickhouse>
<path>/var/lib/clickhouse/data/</path>
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
<user_files_path>/var/lib/clickhouse/data/user_files/</user_files_path>
<format_schema_path>/var/lib/clickhouse/data/format_schemas/</format_schema_path>
<user_directories>
<local_directory>
<path>/var/lib/clickhouse/data/access/</path>
</local_directory>
</user_directories>
</clickhouse>
18 changes: 13 additions & 5 deletions hosting/docker/webapp/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,26 @@ services:
start_period: 10s

clickhouse:
image: bitnamilegacy/clickhouse:${CLICKHOUSE_IMAGE_TAG:-latest}
image: clickhouse/clickhouse-server:${CLICKHOUSE_IMAGE_TAG:-26.2}
restart: ${RESTART_POLICY:-unless-stopped}
logging: *logging-config
ports:
- ${CLICKHOUSE_PUBLISH_IP:-127.0.0.1}:9123:8123
- ${CLICKHOUSE_PUBLISH_IP:-127.0.0.1}:9090:9000
ulimits:
nofile:
soft: 262144
hard: 262144
environment:
CLICKHOUSE_ADMIN_USER: ${CLICKHOUSE_USER:-default}
CLICKHOUSE_ADMIN_PASSWORD: ${CLICKHOUSE_PASSWORD:-password}
CLICKHOUSE_USER: ${CLICKHOUSE_USER:-default}
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-password}
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
volumes:
- clickhouse:/bitnami/clickhouse
- ../clickhouse/override.xml:/bitnami/clickhouse/etc/config.d/override.xml:ro
# The same volume works across upgrades from the previous Bitnami-based
# setup: data-paths.xml keeps the on-disk layout compatible.
- clickhouse:/var/lib/clickhouse
- ../clickhouse/data-paths.xml:/etc/clickhouse-server/config.d/data-paths.xml:ro
- ../clickhouse/override.xml:/etc/clickhouse-server/config.d/override.xml:ro
Comment on lines 157 to +177

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# 1. Verify override.xml exists at the expected path
fd -t f "override.xml" hosting/docker/

# 2. Search for volume migration documentation in docs
rg -i -n "clickhouse.*migrat|migrat.*clickhouse|clickhouse.*volume|volume.*clickhouse" docs/ || echo "No migration docs found — verify this is documented elsewhere"

# 3. Check for any remaining references to the old 'clickhouse' volume name
rg -n "^\s*clickhouse:" hosting/docker/webapp/docker-compose.yml || echo "Old volume name not found (good)"

Repository: triggerdotdev/trigger.dev

Length of output: 1037


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Search for clickhouse-data / volume migration guidance =="
rg -n -i "clickhouse-data|clickhouse volume|volume migration|migrat.*clickhouse|clickhouse.*migrat|clickhouse.*data volume|data volume.*clickhouse" docs hosting/docker || true

echo
echo "== Relevant section of docs/self-hosting/docker.mdx =="
sed -n '340,430p' docs/self-hosting/docker.mdx

Repository: triggerdotdev/trigger.dev

Length of output: 4728


Document the ClickHouse volume migration

Renaming the named volume from clickhouse to clickhouse-data will leave existing installs pointing at a fresh empty volume on upgrade. Add migration steps for docs/self-hosting/docker.mdx so users can carry over their existing ClickHouse data.

networks:
- webapp
healthcheck:
Expand Down
7 changes: 2 additions & 5 deletions hosting/k8s/helm/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ dependencies:
- name: redis
repository: oci://registry-1.docker.io/bitnamicharts
version: 21.2.6
- name: clickhouse
repository: oci://registry-1.docker.io/bitnamicharts
version: 9.4.4
- name: minio
repository: oci://registry-1.docker.io/bitnamicharts
version: 17.0.9
digest: sha256:e1b572ab8eca0cc376311398c27b1734d8a598095fccc81dd9c32b2c8b9c1149
generated: "2026-05-05T10:31:58.493590751+01:00"
digest: sha256:a735954c8b78fcf5b30689bdcdfed66b9be57135368ea696aff2b52ecd731474
generated: "2026-07-13T16:36:15.800113+01:00"
4 changes: 0 additions & 4 deletions hosting/k8s/helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ dependencies:
version: "21.2.6"
repository: "oci://registry-1.docker.io/bitnamicharts"
condition: redis.deploy
- name: clickhouse
version: "9.4.4"
repository: "oci://registry-1.docker.io/bitnamicharts"
condition: clickhouse.deploy
- name: minio
Comment on lines -29 to 33

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Bitnami ClickHouse subchart removal is a major Helm upgrade event

Removing the bitnami clickhouse dependency from Chart.yaml and replacing it with a custom StatefulSet means that on helm upgrade, Helm will delete all resources previously managed by the bitnami subchart (StatefulSet, Service, ConfigMaps, etc.) and create new ones from the custom template. The PVC naming convention differs between bitnami (typically data-{release}-clickhouse-shard0-0) and the new template (data-{fullname}-clickhouse-0). Existing PVCs won't be automatically reused. Users with EVENT_REPOSITORY_DEFAULT_STORE=clickhouse_v2 enabled will lose historical run event data unless they manually migrate. The persistence.retain: false default means PVCs won't even get the helm.sh/resource-policy: keep annotation.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

version: "17.0.9"
repository: "oci://registry-1.docker.io/bitnamicharts"
Expand Down
6 changes: 3 additions & 3 deletions hosting/k8s/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ ClickHouse hostname
{{- if .Values.clickhouse.host }}
{{- .Values.clickhouse.host }}
{{- else if .Values.clickhouse.deploy }}
{{- printf "%s-clickhouse" .Release.Name }}
{{- printf "%s-clickhouse" (include "trigger-v4.fullname" .) }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Helm hostname helper changed from Release.Name to fullname — naming shift for existing releases

The ClickHouse hostname helper (hosting/k8s/helm/templates/_helpers.tpl:418) changed from printf "%s-clickhouse" .Release.Name to printf "%s-clickhouse" (include "trigger-v4.fullname" .). For the common case where the release name is trigger (same as chart name), fullname returns just the release name, so behavior is unchanged. However, if someone installed with a different release name (e.g., helm install my-app ...), the old helper would produce my-app-clickhouse while the new one produces my-app-trigger-clickhouse. Since the bitnami subchart is being removed entirely and replaced with the custom StatefulSet (which also uses fullname), the helper and the actual service name are now consistent with each other — this is correct. But existing releases with non-default names will see the ClickHouse URL change, potentially breaking connectivity until the new StatefulSet is ready.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

{{- end }}
{{- end }}

Expand All @@ -439,7 +439,7 @@ hex-encoded password or percent-encode before storing in the Secret.
{{- if .Values.clickhouse.deploy -}}
{{- $protocol := ternary "https" "http" .Values.clickhouse.secure -}}
{{- $secure := ternary "true" "false" .Values.clickhouse.secure -}}
{{ $protocol }}://{{ .Values.clickhouse.auth.username }}:{{ .Values.clickhouse.auth.password }}@{{ include "trigger-v4.clickhouse.hostname" . }}:8123?secure={{ $secure }}
{{ $protocol }}://{{ .Values.clickhouse.auth.username }}:{{ .Values.clickhouse.auth.password }}@{{ include "trigger-v4.clickhouse.hostname" . }}:{{ .Values.clickhouse.service.ports.http }}?secure={{ $secure }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the Helm version and Chart.yaml apiVersion
fd -t f 'Chart.yaml' hosting/k8s/helm --exec cat {}
 \;
# Also verify urlquery is a recognized built-in by rendering a test template
helm version --short 2>/dev/null || echo "Helm not installed in sandbox"

Repository: triggerdotdev/trigger.dev

Length of output: 1011


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the ClickHouse URL helper blocks around the referenced lines.
file="hosting/k8s/helm/templates/_helpers.tpl"
wc -l "$file"
sed -n '420,485p' "$file"

# Locate all ClickHouse URL constructions in this file.
rg -n 'clickhouse\.(url|replication\.url|auth|external)' "$file"

Repository: triggerdotdev/trigger.dev

Length of output: 5830


🌐 Web query:

Helm template built-in function urlquery Go text/template Helm docs

💡 Result:

The urlquery function in Helm is a built-in template function derived from the Go text/template package [1][2]. It is used to escape a string so that it is suitable for embedding within the query portion of a URL [3][4][1]. When used in a Helm template, it functions as follows: - Purpose: It returns the escaped version of the provided argument, ensuring special characters are encoded correctly for URL query parameters [3][4]. - Usage: It can be used as a function or in a pipeline [3][4]. For example: $var:= urlquery "string for query" or {{.Values.myParam | urlquery }} This function is native to the underlying Go template engine [1][2]. Note that in Go, the equivalent function is often referred to as URLQueryEscaper, but it is exposed in templates as urlquery [1][2]. This function is available in text/template but is generally unavailable in html/template due to security considerations regarding automatic context-aware escaping [1][2].

Citations:


URL-encode the ClickHouse credentials in these URL helpers. The deploy and external branches interpolate usernames/passwords directly into the URL userinfo, so reserved characters like @, /, ?, or # can break ClickHouse connectivity. Apply | urlquery to the literal username/password values in both trigger-v4.clickhouse.url and trigger-v4.clickhouse.replication.url; keep $(CLICKHOUSE_PASSWORD) unchanged in the existing-secret branches.

{{- else if .Values.clickhouse.external.host -}}
{{- $protocol := ternary "https" "http" .Values.clickhouse.external.secure -}}
{{- $secure := ternary "true" "false" .Values.clickhouse.external.secure -}}
Expand All @@ -460,7 +460,7 @@ applies to the replication URL.
{{- define "trigger-v4.clickhouse.replication.url" -}}
{{- if .Values.clickhouse.deploy -}}
{{- $protocol := ternary "https" "http" .Values.clickhouse.secure -}}
{{ $protocol }}://{{ .Values.clickhouse.auth.username }}:{{ .Values.clickhouse.auth.password }}@{{ include "trigger-v4.clickhouse.hostname" . }}:8123
{{ $protocol }}://{{ .Values.clickhouse.auth.username }}:{{ .Values.clickhouse.auth.password }}@{{ include "trigger-v4.clickhouse.hostname" . }}:{{ .Values.clickhouse.service.ports.http }}
{{- else if .Values.clickhouse.external.host -}}
{{- $protocol := ternary "https" "http" .Values.clickhouse.external.secure -}}
{{- if .Values.clickhouse.external.existingSecret -}}
Expand Down
199 changes: 199 additions & 0 deletions hosting/k8s/helm/templates/clickhouse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
{{- if .Values.clickhouse.deploy }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "trigger-v4.fullname" . }}-clickhouse-config
labels:
{{- $component := "clickhouse" }}
{{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
data:
{{- if not (hasKey .Values.clickhouse.configdFiles "data-paths.xml") }}
{{- /* Keeps the on-disk layout compatible with data volumes created by the
Bitnami subchart this chart used previously, which stored everything
under a data/ subdirectory of the volume. Fresh installs get the same
layout. tmp lives outside data/ because old volumes contain a
dangling tmp symlink there. */}}
data-paths.xml: |
<clickhouse>
<path>/var/lib/clickhouse/data/</path>
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
<user_files_path>/var/lib/clickhouse/data/user_files/</user_files_path>
<format_schema_path>/var/lib/clickhouse/data/format_schemas/</format_schema_path>
<user_directories>
<local_directory>
<path>/var/lib/clickhouse/data/access/</path>
</local_directory>
</user_directories>
</clickhouse>
{{- end }}
{{- range $filename, $content := .Values.clickhouse.configdFiles }}
{{ $filename }}: |
{{- $content | nindent 4 }}
{{- end }}
---
{{- /* Reuse an existing data PVC instead of creating one via
volumeClaimTemplates. Set explicitly through persistence.existingClaim,
or detected automatically: upgrades from chart versions that bundled
the Bitnami subchart leave their PVC behind under the old name, and
adopting it preserves all ClickHouse data with no manual migration.
(lookup returns nothing during template/dry-run rendering; set
persistence.existingClaim explicitly when pre-rendering manifests,
e.g. with GitOps tools.) */}}
{{- $existingClaim := .Values.clickhouse.persistence.existingClaim }}
{{- if and (not $existingClaim) .Values.clickhouse.persistence.enabled }}
{{- $legacyName := printf "data-%s-clickhouse-shard0-0" .Release.Name }}
{{- if lookup "v1" "PersistentVolumeClaim" .Release.Namespace $legacyName }}
{{- $existingClaim = $legacyName }}
{{- end }}
{{- end }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "trigger-v4.fullname" . }}-clickhouse
labels:
{{- $component := "clickhouse" }}
{{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
spec:
replicas: 1
serviceName: {{ include "trigger-v4.fullname" . }}-clickhouse
selector:
matchLabels:
{{- include "trigger-v4.componentSelectorLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ .Values.clickhouse.configdFiles | toYaml | sha256sum }}
{{- with .Values.clickhouse.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "trigger-v4.componentSelectorLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 8 }}
spec:
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.clickhouse.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: clickhouse
{{- with .Values.clickhouse.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.global.imageRegistry | default .Values.clickhouse.image.registry }}/{{ .Values.clickhouse.image.repository }}:{{ .Values.clickhouse.image.tag }}{{ with .Values.clickhouse.image.digest }}@{{ . }}{{ end }}"
imagePullPolicy: {{ .Values.clickhouse.image.pullPolicy }}
env:
- name: CLICKHOUSE_USER
value: {{ .Values.clickhouse.auth.username | quote }}
- name: CLICKHOUSE_PASSWORD
value: {{ .Values.clickhouse.auth.password | quote }}
Comment on lines +89 to +92

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

ClickHouse password is stored as a plaintext environment variable.

The password from .Values.clickhouse.auth.password is passed directly via value, making it visible in the StatefulSet manifest (kubectl describe pod) and in etcd. Using a Kubernetes Secret with valueFrom.secretKeyRef would keep it out of the pod spec while remaining compatible with the official ClickHouse image's CLICKHOUSE_PASSWORD env var.

🔒 Suggested refactor: use a Secret for the ClickHouse password

Add a conditional Secret resource (or support an existing one) and reference it in the env section:

 env:
   - name: CLICKHOUSE_USER
     value: {{ .Values.clickhouse.auth.username | quote }}
   - name: CLICKHOUSE_PASSWORD
-    value: {{ .Values.clickhouse.auth.password | quote }}
+    {{- if .Values.clickhouse.auth.existingSecret }}
+    valueFrom:
+      secretKeyRef:
+        name: {{ .Values.clickhouse.auth.existingSecret }}
+        key: password
+    {{- else }}
+    valueFrom:
+      secretKeyRef:
+        name: {{ include "trigger-v4.fullname" . }}-clickhouse
+        key: password
+    {{- end }}
   - name: CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT
     value: "1"

And add a Secret resource (conditionally generated when no existingSecret is provided):

{{- if and .Values.clickhouse.deploy (not .Values.clickhouse.auth.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "trigger-v4.fullname" . }}-clickhouse
  labels:
    {{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" "clickhouse") | nindent 4 }}
type: Opaque
stringData:
  password: {{ .Values.clickhouse.auth.password | quote }}
{{- end }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: CLICKHOUSE_USER
value: {{ .Values.clickhouse.auth.username | quote }}
- name: CLICKHOUSE_PASSWORD
value: {{ .Values.clickhouse.auth.password | quote }}
- name: CLICKHOUSE_USER
value: {{ .Values.clickhouse.auth.username | quote }}
- name: CLICKHOUSE_PASSWORD
{{- if .Values.clickhouse.auth.existingSecret }}
valueFrom:
secretKeyRef:
name: {{ .Values.clickhouse.auth.existingSecret }}
key: password
{{- else }}
valueFrom:
secretKeyRef:
name: {{ include "trigger-v4.fullname" . }}-clickhouse
key: password
{{- end }}

- name: CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT
value: "1"
ports:
- name: http
containerPort: 8123
protocol: TCP
- name: native
containerPort: 9000
protocol: TCP
{{- if .Values.clickhouse.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /ping
port: http
initialDelaySeconds: {{ .Values.clickhouse.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.clickhouse.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.clickhouse.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.clickhouse.livenessProbe.failureThreshold }}
successThreshold: {{ .Values.clickhouse.livenessProbe.successThreshold }}
{{- end }}
{{- if .Values.clickhouse.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /ping
port: http
initialDelaySeconds: {{ .Values.clickhouse.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.clickhouse.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.clickhouse.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.clickhouse.readinessProbe.failureThreshold }}
successThreshold: {{ .Values.clickhouse.readinessProbe.successThreshold }}
{{- end }}
resources:
{{- toYaml .Values.clickhouse.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /var/lib/clickhouse
- name: logs
mountPath: /var/log/clickhouse-server
{{- /* Mount each override file individually: shadowing the whole
config.d directory would remove the image's built-in
docker_related_config.xml, which makes the server listen on
0.0.0.0 instead of localhost only. */}}
{{- if not (hasKey .Values.clickhouse.configdFiles "data-paths.xml") }}
- name: config
mountPath: /etc/clickhouse-server/config.d/data-paths.xml
subPath: data-paths.xml
{{- end }}
{{- range $filename, $_ := .Values.clickhouse.configdFiles }}
- name: config
mountPath: /etc/clickhouse-server/config.d/{{ $filename }}
subPath: {{ $filename }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "trigger-v4.fullname" . }}-clickhouse-config
- name: logs
emptyDir: {}
{{- if not .Values.clickhouse.persistence.enabled }}
- name: data
emptyDir: {}
{{- else if $existingClaim }}
- name: data
persistentVolumeClaim:
claimName: {{ $existingClaim }}
{{- end }}
{{- if and .Values.clickhouse.persistence.enabled (not $existingClaim) }}
volumeClaimTemplates:
- metadata:
name: data
{{- if .Values.clickhouse.persistence.retain }}
annotations:
helm.sh/resource-policy: keep
{{- end }}
spec:
accessModes:
- {{ .Values.clickhouse.persistence.accessMode }}
resources:
requests:
storage: {{ .Values.clickhouse.persistence.size }}
{{- $storageClass := .Values.clickhouse.persistence.storageClass | default .Values.global.storageClass }}
{{- if $storageClass }}
storageClassName: {{ $storageClass }}
{{- end }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "trigger-v4.fullname" . }}-clickhouse
labels:
{{- $component := "clickhouse" }}
{{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
spec:
type: {{ .Values.clickhouse.service.type }}
ports:
- port: {{ .Values.clickhouse.service.ports.http }}
targetPort: http
protocol: TCP
name: http
- port: {{ .Values.clickhouse.service.ports.native }}
targetPort: native
protocol: TCP
name: native
selector:
{{- include "trigger-v4.componentSelectorLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
{{- end }}
2 changes: 1 addition & 1 deletion hosting/k8s/helm/templates/tests/test-clickhouse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ spec:
args:
- |
echo "Testing ClickHouse HTTP interface..."
curl -f --user "{{ .Values.clickhouse.auth.adminUser }}:{{ .Values.clickhouse.auth.adminPassword }}" "http://{{ include "trigger-v4.fullname" . }}-clickhouse:{{ .Values.clickhouse.service.ports.http }}/ping"
curl -f --user "{{ .Values.clickhouse.auth.username }}:{{ .Values.clickhouse.auth.password }}" "http://{{ include "trigger-v4.clickhouse.hostname" . }}:{{ .Values.clickhouse.service.ports.http }}/ping"
echo "ClickHouse test completed successfully"
{{- end }}
4 changes: 2 additions & 2 deletions hosting/k8s/helm/values-production-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ redis:
memory: 512Mi

# Production ClickHouse
# The bundled ClickHouse serves plain HTTP inside the cluster. For TLS,
# use an external ClickHouse (deploy: false) with secure: true (see below).
clickhouse:
# Set to true to enable TLS/secure connections in production
secure: true
persistence:
enabled: true
size: 100Gi
Expand Down
Loading