Skip to content

fix(hosting): deploy ClickHouse from the official image instead of Bitnami#4249

Open
matt-aitken wants to merge 3 commits into
mainfrom
fix/self-hosting-official-clickhouse
Open

fix(hosting): deploy ClickHouse from the official image instead of Bitnami#4249
matt-aitken wants to merge 3 commits into
mainfrom
fix/self-hosting-official-clickhouse

Conversation

@matt-aitken

@matt-aitken matt-aitken commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

Self-hosted deployments now run ClickHouse from the official clickhouse/clickhouse-server image instead of bitnamilegacy/clickhouse. Bitnami's free image catalog is EOL and the frozen legacy archive tops out at ClickHouse 25.7.5, below the 25.8 minimum the platform requires since v4.5.0, which broke every ClickHouse insert on chart-bundled deployments. Both stacks now default to 26.2, the same version the platform is developed and tested against.

Existing deployments keep their ClickHouse data with no manual migration.

Fixes #4197.

Details

Docker Compose: the clickhouse service uses the official image with its native env vars, plus the recommended nofile ulimits. It reuses the same named volume as before: a data-paths.xml config override points ClickHouse at the data/ subdirectory of the volume, which is exactly the layout the Bitnami image used, so old volumes work in place (including SQL-created users) and fresh installs get the identical layout.

Helm chart: the Bitnami ClickHouse subchart is replaced by a chart-owned single-node StatefulSet and Service running the official image (non-root, HTTP /ping probes, config overrides mounted into config.d, and the same data-paths.xml layout compatibility). On upgrade, the chart automatically adopts the data PVC left behind by the old subchart (data-<release>-clickhouse-shard0-0) via lookup, and fsGroup relabeling handles the uid change on first mount. Existing clickhouse.* values keep working: auth, persistence (including global.storageClass), resources, secure, external.*, and configdFiles. Bitnami-only keys (shards, replicaCount, keeper, resourcesPreset) are gone. The docs now state the 25.8 minimum for bring-your-own ClickHouse.

One caveat: lookup returns nothing when manifests are rendered without cluster access (GitOps tools that use helm template). For that case there's a new clickhouse.persistence.existingClaim value, documented in the values file and the Kubernetes self-hosting docs.

Verification

  • Full upgrade simulation for Compose: booted the ClickHouse service from the old compose file on main (Bitnami 25.5), wrote 5,000 rows, then brought the same project up with this branch's compose file. The official 26.2 server came up healthy on the same volume with all rows intact, SQL-created users working, and writes succeeding.
  • Adoption scenarios tested against real containers: old volume + root entrypoint (Compose), old volume owned by the Bitnami uid + non-root 101 with fsGroup-style group permissions (Kubernetes), and fresh volumes for both.
  • helm lint, helm template (default values, existingClaim set, external ClickHouse, and the production example) and kubeconform all pass, mirroring the release CI steps.
  • Inserts using input_format_json_infer_array_of_dynamic_from_array_of_different_types (the setting that fails on 25.7.5) succeed on the upgraded volume.

@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c53b098

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8e94762c-0790-43e4-9b98-ba996e6f6178

📥 Commits

Reviewing files that changed from the base of the PR and between 7302aa9 and c53b098.

📒 Files selected for processing (1)
  • hosting/k8s/helm/templates/_helpers.tpl
🚧 Files skipped from review as they are similar to previous changes (1)
  • hosting/k8s/helm/templates/_helpers.tpl
📜 Recent review details
⏰ Context from checks skipped due to timeout. (6)
  • GitHub Check: prerelease
  • GitHub Check: code-quality / code-quality
  • GitHub Check: audit
  • GitHub Check: audit
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)

Walkthrough

ClickHouse configuration is updated across self-hosting documentation, Docker Compose, and Helm. Docker now uses the official image, updated credentials and paths, file limits, and a compatible data-path configuration. Helm replaces the Bitnami dependency with custom ClickHouse resources, pinned image settings, explicit ports, probes, persistence, security settings, generated URLs, and updated tests. Documentation records the ClickHouse 25.8+ requirement and external service port key.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description has useful summary/details, but it does not follow the required template sections like Closes #, Checklist, Testing, Changelog, and Screenshots. Add the template sections: Closes #4197, Checklist, Testing, Changelog, and Screenshots, and briefly fill each one out.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: switching self-hosted ClickHouse deployments from Bitnami to the official image.
Linked Issues check ✅ Passed The PR updates the bundled ClickHouse to 26.2 via the official image, documents the 25.8 minimum, and replaces the Bitnami chart as requested.
Out of Scope Changes check ✅ Passed The changes stay focused on the ClickHouse migration, data preservation, and docs; no unrelated additions stand out.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/self-hosting-official-clickhouse

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🧭 Helm Chart Prerelease Published

Version: 4.5.4-pr4249.c53b098

Install:

helm upgrade --install trigger \
  oci://ghcr.io/triggerdotdev/charts/trigger \
  --version "4.5.4-pr4249.c53b098"

⚠️ This is a prerelease for testing. Do not use in production.

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

…tnami

The Bitnami free image catalog is EOL and its frozen bitnamilegacy
archive tops out at ClickHouse 25.7.5, below the 25.8 floor the
platform requires since v4.5.0. The Docker Compose stack and the Helm
chart now run the official clickhouse/clickhouse-server image at 26.2,
the same version the platform is developed and tested against. The Helm
chart deploys ClickHouse with a chart-owned StatefulSet instead of the
Bitnami subchart.

Existing deployments keep their data with no manual steps: a config
override keeps the on-disk layout compatible with volumes created by
the Bitnami-based setup, Compose reuses the same named volume, and the
Helm chart automatically adopts the data PVC left behind by the old
subchart.
@matt-aitken matt-aitken force-pushed the fix/self-hosting-official-clickhouse branch from e2e7e33 to 4608012 Compare July 13, 2026 16:01
coderabbitai[bot]

This comment was marked as resolved.

…e inline credentials

The chart-deployed ClickHouse now reads CLICKHOUSE_PASSWORD from a
chart-owned Secret instead of a plaintext env value in the pod spec, and
the CLICKHOUSE_URL helpers percent-encode inline usernames and passwords
so special characters no longer produce an unparseable URL.
devin-ai-integration[bot]

This comment was marked as resolved.

…ntials

urlquery encodes spaces as plus signs, which URL userinfo decoding keeps
literal. A shared urlencode helper rewrites them to %20 (a real plus
already encodes as %2B), so passwords containing spaces now work.

@devin-ai-integration devin-ai-integration Bot left a comment

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.

Devin Review found 2 new potential issues.

Open in Devin Review

template:
metadata:
annotations:
checksum/config: {{ .Values.clickhouse.configdFiles | toYaml | sha256sum }}

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.

🟡 Config change detection misses the default data-paths file, so pods may not restart after a chart upgrade

The config checksum annotation only covers user-supplied override files (configdFiles | toYaml | sha256sum at hosting/k8s/helm/templates/clickhouse.yaml:76), but the ConfigMap also includes a hardcoded default data-paths.xml that is not part of configdFiles, so changes to that default in a future chart version won't alter the checksum and the StatefulSet pod won't be restarted.

Impact: After a chart upgrade that changes the default data-paths layout, ClickHouse keeps running with the old paths until manually restarted, because subPath volume mounts do not auto-update.

Mechanism: subPath mounts require pod restart, but checksum doesn't trigger one

The ConfigMap is built from two sources (hosting/k8s/helm/templates/clickhouse.yaml:10-32):

  1. A hardcoded data-paths.xml (when not overridden by the user)
  2. All entries from .Values.clickhouse.configdFiles

But the checksum annotation at line 76 only hashes source (2):

checksum/config: {{ .Values.clickhouse.configdFiles | toYaml | sha256sum }}

The config files are mounted via subPath (hosting/k8s/helm/templates/clickhouse.yaml:152-153), which means Kubernetes does NOT propagate ConfigMap updates to the running pod — a pod restart is required. Since the checksum doesn't change when only the hardcoded default changes, Helm won't roll the StatefulSet.

The fix would be to include the full rendered ConfigMap data in the checksum, or at minimum include the hardcoded data-paths.xml content in the hash.

Prompt for agents
In hosting/k8s/helm/templates/clickhouse.yaml line 76, the checksum/config annotation only hashes .Values.clickhouse.configdFiles but the ConfigMap also includes a hardcoded data-paths.xml (lines 10-27) that is not part of configdFiles. When this hardcoded content changes in a future chart version, the checksum won't change and the pod won't be restarted, even though subPath mounts require a restart to pick up ConfigMap changes.

To fix, compute the checksum over the full ConfigMap data rather than just the user-supplied configdFiles. One approach is to include the hardcoded data-paths.xml content in the hash as well. For example, concatenate a representation of the default data-paths.xml with the configdFiles YAML before hashing, or use a checksum of the entire rendered ConfigMap data block.
Open in Devin Review

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

Comment on lines 73 to 76
# 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:

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.

🔍 Production example removed secure: true for bundled ClickHouse — intentional but worth noting

The production example at hosting/k8s/helm/values-production-example.yaml:73-75 removed secure: true from the ClickHouse section and added a comment explaining that the bundled ClickHouse serves plain HTTP inside the cluster. This is correct — the bundled single-node ClickHouse doesn't have TLS configured, so secure: true would have generated HTTPS URLs that the server can't serve. The comment directs users to use an external ClickHouse with deploy: false and secure: true for TLS. However, users upgrading who previously had secure: true in their custom values (copied from the old production example) would need to either remove it or set up an external ClickHouse with TLS.

Open in Devin Review

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v4.5.0 ClickHouse writers require CH ≥25.8, but the Helm chart still bundles ClickHouse 25.7.5 → every insert fails with UNKNOWN_SETTING

1 participant