name | description | languages | products | page_type | urlFragment | |||||
---|---|---|---|---|---|---|---|---|---|---|
Langfuse on Azure |
Deploy Langfuse to Azure Container Apps using the Azure Developer CLI. |
|
|
sample |
langfuse-on-azure |
Use the Azure Developer CLI to deploy Langfuse to Azure Container Apps with PostgreSQL Flexible server.
Langfuse is a platform for LLM observability and evaluation. They provide an open-source SDK and containerized web application to receive the SDK's data. This project deploys the Langfuse web application to Azure Container Apps, and uses PostgreSQL to store the data. It also includes a script to set up Entra-based authentication for the web app. Once you have deployed Langfuse, you can integrate the SDK into your LLM applications according to the Langfuse documentation and start sending data to the web app.
From a deployed Generations tab in Langfuse:
Table of contents:
You have a few options for setting up this project. The easiest way to get started is GitHub Codespaces, since it will setup all the tools for you, but you can also set it up locally if desired.
You can run this repo virtually by using GitHub Codespaces, which will open a web-based VS Code in your browser:
Once the codespace opens (this may take several minutes), open a terminal window.
A related option is VS Code Dev Containers, which will open the project in your local VS Code using the Dev Containers extension:
- Start Docker Desktop (install it if not already installed)
- Open the project:
- In the VS Code window that opens, once the project files show up (this may take several minutes), open a terminal window.
-
Install the required tools:
- Azure Developer CLI
- Python 3.9, 3.10, or 3.11 (Only necessary if you want to enable authentication)
-
Create a new folder and switch to it in the terminal.
-
Run this command to download the project code:
azd init -t langfuse-on-azure
Note that this command will initialize a git repository, so you do not need to clone this repository.
-
Create a Python virtual environment and install the required packages:
pip install -r requirements.txt
-
Open a terminal window inside the project folder.
Follow these steps to deploy Langfuse to Azure:
-
Login to your Azure account:
azd auth login
-
Create a new azd environment:
azd env new
Enter a name that will be used for the resource group. This will create a new folder in the
.azure
folder, and set it as the active environment for any calls toazd
going forward. -
(Optional) By default, the deployed Azure Container App will use the Langfuse authentication system, meaning anyone with routable network access to the web app can attempt to login to it. To enable Entra-based authentication, set the
AZURE_USE_AUTHENTICATION
environment variable totrue
:azd env set AZURE_USE_AUTHENTICATION true
Then set the
AZURE_AUTH_TENANT_ID
environment variable to your tenant ID:azd env set AZURE_AUTH_TENANT_ID your-tenant-id
-
Run this command to provision all the resources:
azd provision
This will create a new resource group, and create the Azure Container App and PostgreSQL Flexible server inside that group. If you enabled authentication, it will use the
auth_init.sh
andauth_update.sh
hooks to set up the necessary resources for Entra-based authentication, and pass the necessary environment variables to the Azure Container App. -
Once the deployment is complete, you will see the URL for the Azure Container App in the output. You can open this URL in your browser to see the Langfuse web app.
Langfuse is an external project and is not affiliated with Microsoft.