Self-hosted deployment - Docker Compose
This guide will walk you through the steps to deploy Langfuse on a cloud provider using Docker Compose. You will need access to a cloud provider like AWS, GCP, or Azure to deploy the application with permissions to deploy a virtual machine. While the Docker Compose setup can be highly effective for development environments, we recommend to not use it in production. There is no high-availability, no automatic restarts, no scaling, and no backup.
Start a new instance
Enter your cloud provider interface and navigate to the VM instance section. This is EC2 on AWS, Compute Engine on GCP, and Virtual Machines on Azure. Create a new instance. We recommend that you use at least 4 cores and 16 GiB of memory, e.g. a t3.xlarge on AWS. Assign a public IP address in case you want to send traces from external sources. As observability data tends to be large in volume, choose a sufficient amount of storage, e.g. 100GiB.
The rest of this guide will assume that you have an Ubuntu OS running on your VM and are connected via SSH.
Install Docker and Docker Compose
Install docker (see official guide as well).
Setup Docker’s apt repository:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Install Docker packages:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify installlation:
sudo docker run hello-world
Clone Langfuse Repository
Get a copy of the latest Langfuse repository:
git clone https://github.com/langfuse/langfuse.git
cd langfuse
Start the application
For local experimentation, the pre-configured variables in the docker-compose file are usually sufficient. If you send any kind of sensitive data to the application or intend to keep it up for longer, we recommend that you modify the docker-compose file and overwrite the following environment variables:
- SALT: A random string used to hash passwords. It should be at least 32 characters long.
- ENCRYPTION_KEY: Generate this via
openssl rand -base64 32
. - NEXTAUTH_SECRET: A random string used to sign JWT tokens.
- NEXTAUTH_URL: The URL where the application is hosted. Used for redirects after signup.
In addition, you should change any database or storage credential.
Run the docker compose file for Langfuse v3 (preview):
docker compose -f docker-compose.v3beta.yml up
Watch the containers being started and the logs flowing in. After about 2-3 minutes, the langfuse-web-1 container should log “Ready”. At this point you can proceed to the next step.
Smoke test UI
You should be able to load the Langfuse UI, by opening http://<instance-ip>:3000/
in your browser.
Go ahead and register, create a new organization, project, and explore Langfuse.
Shutdown
You can stop the containers by hitting Ctrl+C
in the terminal.
If you started docker-compose in the background (-d
flag), you can stop all instance using:
docker compose -f docker-compose.v3beta.yml down
Adding the -v
flag will also remove the volumes.
Ensure to stop the VM instance in your cloud provider interface to avoid unnecessary costs.
How to Upgrade
To upgrade Langfuse, you can stop all instances and run docker compose -f docker-compose.v3beta.yml up --pull always
.