Conversation
| proxy: | ||
| image: caddy:2-alpine | ||
| command: caddy run -c /etc/caddy/Caddyfile | ||
| restart: always | ||
| environment: | ||
| - SERVICE_URL_PROXY_8000 | ||
| depends_on: | ||
| - web | ||
| - capture | ||
| - livestream | ||
| volumes: | ||
| - type: bind | ||
| source: ./caddy/Caddyfile | ||
| target: /etc/caddy/Caddyfile | ||
| content: | | ||
| :8000 { | ||
| @replay-capture { | ||
| path /s /s/ /s/* | ||
| } | ||
| @capture { | ||
| path /e /e/ /e/* | ||
| path /i/v0 /i/v0/ /i/v0/* | ||
| path /batch /batch/ /batch/* | ||
| path /capture /capture/ /capture/* | ||
| } | ||
| @livestream { | ||
| path /livestream /livestream/ /livestream/* | ||
| } | ||
| @flags { | ||
| path /flags /flags/ /flags/* | ||
| } | ||
| @webhooks { | ||
| path /public/webhooks /public/webhooks/ /public/webhooks/* | ||
| path /public/m/ /public/m/* | ||
| } | ||
| @objectstorage { | ||
| path /posthog /posthog/ /posthog/* | ||
| } | ||
| handle @livestream { | ||
| uri strip_prefix /livestream | ||
| reverse_proxy livestream:8080 { | ||
| flush_interval -1 | ||
| } | ||
| } | ||
| handle @replay-capture { | ||
| reverse_proxy replay-capture:3000 | ||
| } | ||
| handle @capture { | ||
| reverse_proxy capture:3000 | ||
| } | ||
| handle @flags { | ||
| reverse_proxy feature-flags:3001 | ||
| } | ||
| handle @webhooks { | ||
| reverse_proxy plugins:6738 | ||
| } | ||
| handle @objectstorage { | ||
| reverse_proxy objectstorage:19000 | ||
| } | ||
| handle { | ||
| reverse_proxy web:8000 | ||
| } | ||
| } | ||
| - posthog-caddy-data:/data | ||
| - posthog-caddy-config:/config |
There was a problem hiding this comment.
Coolify already provides a proxy. Is it not possible to configure this in the Coolify proxy?
This can just be a bit confusing for people to handle / deal with two chained proxies.
There was a problem hiding this comment.
PostHog's architecture requires path-based routing from a single public URL to multiple internal services running on different ports.
Happy to explore Traefik labels if you'd prefer
There was a problem hiding this comment.
if it's possible that would be great. Caddy labels would also be needed, for people that use caddy.
There was a problem hiding this comment.
if it's possible that would be great. Caddy labels would also be needed, for people that use caddy.
The internal Caddy is there because PostHog needs path-based routing from one URL to multiple backend services, and some of it doesn't map cleanly to Coolify's proxy labels:
captureneeds 4 different path prefixes (/e,/i/v0,/batch,/capture) routed to the same service — labels only support one path per servicelivestreamneedsflush_interval -1for SSE streaming, which isn't expressible via Traefik/Caddy labels- some routes need strip_prefix, others don't & labels apply it uniformly per service
I can switch to labels using the Appwrite pattern (SERVICE_URL_POSTHOG=/path on each service), but we'd lose the extra capture paths (they'd fall back to the Django web service instead of the optimized capture service) and the streaming config for livestream. Both are fine for hobby-scale deployments tbh, just technically worse
Happy to go either way, let me know what you'd prefer
n0
left a comment
There was a problem hiding this comment.
fix config mount path, remove restart policies, add proxy port and env fallbacks
|
preview of when it will get merged? |
|
When we can expect this to be merged and fixed? Thank you |
Changes
Rewrote PostHog template. It has been disabled since September 2025 #6677 (⁶🤷♂️⁷ just had to) because of broken ClickHouse configs and missing env vars.
What changed:
content:mounts instead of downloading from GitHub at runtimeIssues
Category
AI Usage
Steps to Test
templates/compose/posthog.yaml/preflightsetup pageContributor Agreement
Important