Deploying ClickHouse using Altinity.Cloud

Last updated:

🌇 Sunsetting Kubernetes Deployments

This page covers our PostHog Kubernetes deployment, which we are currently in the process of sunsetting. Existing customers will receive support until May 31, 2023 and we will continue to provide security updates for the next year.

For existing customers
We highly recommend migrating to PostHog Cloud (US or EU). Take a look at this guide for more information on the migration process.
Looking to continue self-hosting?
We still maintain our Open-source Docker Compose deployment. Instructions for deploying can be found here.

This document outlines how to deploy PostHog using Altinity Cloud ClickHouse clusters.

Prerequisites

  • Altinity.Cloud ClickHouse cluster:
    • Minimum ClickHouse version: 21.8.13
    • Single shard and no data replication
    • No dashes (-) in cluster name
  • PostHog helm chart version >= 16.1.1
  • PostHog version >= 1.33.0

Deployment instructions

PostHog uses Kafka to send data from the app to ClickHouse. For that reason, Kafka needs to be accessible to ClickHouse during deployment.

Deploying using external Kafka

YAML
env:
- name: CLICKHOUSE_DISABLE_EXTERNAL_SCHEMAS
value: '1'
kafka:
enabled: false
externalKafka:
brokers:
- 'broker-1.posthog.kafka.us-east-1.amazonaws.com:9094'
- 'broker-2.posthog.kafka.us-east-1.amazonaws.com:9094'
- 'broker-3.posthog.kafka.us-east-1.amazonaws.com:9094'
clickhouse:
enabled: false
externalClickhouse:
host: 'somecluster.demo.altinity.cloud'
user: 'admin'
password: 'password'
cluster: 'clustername'
secure: true

Read more about how to configure external Kafka in the chart in our deployment documentation.

Using internal Kafka

To deploy using a version of Kafka managed by the PostHog Helm chart, follow these three steps:

  1. Deploy your Helm chart initially with the following values.yaml:
YAML
kafka:
enabled: true
externalAccess:
enabled: true
service:
type: LoadBalancer
ports:
external: 9094
autoDiscovery:
enabled: true
serviceAccount:
create: true
rbac:
create: true
clickhouse:
enabled: false
redis:
enabled: false
postgresql:
enabled: false
pgbouncer:
enabled: false
plugins:
enabled: false
worker:
enabled: false
web:
enabled: false
events:
enabled: false
migrate:
enabled: false
  1. Get the external Kafka IP via kubectl get svc -n posthog | grep kafka-0-external

  2. Deploy PostHog using helm with new values.yaml (fill in placeholder values)

YAML
env:
- name: KAFKA_URL_FOR_CLICKHOUSE
value: 'kafka://KAFKA_IP:9094'
- name: CLICKHOUSE_DISABLE_EXTERNAL_SCHEMAS
value: '1'
clickhouse:
enabled: false
externalClickhouse:
host: 'somecluster.demo.altinity.cloud'
user: 'admin'
password: 'password'
cluster: 'clustername'
secure: true
kafka:
enabled: true
externalAccess:
enabled: true
service:
type: LoadBalancer
ports:
external: 9094
autoDiscovery:
enabled: true
serviceAccount:
create: true
rbac:
create: true

Questions?

Was this page useful?

Next article

Configuring Slack

Note - these instructions are for self-hosted PostHog instances only. If you are using PostHog Cloud or have already configured your instance per these instructions, check out our general Slack Integration Docs PostHog has built in support for sending Slack notifications via Actions or Subscriptions. For self-hosted PostHog instances, a Slack App is required so that Teams can add PostHog to their Slack workspace via the standard Oauth flows. General configuration 🚧 In addition to the Slack…

Read next article