Open
Description
I tried to self-host PostHog but got stuck at the start and spent many hours troubleshooting. Here’s what I found:
-
Latest Installable Commit
The latest working commit for self-hosting is579408c765dc6a33cba571a558b553c1fff771c5
. You must use579408c765dc6a33cba571a558b553c1fff771c5
as the Docker tag for self-hosting. -
Events Tab Not Showing Data
The Events tab does not display data, and events cannot be used as filters.- Related issue:
Events shown as stale even when events are sent #26107 - To fix this, add the following code to your
docker-compose.yml
:
property-defs-rs: image: ghcr.io/posthog/posthog/property-defs-rs:master build: context: posthog/rust/ args: BIN: property-defs-rs restart: on-failure environment: DATABASE_URL: 'postgres://posthog:posthog@db:5432/posthog' KAFKA_HOSTS: 'kafka:9092' SKIP_WRITES: 'false' SKIP_READS: 'false' FILTER_MODE: 'opt-out'
- Related issue:
-
Live Activity Not Working
- Fixed in commit
7724fd847d45cc5c731c4e05cf47ef4790090435
, but I can't use it due to issue 1. - Related issue: Live Activity not working on Self-Hosted instance #26106
- Fixed in commit
-
CSRF Issue with
/i/v0/e/
EndpointPOST /decide
returns/i/v0/e/
as the analytics endpoint, but this endpoint fails CSRF checks.- My setup:
posthog.example.com
(PostHog) andwww.example.com
(website). When sending events fromwww.example.com
, the request gets a 403 error due to forbidden origin. CSRF_TRUSTED_ORIGINS
is not changeable, and/i/v0/e/
is not CSRF-exempt.- I found
NEW_CAPTURE_ENDPOINT
and set it to/e/
, which resolved the issue.
-
some clickhouse funection not working
- in Funnel Query use some user_defined_function like
aggregate_funnel_array
. you may get error query cant run or
funection not found - Related issue:
Funnel Query Error: "expect 8 arguments. Actual 6" #28842
- in Funnel Query use some user_defined_function like
posthog define its in clickhouse/user_defined_function.xml
. you must bind volume like below to funnel can work.
clickhouse:
extends:
file: docker-compose.base.yml
service: clickhouse
restart: on-failure
depends_on:
- kafka
- zookeeper
volumes:
- ./posthog/posthog/idl:/idl
- ./posthog/docker/clickhouse/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- ./posthog/docker/clickhouse/config.xml:/etc/clickhouse-server/config.xml
- ./posthog/docker/clickhouse/users.xml:/etc/clickhouse-server/users.xml
- ./docker/clickhouse/config.d/default.xml:/etc/clickhouse-server/config.d/default.xml
- ./posthog/posthog/user_scripts:/var/lib/clickhouse/user_scripts
- ./posthog/docker/clickhouse/user_defined_function.xml:/etc/clickhouse-server/user_defined_function.xml
- clickhouse-data:/var/lib/clickhouse
- Session Recording Causes System Failure
- When session recording is enabled, everything works fine for about 30 minutes. After that, the panel stops loading, and events are no longer saved.
- All containers remain up, but I receive a "storage slow" error without further details.
I managed to self-host PostHog by disabling session recording while I continue investigating the issue.