Langfuse
Langfuse records what agents do: every model call, its prompt, its cost and its latency, grouped into traces. Self-hosted, it is seven services: the web app, a worker, an AI gateway, Postgres, ClickHouse, Redis and MinIO.
Its Compose file is written the way Kaio wants one: every setting is a
${VARIABLE:-default}, so the file deploys unchanged and the variables do
the rest. Upgrading means taking their next file as it is.
1. Take their Compose file
Section titled “1. Take their Compose file”curl -fsSL -o compose.yml https://raw.githubusercontent.com/langfuse/langfuse/main/docker-compose.ymlRead it before deploying it, as you would any file you are about to run. The
lines marked # CHANGEME are the ones the variables below replace.
2. Write its variables
Section titled “2. Write its variables”LANGFUSE_IMAGE_TAG=4TELEMETRY_ENABLED=falseNEXTAUTH_URL=http://localhost:3000
POSTGRES_PASSWORD=generate-with-openssl-rand-hex-32DATABASE_URL=postgresql://postgres:same-postgres-password@postgres:5432/postgresSALT=generate-with-openssl-rand-hex-32ENCRYPTION_KEY=generate-with-openssl-rand-hex-32NEXTAUTH_SECRET=generate-with-openssl-rand-hex-32CLICKHOUSE_PASSWORD=generate-with-openssl-rand-hex-32REDIS_AUTH=generate-with-openssl-rand-hex-32MINIO_ROOT_PASSWORD=generate-with-openssl-rand-hex-32LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY=same-minio-passwordLANGFUSE_S3_MEDIA_UPLOAD_SECRET_ACCESS_KEY=same-minio-passwordLANGFUSE_S3_BATCH_EXPORT_SECRET_ACCESS_KEY=same-minio-password
LANGFUSE_INIT_ORG_ID=agentsLANGFUSE_INIT_ORG_NAME=AgentsLANGFUSE_INIT_PROJECT_ID=hermesLANGFUSE_INIT_PROJECT_NAME=HermesLANGFUSE_INIT_PROJECT_PUBLIC_KEY=pk-lf-generate-oneLANGFUSE_INIT_PROJECT_SECRET_KEY=sk-lf-generate-oneLANGFUSE_INIT_USER_EMAIL=you@example.netLANGFUSE_INIT_USER_NAME=youLANGFUSE_INIT_USER_PASSWORD=generate-with-openssl-rand-hex-16DATABASE_URLcarries the Postgres password a second time, and the three*_SECRET_ACCESS_KEYrepeat the MinIO one: the file reads them separately.ENCRYPTION_KEYmust be 64 hex characters, which is whatopenssl rand -hex 32prints.- The
LANGFUSE_INIT_*variables create the organisation, the project, its API keys and the first user at first start. Langfuse ships no default login, so without them the first person to open the page and sign up owns it. With them, an agent’s tracing keys exist before anyone opens a browser. TELEMETRY_ENABLEDdefaults totruein their file.
Kaio flags most of these as secrets by
name, but not SALT, REDIS_AUTH or DATABASE_URL, which carry one without
saying so. Flag them on the deploy itself.
3. Deploy it
Section titled “3. Deploy it”kaio-cli stack deploy langfuse ./compose.yml --env-file .env \ --secret SALT --secret REDIS_AUTH --secret DATABASE_URLkaio-cli stack logs langfuse --followThe three are masked from the first version on, never readable in clear from
stack env ls or the API. The first start takes two to three minutes, while the web container
runs its migrations, until it logs Ready. The UI answers on
http://localhost:3000.
stack logs merges the seven services into one stream, each line prefixed by
its service, which is the quickest way to see which one is holding the others
back: the web app and the worker wait for the four stores to report healthy.
4. Mind the ports
Section titled “4. Mind the ports”Their file publishes the web app on 3000, MinIO on 9090 and the AI gateway
on 3031 on every interface; the stores and the worker stay on the
loopback. MinIO is public because the browser uploads media straight to it.
On a host reachable from outside, put a proxy in front or change those three
lines, and set NEXTAUTH_URL and LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT to the
addresses the browser actually uses.
Changing them is an edit Kaio keeps: the next version of the stack shows the
diff, and stack deploy --dry-run shows what the deploy would change before it
runs, as the review step does in
the web UI.
5. Upgrade it
Section titled “5. Upgrade it”curl -fsSL -o compose.yml https://raw.githubusercontent.com/langfuse/langfuse/main/docker-compose.ymlkaio-cli stack deploy langfuse ./compose.yml --dry-runkaio-cli stack deploy langfuse ./compose.ymlkaio-cli stack versions langfuseThe dry run lists the services their new file adds, removes or recreates and
the images it pulls, and changes nothing. Redeploying their newer file keeps the
stored variables and records a version,
so a release that breaks is stack rollback away for the Compose file. The
data is another matter: migrations Langfuse ran on Postgres and ClickHouse are
not undone by a rollback, so back the volumes up before a major version.
Moving it
Section titled “Moving it”kaio-cli stack copy langfuse --to prod-02 --with-volumes --dry-runThe plan lists the five data volumes with their sizes, and the ports already
taken on prod-02. ClickHouse can grow large on a busy project: read the sizes
before dropping --dry-run.
Kaio, built by Régis Gaidot