Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

improved docker handling

Max Deichmanne6e59b87ac78
diff --git a/.blub b/.blub
new file mode 100644
index 0000000000..1be04bb350
--- /dev/null
+++ b/.blub
@@ -0,0 +1,17 @@
+# When adding additional environment variables, the schema in "/src/env.mjs"
+# should be updated accordingly.
+
+# Prisma
+# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
+DIRECT_URL="postgresql://postgres:postgres@localhost:5432/postgres"
+DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"
+
+# Next Auth
+# You can generate a new secret on the command line with:
+# openssl rand -base64 32
+# https://next-auth.js.org/configuration/options#secret
+# NEXTAUTH_SECRET=""
+NEXTAUTH_URL="http://localhost:3000"
+NEXTAUTH_SECRET="secret"
+
+PYPI_TOKEN="pypi-AgEIcHlwaS5vcmcCJGYyMzA0YThiLWQ2MjItNDkwMS1iNGNlLTc1NzQyMDFhMGRjNgACKlszLCJmYmJjNTQ5Ny1jMzFiLTRmNDUtOGIzZi00NDNmODY3ZjIyMjIiXQAABiCfICFD9NinOXgkTqwaQlRNIGiWua18fEWvpC-8IsDWGQ"
\ No newline at end of file
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index 99474d8e24..067ff9a299 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -57,4 +57,9 @@ jobs:
npm run build
- name: Build Docker image
- run: docker build . -t langfuse
+ run: |
+ docker build \
+ --build-arg DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres \
+ --build-arg NEXTAUTH_SECRET=mysecret \
+ --build-arg NEXTAUTH_URL=http:localhost:3030 \
+ -t langfuse .
diff --git a/Dockerfile b/Dockerfile
index 9864ea2e6e..ff14ec0aba 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,8 @@
# Base image
FROM node:18-alpine AS base
+ARG DATABASE_URL
+ARG NEXTAUTH_SECRET
+ARG NEXTAUTH_URL
# Install dependencies only when needed
FROM base AS deps
diff --git a/README.md b/README.md
index cadd93ae00..d373019196 100644
--- a/README.md
+++ b/README.md
@@ -28,8 +28,6 @@ Debug and improve your LLM-based application by logging/analyzing all user inter
Follow the steps below to set up the environment via docker-compose. Both the server and the database will be running in docker containers.
```bash
-# create env file
-cp .env.local.example .env
# execute docker-compose
docker-compose up
```
@@ -66,12 +64,18 @@ npm run dev
The following instructions explain how to create a single container for deployment. The container will contain the server but no database. Please adjust the db url in the .env file to point to your database.
```bash
-# create env file
-cp .env.dev.example .env
# build the container
-docker build -t langfuse .
+docker build \
+--build-arg DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres \
+--build-arg NEXTAUTH_SECRET=mysecret \
+--build-arg NEXTAUTH_URL=http:localhost:3030 \
+-t langfuse .
# run the container
-docker run -dp 3030:3000 langfuse
+docker run \
+--env DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres \
+--env NEXTAUTH_SECRET=mysecret \
+--env NEXTAUTH_URL=http:localhost:3030 \
+-dp 3030:3000 langfuse
```
### Generate SDKs
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index 7ca890bc84..a1a251314a 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -12,6 +12,11 @@ services:
- 5432:5432
volumes:
- database_data:/var/lib/postgresql/data
+ networks:
+ - langfuse-network
+
+networks:
+ langfuse-network:
volumes:
database_data:
diff --git a/docker-compose.yml b/docker-compose.yml
index 1f77d6137e..dff8ea6593 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -4,6 +4,10 @@ services:
server:
build:
dockerfile: Dockerfile
+ args:
+ - DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres
+ - NEXTAUTH_SECRET=mysecret
+ - NEXTAUTH_URL=http:localhost:3030
command: ["sh", "-c", "npx prisma migrate deploy && node server.js"]
depends_on:
- db
@@ -12,7 +16,10 @@ services:
environment:
- NODE_ENV=development
- DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres
- - DIRECT_URL=postgresql://postgres:postgres@db:5432/postgres
+ - DIRECT_URL=postgresql://postgres:postgres@db:5432/postgres\
+ - NEXTAUTH_SECRET=mysecret
+ - NEXTAUTH_URL=http:localhost:3030
+
db:
image: postgres
restart: always