Self-host PostHog on Railway: what it needs and costs

By Tracklayer · Updated 2026-11-20

Short answer: yes, you can self-host PostHog on Railway, but it is a large deployment. PostHog’s self-hosted stack is a distributed system, and the Tracklayer template runs it as 23 Railway services behind one public router. Expect to need a Hobby plan at minimum, Pro for real use, and around 10 GB of RAM at idle. If you only need page views and referrers, a smaller tool is a better fit.

Deploy PostHog on Railway

When this makes sense

PostHog is an open-source product platform. Per the template documentation, self-hosting gives you:

Self-hosting suits teams that want that data in their own project and can pay for the memory. It is more than most small sites need.

What the template deploys

The stack follows PostHog’s own self-hosted (“hobby”) compose files, built from PostHog’s images. Only one service is public.

Group What runs
Edge proxy, the single public service, which routes to everything else
App web (Django UI and API), worker (Celery and scheduler), a Temporal worker
Ingestion Node services for events, replay, error tracking and data pipelines
Capture and flags Rust and Go services for SDK endpoints, feature flags, persons, error symbolication and live events
Data ClickHouse, ZooKeeper, Redpanda (Kafka API), Postgres, Redis, SeaweedFS
Jobs Temporal, and Browserless for image exports

ClickHouse, Redpanda, Postgres, SeaweedFS and ZooKeeper have volumes. SeaweedFS holds session recordings and exports.

Analytics templates people deploy on Railway

TemplateCreatorDeploymentsServices
UmamiBrody's Projects4,2363
MetabaseBrody's Projects2,6422
Plausible AnalyticsTinybox Software9153
Langfuse v3Langfuse's Projects6886
ElasticsearchLasso Moderation2641
OmniRouteA3A2081
PostHog Product Analytics SuiteTracklayer1423
Plausible v3 Privacy-First AnalyticsTracklayer33

Railway marketplace data as of 2026-11-19. Full ranking: Best privacy-friendly web analytics templates on Railway.

The list mixes lightweight analytics tools with PostHog. Compare the number of services before you pick one.

Deploy PostHog, step by step

These steps use Tracklayer’s PostHog Product Analytics Suite template.

  1. Choose a plan. Hobby is the minimum. Pro is recommended for production because Hobby caps each volume at 5 GB.
  2. Deploy the template. All secrets are generated for you. Wait until web is active. Its pre-deploy step runs all migrations, which takes 10 to 20 minutes on the first deploy.
  3. Create your account at once. Open the proxy service’s public domain and complete the signup wizard. The first account becomes the instance owner, so do this straight after deploy, then invite teammates from the organization settings.
  4. Add the snippet. Copy the project snippet from Project settings into your site or app. SDKs use https://<your-proxy-domain> as the API host.
  5. Check GeoIP. The template notes that country data on events needs the GeoIP transformation to exist for your project. Look under Data pipelines, Transformations after first login.

Optional settings on web: ANTHROPIC_API_KEY turns on PostHog AI and OPENAI_API_KEY turns on SQL and regex assist. Invite and password-reset emails need PostHog’s EMAIL_* variables on web and worker, and outbound SMTP needs Railway’s Pro plan. For a custom domain, add it to proxy, then set SITE_URL on web and redeploy the PostHog services.

What it costs

Railway bills usage, and here memory is the main driver. The template’s notes give these figures at Railway’s usage prices:

ClickHouse, Redpanda and the web workers are large consumers. The template notes that lowering WEB_CONCURRENCY to 1 saves about 1 GB if you do not need Celery throughput. PostHog itself says its hobby stack needs at least 8 GB of RAM.

Scaling and upgrades

capture, ingestion and recordings are stateless and can run more replicas. Keep worker at one replica because it runs the scheduler. ClickHouse and Redpanda scale by adding memory and CPU.

PostHog publishes no versioned self-hosted releases, so every image is pinned to a commit build. Upgrades are deliberate: update the tags together and diff PostHog’s compose files first.

Limitations and licence notes

Other options

If you want simple, cookie-free page-view analytics, these are far smaller:

See the privacy-friendly analytics guide for a side-by-side, the full ranking of web analytics templates on Railway, or browse all guides.

FAQ

How do I log in to a new PostHog instance?

Wait until the web service is active; the first deploy runs all migrations and takes 10 to 20 minutes. Open the proxy service's public domain and complete the signup wizard. The first account becomes the instance owner, so do this right away. SDKs use your proxy domain as the API host.

Why does PostHog use so much memory?

Self-hosted PostHog is many processes: Django, Celery, Node ingestion, Rust capture services, ClickHouse, Redpanda, ZooKeeper, Postgres, Redis and more. The template's notes put idle usage at around 10 GB of RAM, measured in a local test, and estimate 16 to 18 GB for a team sending a few million events a month. Grouping processes into fewer services does not reduce the total.

Which Railway plan do I need?

Hobby is the minimum, because Trial's 1 GB per service is too small. Pro is recommended for production, because Hobby limits each volume to 5 GB and ClickHouse and the recordings store outgrow that quickly.

How do I upgrade PostHog?

PostHog does not publish versioned self-hosted releases, so every image is pinned to a commit build. To upgrade, pick a newer commit and update the image tags listed in the template README, then compare PostHog's compose files between the two commits for new services or variables before redeploying.

Which licence notes apply?

PostHog is MIT except the ee/ directory, which uses PostHog's Enterprise licence; paid features stay locked without a key. Redpanda core is BUSL-1.1: free to self-host, not to resell as a streaming service. Browserless is SSPL-1.0 or commercial, and Browserless states that closed-source commercial use needs a commercial licence. You can remove the browserless service; PNG exports and heatmap screenshots then stop working. This is not legal advice.