Deploy Langfuse v4 LLM Observability

Self-host Langfuse v4 with ClickHouse, Redis and S3 storage.

Deploy Langfuse v4 LLM Observability

Just deployed

/data

Just deployed

Just deployed

/var/lib/clickhouse

/var/lib/postgresql/data

Just deployed

Bucket

Bucket

Just deployed

Deploy and Host Langfuse v4 LLM Observability on Railway

Langfuse is the open-source LLM engineering platform: it traces every call your AI app makes, scores and evaluates the output, versions your prompts, and tells you what each model and each user actually costs. This template deploys Langfuse v4 as a complete stack — web, worker, Postgres, ClickHouse, Redis and S3-compatible object storage — already wired together.

About Hosting Langfuse v4 LLM Observability

Langfuse v4 is not a single container. The web app serves the UI and the ingestion API, a worker drains the ingestion queue and runs evaluations, Postgres holds users, projects and prompts, ClickHouse stores traces and spans, Redis carries the queue, and S3 holds raw event payloads, uploaded media and batch exports. All six have to agree on credentials, and the web service runs two separate migrations on first boot before it answers a request.

This template does that wiring for you. Every connection string is a Railway variable reference, so passwords are generated at deploy time and never typed anywhere. SALT and ENCRYPTION_KEY are generated once on the web service and referenced by the worker, which keeps API-key hashing and secret decryption consistent across both — getting this wrong is a subtle failure that only shows up later when stored credentials will not decrypt.

Common Use Cases

  • Trace and debug LLM chains, agents and RAG pipelines in production, span by span.
  • Track token spend by model, by user and by feature, instead of reading a provider invoice at the end of the month.
  • Version prompts and compare how each version actually performed on real traffic.
  • Run evaluations and collect user feedback against live traces.
  • Keep observability data on infrastructure you control rather than sending prompts to a third-party SaaS.

Dependencies for Langfuse v4 LLM Observability Hosting

  • Postgres — users, projects, prompts, evaluation config.
  • ClickHouse — columnar store for trace and span ingestion. Langfuse v4 requires ClickHouse 25.12 or newer; this template pins the 26.3 LTS release.
  • Redis — ingestion queue, caching and rate limiting.
  • An S3-compatible bucket — raw events, media uploads and batch exports. This template uses a Railway storage bucket, so there is no MinIO container to run or pay for.

Implementation Details

Two things decide whether a single-node Langfuse deploy ever finishes starting, and this template handles both.

ClickHouse has to listen on IPv6. Railway's private network is IPv6-only, and the stock clickhouse-server image binds 0.0.0.0 only. The image here adds a config drop-in:


    ::
    0.0.0.0
    1

Without it, langfuse-web cannot reach ClickHouse at all and the first-boot migration never completes.

CLICKHOUSE_CLUSTER_ENABLED must be false. Langfuse defaults it to true, which makes the migration issue ON CLUSTER statements that a single ClickHouse node rejects. This is the single most common reason a self-hosted Langfuse sits unreachable after deploy.

Health checks are given a long timeout on both services, because the Postgres and ClickHouse migrations both run before the web service answers its first request.

First Run

The first deploy takes several minutes: two images build, then the migrations run. When langfuse-web turns green, open its public URL, create the first account, and you own the instance — the first user to sign up becomes the owner. Then point your SDK at that URL with the public and secret keys from the project settings page.

Scaling and Cost

The default layout fits a single small-to-medium workload. Langfuse recommends at least 2 CPUs and 4 GB of RAM per application container for heavier traffic, and langfuse-web can be scaled to several replicas behind Railway's load balancer once ingestion volume grows. ClickHouse holds the bulk of the data, so its volume is the first thing to watch.

Why Deploy Langfuse v4 LLM Observability on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Langfuse v4 LLM Observability on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Rootprint
Open-source logs and traces with full-text search on object-storage.

Rootprint
1
View Template
VPS Fleet Watch Hub with Beszel
A persistent Beszel hub for external VPS agents and fleet alerts.

dankeewithtwoes
0
View Template
Pyroscope profiling
Protected continuous profiling with durable Pyroscope storage.

Anton Orel
1