Skip to content

fix(plausible): stop ClickHouse OOM crashloop and fix DB hostnames - #27

Merged
jonathandieu merged 2 commits into
mainfrom
fix/plausible-clickhouse-oom-and-db-hostnames
Aug 6, 2026
Merged

fix(plausible): stop ClickHouse OOM crashloop and fix DB hostnames#27
jonathandieu merged 2 commits into
mainfrom
fix/plausible-clickhouse-oom-and-db-hostnames

Conversation

@jonathandieu

Copy link
Copy Markdown
Owner

Fixes Plausible on stage, which was fully down. Two independent bugs, both confirmed on the live cluster.

Bugs

  1. ClickHouse OOM crashloop. Bitnami's default resourcesPreset: small caps ClickHouse at a 768Mi limit. ClickHouse sets its memory tracker to ~90% of the cgroup limit (~691Mi), too little to run background merges and system-log flushes, so it crashlooped (Code: 241 MEMORY_LIMIT_EXCEEDED, 592 restarts). This blocked the analytics pod's wait-for-clickhouse init container. The node has ~6.5Gi allocatable.
  2. Broken DB hostnames. The chart's default databaseURL / clickhouseDatabaseURL target plausible-analytics-postgresql and plausible-analytics-clickhouse, but our Helm release is named plausible, so the bundled subchart Services are plausible-postgresql and plausible-clickhouse. The analytics pod's wait-for-postgres init container had been looping on plausible-analytics-postgresql:5432 - no response since 2026-07-08.

Fix

  • Override the ClickHouse resource preset with explicit resources (1Gi request, 2Gi limit).
  • Repoint both DB URLs at the real Service names. Credentials are unchanged and still match the subchart auth defaults.

Verification

  • ClickHouse fix proven live on stage: patched the running StatefulSet to 2Gi, pod came back healthy at 0 restarts with Application: Ready for connections and no Code 241. (That live patch was temporary and reverts on ArgoCD selfHeal; this PR is the durable fix.)
  • Hostname fix render-verified: helm template emits plausible-postgresql / plausible-clickhouse, matching the actual Services. The live wait-for-postgres loop confirmed the wrong host is the current blocker.

Out of scope (follow-ups on #18)

  • Insecure default secrets (postgres:postgres, clickhouse:password) should move to ESO/1Password before prod.
  • Both subcharts have persistence.enabled: false, so analytics data is lost on pod restart.

Refs #18.

ClickHouse crashlooped on stage (Code 241 MEMORY_LIMIT_EXCEEDED),
blocking the analytics pod's wait-for-clickhouse init container.
Bitnami's default resourcesPreset "small" caps ClickHouse at a 768Mi
limit; ClickHouse sets its memory tracker to ~90% of the cgroup limit
(~691Mi), too little to run background merges and system-log flushes.
Override the preset with explicit resources (1Gi request, 2Gi limit);
the node has ~6.5Gi allocatable.

Also fix the Postgres and ClickHouse connection URLs. The chart's
defaults target `plausible-analytics-*` hostnames, but our Helm release
is named `plausible`, so the bundled subchart Services are
`plausible-postgresql` and `plausible-clickhouse`. Point the URLs at the
real Service names (credentials still match the subchart auth defaults).

Refs #18.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jonathandieu
jonathandieu requested a review from Copilot July 14, 2026 03:00
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

Helm template diff

diff -u --recursive --label base --label head base head
--- base
+++ head
@@ -218,10 +218,10 @@
     app.kubernetes.io/managed-by: Helm
 type: Opaque
 data:
-  SECRET_KEY_BASE: ZXB0UUZRZGNZR29jTDRmenFVVjJtdUxZNHdhSlM2SmI5V3h1RnBRYVVHaFZaZXV6Nk4xenZXYVgzZDNybGt0RmxraWtQc1ZrUWRhR1hlaGJTRk5kWXRlcXRU
+  SECRET_KEY_BASE: N3c2d0lzSE1QOWQ3aTR3dDdmb2dRV0lNalplOVBXMnUwbnFvUFFETEx0VTR5bmxNTzRnWDJxWVN5Mzlhb1d5eFQzc2E1dDE1dkNNS3NBemdQNFFxUVZnSzlr
   TOTP_VAULT_KEY: ZHN4dmJuM2p4RGQxNmF6MlFwc1g1QjhPK2xseGpRMlNKRTJpNUJ6eDM4ST0=
-  DATABASE_URL: cG9zdGdyZXM6Ly9wb3N0Z3Jlczpwb3N0Z3Jlc0BwbGF1c2libGUtYW5hbHl0aWNzLXBvc3RncmVzcWw6NTQzMi9wbGF1c2libGVfZGI=
-  CLICKHOUSE_DATABASE_URL: aHR0cDovL2NsaWNraG91c2U6cGFzc3dvcmRAcGxhdXNpYmxlLWFuYWx5dGljcy1jbGlja2hvdXNlOjgxMjMvcGxhdXNpYmxlX2V2ZW50c19kYg==
+  DATABASE_URL: cG9zdGdyZXM6Ly9wb3N0Z3Jlczpwb3N0Z3Jlc0BwbGF1c2libGUtcG9zdGdyZXNxbDo1NDMyL3BsYXVzaWJsZV9kYg==
+  CLICKHOUSE_DATABASE_URL: aHR0cDovL2NsaWNraG91c2U6cGFzc3dvcmRAcGxhdXNpYmxlLWNsaWNraG91c2U6ODEyMy9wbGF1c2libGVfZXZlbnRzX2Ri
 
 ---
 # Source: plausible/charts/plausible-analytics/charts/clickhouse/templates/configmap.yaml
@@ -748,13 +748,11 @@
           envFrom:
           resources:
             limits:
-              cpu: 750m
-              ephemeral-storage: 2Gi
-              memory: 768Mi
+              cpu: 1
+              memory: 2Gi
             requests:
               cpu: 500m
-              ephemeral-storage: 50Mi
-              memory: 512Mi
+              memory: 1Gi
           ports:
             - name: http
               containerPort: 8123

Copilot AI 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.

Pull request overview

Restores Plausible availability on the stage cluster by fixing two deployment-blocking configuration issues in the Plausible Helm wrapper chart: incorrect in-cluster DB service hostnames and insufficient ClickHouse resources causing OOM crashloops.

Changes:

  • Override databaseURL and clickhouseDatabaseURL to use the actual Service names created by this Helm release (plausible-postgresql, plausible-clickhouse).
  • Disable the ClickHouse resourcesPreset and set explicit CPU/memory requests/limits to prevent OOM crashlooping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +17
# Only the host portion is wrong; the credentials match the subchart auth
# (postgres/postgres, clickhouse/password) set in the dependency defaults.
databaseURL: "postgres://postgres:postgres@plausible-postgresql:5432/plausible_db"
clickhouseDatabaseURL: "http://clickhouse:password@plausible-clickhouse:8123/plausible_events_db"
Comment thread charts/workloads/plausible/values.yaml Outdated
@jonathandieu jonathandieu self-assigned this Jul 19, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jonathandieu
jonathandieu merged commit 66d8f2c into main Aug 6, 2026
3 checks passed
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.

2 participants