Building AI tools is exciting, but knowing exactly how they work inside can be hard. Langfuse is a powerful and open-source platform for LLM tracing, metrics, and evals. If you want to keep your data private and lower your costs, the best option is to self host Langfuse on VPS.
This guide will show you how to deploy Langfuse using Docker, Postgres, ClickHouse, and a reverse proxy with SSL.
Why You Should Self Host Langfuse on VPS
Many engineering teams rely on cloud services, but data privacy is so important for AI applications. When you self host Langfuse on VPS, your prompts, completions, and user data never leave your server. Also, you avoid paying expensive cloud fees, which makes your observability stack completely free besides server costs.
This method is ideal for startups, enterprise technical buyers, and security-focused teams who want full control over their infrastructure.
Server Resource Requirements for Self-hosting Langfuse
Langfuse runs multiple microservices, including a web UI, a background worker, PostgreSQL for settings, ClickHouse for fast analytical queries, Redis for queues, and MinIO for file storage.
To self host Langfuse on VPS smoothly for a production environment, you need at least 4 CPU cores, 16GB of RAM, and 100GB of disk space. A reliable Linux VPS server provides the best foundation for this stack.
However, if your AI application involves image generation workflows like Automatic1111 or ComfyUI alongside your LLMs, you will need dedicated hardware. You can check this guide on the best GPU server for Stable Diffusion to see which graphics cards can handle heavy inference while your VPS runs Langfuse in the background.
Once you are done with the foundation, you can proceed to the following steps to deploy Langfuse.
Step 1. Install Docker and Git
Before deploying the platform, log in to your server via SSH and update your system packages. Docker is essential because it isolates the application components, which ensures they run the same everywhere.
Run the following commands to install Docker and Git:
Instead of downloading files directly from GitHub, it is better to create a directory and define your configurations manually. When you self host Langfuse on VPS, you must define secure database passwords and encryption keys so your environment remains safe.
Create a directory and the .env file:
Bash
sudomkdirlangfuse&&sudocdlangfusesudonano.env
Paste the following values in the file, and make sure to replace the dummy passwords and keys with secure strings:
Now you can use the following command to run the application:
Bash
docker-composeup-d
This tells your server to download the required container images and start all the services in the background. It takes about two to three minutes for the databases to initialize and the main web container to become completely healthy.
Step 5. Configure Nginx Reverse Proxy and SSL
By default, the application runs on port 3000. To secure the application and access it via a domain name, you must configure Nginx and install a free Let's Encrypt SSL certificate.
After you successfully self host Langfuse on VPS, you must monitor your system resources closely. Because the platform records every LLM prompt and response, your databases will grow quickly over time. ClickHouse requires significant RAM to process fast analytical queries.
You need to watch your server's memory, CPU, and disk space. You can see how much RAM and CPU each Docker container is using in real-time by running this command:
Bash
dockerstats
If you notice that clickhouse or langfuse-worker is constantly hitting 100% of your available memory, you will need to upgrade your server to prevent crashes.
Next, you must monitor your storage. Because PostgreSQL and MinIO store your application data and files, they will consume disk space. Run this command to check your remaining storage:
Bash
df-h
Finally, if the web interface ever feels slow or stops loading, you can check the background logs to see if there are any database connection errors. Run this command inside your langfuse directory:
Bash
docker-composelogs--tail=50-f
By regularly checking these basic commands on your AI hosting infrastructure, you ensure that your traces and evals process in real time without losing any valuable data.
Conclusion
It is a smart technical decision to self host Langfuse on VPS for total control over your AI data. You learned how to prepare your server, configure Docker with ClickHouse and Postgres, and secure your setup.
Once you self host Langfuse on VPS, you can track every LLM call and token cost easily.
Scaling an AI observability platform can become challenging as your team grows. If you are a growing company looking for the right infrastructure to support both your LLMs and your self-hosted Langfuse setup securely, read this breakdown of the best AI hosting for startups.
Yes, the open-source platform is MIT licensed and free to deploy. You only pay for your server costs.
Yes, modern versions use PostgreSQL for state and ClickHouse as the primary database for fast trace analytics.
Yes, you can run the same Docker Compose setup locally to test it before moving to a remote server.
We use cookies to run PerLod and to understand how the site is used. You can accept everything, or open Manage to turn individual categories off. Cookie policy.