Deploy Langfuse on Heroku
Before following this guide, please make sure that you are familiar with the self-hosting documentation.
Langfuse is open source (MIT licensed core product) and you can deploy it on any platform to add observability, evaluation and prompt management to your LLM applications. Langfuse is configurable via environment variables, you can find the full list of available configuration options in the self-host guide.
To deploy this image on heroku you have to run through the steps in the following deployment guide:
-
Pull the docker image. This can be achieved by running the following command in your terminal:
docker pull langfuse/langfuse:2
-
Get the ID of the pulled image
Linux / MacOS:
Running the following command should result in directly printing the image ID
docker images | grep langfuse/langfuse | awk '[print $3]'
Following this tutorial, you will always have to insert this image ID when [IMAGE_ID] is written.
Windows:
On windows you can print the full information of the pulled image using:
docker images | findstr /S "langfuse/langfuse"
This will result in something like:
langfuse/langfuse 2 cec90c920468 28 hours ago 595MB
Here you have to manually retrieve the image ID which in this case is
cec90c920468
. It should be located between the tag2
and the created28 hours ago
in this example. -
Prepare your terminal and docker image
First of all, you will have to be logged in to heroku using
heroku login
If this is not working, please visit the heroku CLI setup.
If you succeeded in logging in to heroku via the CLI, you can continue by following the next steps:
Tag the docker image (Insert your image ID into the command). You will also have to insert the name of your heroku app/dyno into [HEROKU_APP_NAME]:
docker tag [IMAGE_ID] registry.heroku.com/[HEROKU_APP_NAME]/web
-
Setup a database for your heroku app
In the dashboard of your heroku app, add the
Heroku Postgres
-AddOn. This will add a PostgreSQL database to your application. -
Set the environment variables
For the minimum deployment in heroku, you will have to set the following environment variables (see table above). The
DATABASE_URL
is your database connection string starting withpostgres://
in the configuration of your added PostgreSQL database.DATABASE_URL= NEXTAUTH_SECRET= NEXTAUTH_URL= SALT=
Have a look at the other optional environment variables in the table above and set them if needed to configure your deployment.
-
Push to heroku container registry
In this step you will push the docker image to the heroku container registry: (Insert the name of your heroku app/dyno)
docker push registry.heroku.com/[HEROKU_APP_NAME]/web
-
Deploy the docker image from the heroku registry
In the last step you will have to execute the following command to finally deploy the image. Again insert the name of your heroku app:
heroku container:release web --app=[HEROKU_APP_NAME]