---
title: Deploy Langfuse with AI on Blossom
url: "/deploy/langfuse/"
canonical_url: https://blossom88.com/deploy/langfuse/
markdown_url: https://blossom88.com/deploy/langfuse.md
summary: Deploy Langfuse with AI on Blossom. Trace AI requests, inspect model usage
  and latency, and keep your team's observability data in your own stack.
categories:
- deployment
- analytics
- ai
stack:
- TypeScript
- Next.js
- PostgreSQL
- ClickHouse
- Redis
---

# Deploy Langfuse with AI on Blossom

[Langfuse](https://langfuse.com/) helps you understand what your AI app is
doing. Inspect request traces, model inputs and outputs, token usage, and
latency in one workspace.

## Ask Your Agent

> **Ask your AI agent:** Deploy Langfuse on Blossom and help me trace my AI app.
>
> Follow this guide: https://blossom88.com/deploy/langfuse/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and [choose a Location in your cloud account](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#connect-your-provider).

## Your Tracing Setup

Bring a private R2 or S3 bucket and a credential scoped to it.

| Part | Purpose |
|---|---|
| Web and worker | Serve the private dashboard and process incoming traces |
| Managed PostgreSQL and Redis | Keep project settings and coordinate queued work |
| ClickHouse | Stores trace data on a Persistent Volume |
| R2 or S3 | Keeps raw ingestion events outside the Containers |

<details class="optional-reading" markdown="1">
<summary>Deployment setup and commands</summary>

Your agent checks Langfuse's current
[self-hosting requirements](https://langfuse.com/self-hosting), including its
ClickHouse and SDK compatibility matrix. Select compatible maintained web,
worker, and ClickHouse images, and pin multi-architecture indexes appropriate
to your Location. Save sizing and version choices with your deployment.

Create the App and Environment using the official web image:

    blossom profile:show
    blossom app:create --data '{"app":{"name":"langfuse"}}'
    blossom environment:create --data environment.yml

Use Blossom Account access for the dashboard. Allow `/api/public/*` through
the Blossom gate so the SDK and project-key-authenticated APIs can reach it.
Langfuse still authenticates those requests. Keep PostgreSQL, Redis,
ClickHouse, and the worker private.

Prepare managed PostgreSQL and Redis with storage, resources, and backup
settings appropriate to the workload:

    blossom database_instance:create --data postgres.yml --follow
    blossom cache_instance:create --data redis.yml --follow
    blossom database:list --database_instance database_instance-100
    blossom environment_link:create --data '{"environment_link":{"environment_id":"environment-100","target_type":"Database","target_id":"database-100","var_name":"DATABASE_URL"}}'
    blossom environment_link:create --data '{"environment_link":{"environment_id":"environment-100","target_type":"CacheInstance","target_id":"cache_instance-100","var_name":"REDIS_URL"}}'

Create a private ClickHouse Persistent Service. Give its data directory at
`/var/lib/clickhouse` a Volume and use the native HTTP `/ping` probe. It must
listen on the private network for both HTTP and native TCP connections.
Size its memory and background pools together rather than inheriting a
machine-sized default. Set `CLICKHOUSE_CLUSTER_ENABLED=false` for this
single-instance setup and use UTC throughout.

    blossom service:create --data clickhouse.yml
    blossom environment:deploy --id environment-100 --follow

Keep `SALT`, `NEXTAUTH_SECRET`, and `ENCRYPTION_KEY` stable in a private
.env.production file outside the application repository. Supply the private
ClickHouse endpoints, database and credentials using Langfuse's current
settings. Use a dedicated ClickHouse user with the permissions Langfuse needs
for migrations, ingestion, queries, and retention.

Configure `LANGFUSE_S3_EVENT_UPLOAD_*` for the private event bucket, including
its endpoint, region, path-style setting, and an isolated prefix ending in
`/`. Set up `LANGFUSE_S3_MEDIA_UPLOAD_*` separately if you need media tracing;
use a browser-reachable endpoint and the bucket's required CORS policy.

For a disposable test, a delegated short-lived R2 session can use
`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SESSION_TOKEN` through
the SDK credential chain. Leave Langfuse's explicit S3 key/secret fields
unset in that mode; those fields do not carry a session token. Retained apps
need credentials with a suitable lifetime or renewal. Keep storage
administration credentials out of App Containers.

    blossom env_var:push --environment environment-100 --file .env.production

Create web and worker Services on regular App Capacity. The Environment's
image supplies web; worker selects the matching official worker image with
its Service `image` field. Their Containers need no attached Volumes.
Map the linked `REDIS_URL` into `REDIS_CONNECTION_STRING` at startup and set
`NEXTAUTH_URL` to the public web origin. Start the upstream entrypoints and
use native HTTP health probes for the selected release.

    blossom service:create --data web.yml
    blossom service:create --data worker.yml

Run PostgreSQL and ClickHouse migrations once in a Release Phase hook using
the web image's upstream migration entrypoint, with enough resources and
startup time. Keep ordinary application startups from racing those
migrations. The ClickHouse Service must already be reachable before the hook.

    blossom environment:deploy_hooks:update --id environment-100 --data deploy-hooks.yml
    blossom environment:deploy --id environment-100 --follow
    blossom environment:show --id environment-100

Create the first owner, organization, project and API keys through Langfuse's
UI or supported headless initialization. Disable public signup when the
workspace is for your team. Remove temporary initialization credentials after
setup, retain application secrets, and redeploy. Configure SMTP before
relying on email invitations or password resets.

</details>

## Send Your First Trace

Connect a compatible Langfuse SDK using your web URL and project keys.
Send a request, then inspect its nested steps, usage, and latency.

![Langfuse displaying an AI request trace with a nested model generation.](/deploy/assets/images/langfuse/trace.webp)

<details class="optional-reading" markdown="1">
<summary>SDK setup, updates, and scaling</summary>

Follow the current [tracing quickstart](https://langfuse.com/docs/observability/get-started).
Keep secret project keys on your application's backend. Mask credentials and
sensitive fields before exporting prompts or responses. In short-lived
processes, flush the SDK before exit so queued observations reach Langfuse.

Check ingestion without a Blossom session: a valid project key should work,
and a missing or invalid key should fail. The dashboard still requires
Blossom Account access followed by Langfuse's own login.

    blossom service:show --id service-100
    blossom environment:deploy --id environment-100 --follow
    blossom logs --environment environment-100 --lines 30

Keep PostgreSQL, Redis, the ClickHouse Volume, object-storage prefixes and
application secrets across updates. After replacing Containers, sign in
again, open an existing trace, and send a new one. Application Containers can
be scaled separately when their shared data services and queues are sized
for the workload; coordinate migrations before increasing replicas.

This recipe keeps one ClickHouse Container on its Volume. Adding web or
worker Containers does not make that data tier highly available. Follow
upstream cluster and backup guidance before relying on it for a workload
that needs that availability.

</details>

## What You Get

- AI request traces with nested steps, model usage, and latency
- A private dashboard and project API keys for your applications
- Saved project settings and trace history across Container replacements
