Deploy Langfuse v4
Langfuse v4 (Lang Fuse) AI tracing with ClickHouse, S3 & ready admin.
Just deployed
/data
ClickHouse
Just deployed
/var/lib/clickhouse
Langfuse Worker
Just deployed
Postgres
Just deployed
/var/lib/postgresql/data
Langfuse
Just deployed
langfuse-storage
Bucket
Just deployed
Deploy and Host Langfuse V4 on Railway
Langfuse (also searched as Lang Fuse) is an open-source platform for tracing, debugging, evaluating, and monitoring AI applications. This template deploys Langfuse 4.59.0 with its web application, background worker, PostgreSQL, ClickHouse, Redis, and a private Railway S3-compatible bucket.
The services are connected automatically. Your organization, project, administrator account, and API keys are created on startup. Deploy with no required configuration, then sign in as admin@example.com with the unique generated password. You can set your own email before the first startup.
About Hosting Langfuse V4
This template includes five services and one bucket:
| Resource | Purpose | Included version |
|---|---|---|
| Langfuse | Dashboard, authentication, public API and OTLP ingestion | 4.59.0 |
| Langfuse Worker | Background ingestion and processing | 4.59.0 |
| PostgreSQL | Application metadata and configuration | 17.11 |
| ClickHouse | Observation storage and analytical queries | 26.4.5.143 |
| Redis | Queues and cache, with noeviction and persistence | 7.2.16 |
| Railway bucket | Private S3-compatible event, media, and export storage | Managed by Railway |
Only Langfuse has a public HTTP domain. Internal services use Railway private networking. The bucket uses its authenticated S3 endpoint; media and exports are accessible through temporary signed URLs.
First Login
- Deploy directly with the default admin@example.com login, or optionally set
LANGFUSE_INIT_USER_EMAILto your own email before the first startup. - Wait for the web, worker, and database services to finish starting. Initial schema migrations can take several minutes.
- Open the public domain of the Langfuse service.
- Sign in with
LANGFUSE_INIT_USER_EMAIL(default: admin@example.com) and the uniqueLANGFUSE_INIT_USER_PASSWORD, available in that service's Variables tab. - Open the automatically created My Organization → My Project project.
Public registration is disabled. You can choose organization and project names in the deployment variables.
Use Your Own Email After Deploying
Change LANGFUSE_INIT_USER_EMAIL to your real email in the Langfuse service variables and redeploy that service. Langfuse creates another owner of the same organization, using LANGFUSE_INIT_USER_PASSWORD if that email is new. Sign in with the new email and verify access. This does not rename or remove the initial admin@example.com account. To retire it, keep the new email in the variable and delete the old account through its account settings after confirming the new owner works. Changing the password variable does not reset an existing account password.
The default email is a placeholder login, not a mailbox. Configure SMTP and a real email if you need password recovery or email invitations.
Find your project keys in LANGFUSE_INIT_PROJECT_PUBLIC_KEY and LANGFUSE_INIT_PROJECT_SECRET_KEY in the Langfuse service. Keep the secret key private.
Send Your First Trace
Confirm ingestion without an LLM account or a paid model call. Set your domain and generated project keys:
export LANGFUSE_HOST="https://your-langfuse-domain.up.railway.app"
export LANGFUSE_PUBLIC_KEY="pk-lf-..."
export LANGFUSE_SECRET_KEY="sk-lf-..."
Send one completed root observation with Python 3, using the standard library:
import base64, json, os, secrets, time, urllib.request
host = os.environ["LANGFUSE_HOST"].rstrip("/")
credentials = ":".join([
os.environ["LANGFUSE_PUBLIC_KEY"],
os.environ["LANGFUSE_SECRET_KEY"],
])
trace_id, span_id = secrets.token_hex(16), secrets.token_hex(8)
started = time.time_ns()
span = {
"traceId": trace_id,
"spanId": span_id,
"name": "railway-first-trace",
"startTimeUnixNano": str(started),
"endTimeUnixNano": str(started + 1_000_000),
"attributes": [
{"key": "langfuse.observation.input", "value": {"stringValue": "Hello from Railway"}},
{"key": "langfuse.observation.output", "value": {"stringValue": "My first trace"}},
],
}
payload = {"resourceSpans": [{"scopeSpans": [{"spans": [span]}]}]}
request = urllib.request.Request(
host + "/api/public/otel/v1/traces",
data=json.dumps(payload).encode(),
headers={
"Authorization": "Basic " + base64.b64encode(credentials.encode()).decode(),
"Content-Type": "application/json",
"x-langfuse-ingestion-version": "4",
},
method="POST",
)
with urllib.request.urlopen(request, timeout=30) as response:
print("Ingestion accepted:", response.status)
print("Trace ID:", trace_id)
Look for railway-first-trace in your project's tracing view. Allow a short processing delay. A successful API response confirms acceptance; a visible observation confirms worker processing and persistence.
Verify programmatically with GET /api/public/v2/observations?traceId=YOUR_TRACE_ID, using the same Basic authentication.
SDK and Integration Compatibility
For new instrumentation, use the current Python SDK v5 or JS/TS SDK v6, supported by this pinned Langfuse 4.59.0 server. Existing Python SDK 4.7.0+ and JS/TS SDK 5.4.0+ integrations are also V4-compatible. OTLP/HTTP exporters must send complete spans and x-langfuse-ingestion-version: 4.
Fresh V4 deployments reject legacy batch trace ingestion (/api/public/ingestion) and old synchronous trace/span/generation endpoints. Check older integration examples before using them.
LiteLLM
Use a current LiteLLM version with the langfuse_otel callback. Configure its Langfuse OTLP host and project keys, then verify a request reaches the V4 dashboard.
See the official LiteLLM integration guide.
n8n and Other Automation Tools
Use a V4-compatible integration, or an HTTP Request step sending complete OTLP JSON spans to the endpoint above. Nodes relying on legacy trace ingestion need updating.
n8n and LiteLLM are separate applications; this template provisions Langfuse.
Common Use Cases
- Trace LLM requests, agent steps, tool calls, and retrieval operations.
- Inspect model inputs, outputs, latency, usage, and cost metadata supplied by your instrumentation.
- Manage prompts, evaluations, and experiments on infrastructure you control.
Resource Usage and Costs
This stack runs continuously. Railway bills actual service, volume, and bucket usage. An idle deployment still consumes resources, especially ClickHouse and the web/worker applications.
Langfuse recommends at least 2 CPUs and 4 GB RAM per application container for production. Web and worker use a 3 GB Node.js heap ceiling; allow additional container memory for runtime overhead. Monitor memory, CPU, disk growth, and ingestion delay. A small functional test does not establish production capacity.
Model-based evaluations require your provider configuration and may incur provider charges.
Persistence, Maintenance, and Upgrades
- PostgreSQL, ClickHouse, and Redis have persistent volumes. The managed bucket keeps event, media, and export objects independently of application redeployments.
- Startup health checks use
/api/public/readyon web,/api/healthon worker, and/pingon ClickHouse. Web readiness checks that the application can serve traffic; it does not verify every dependency. Railway health checks run during deployment, not continuously. You can check PostgreSQL manually through/api/public/health?failIfDatabaseUnavailable=true. - Keep
SALT,ENCRYPTION_KEY, database credentials, and organization/project IDs stable. Web and worker share secret values. - Initialization creates missing resources. Reset existing passwords and rotate API keys through Langfuse settings; changing initialization variables does not update existing credentials.
- Back up PostgreSQL, ClickHouse, and bucket data before upgrades. Keep web and worker on the same version and follow the upgrade guidance.
- This is a fresh, single-instance V4 stack. V3 migration, high availability, and backups require separate configuration.
- Automatic retention can depend on Langfuse edition and licensing. No automatic retention policy is promised; monitor storage growth.
Dependencies for Langfuse V4 Hosting
A Railway account with capacity for five always-on services, three persistent volumes and one native bucket. The application images and private connections are preconfigured. Trace ingestion requires no external LLM provider key; model-based evaluations may require one.
Deployment Dependencies
- Langfuse source and 4.59.0 release
- Self-hosted architecture and infrastructure
- Headless initialization
- SDK compatibility
- OpenTelemetry ingestion
- Railway storage buckets
Why Deploy Langfuse V4 on Railway?
Railway provisions the databases, worker, private connections, HTTPS domain and object storage together. This template also creates the initial administrator, organization, project and API keys, so you can start tracing without manually connecting each service. Pinned images and documented defaults make the deployment reproducible.
Template Content
ClickHouse
clickhouse/clickhouse-server:26.4.5.143Langfuse Worker
langfuse/langfuse-worker:4.59.0Postgres
postgres:17.11-bookwormLangfuse
langfuse/langfuse:4.59.0langfuse-storage
Bucket

