Skip to content

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

Improve docker: exit if db migrations fail

Marc Klingenf292af46f6a6
diff --git a/docker-compose.build.yml b/docker-compose.build.yml
index 0b4006b378..9279891d36 100644
--- a/docker-compose.build.yml
+++ b/docker-compose.build.yml
@@ -16,13 +16,13 @@ services:
environment:
- NODE_ENV=production
- DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres
- - DIRECT_URL=postgresql://postgres:postgres@db:5432/postgres
- NEXTAUTH_SECRET=mysecret
- SALT=mysalt
- NEXTAUTH_URL=http:localhost:3000
- TELEMETRY_ENABLED=${TELEMETRY_ENABLED:-true}
- NEXT_PUBLIC_SIGN_UP_DISABLED=${NEXT_PUBLIC_SIGN_UP_DISABLED:-false}
- LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES=${LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES:-false}
+ restart: always
db:
image: postgres
diff --git a/docker-compose.yml b/docker-compose.yml
index acdb205a61..c602ee8095 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -10,7 +10,6 @@ services:
environment:
- NODE_ENV=production
- DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres
- - DIRECT_URL=postgresql://postgres:postgres@db:5432/postgres
- NEXTAUTH_SECRET=mysecret
- SALT=mysalt
- NEXTAUTH_URL=http:localhost:3000
diff --git a/entrypoint.sh b/entrypoint.sh
index 97c7330daf..edcc2bb81f 100644
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -5,6 +5,13 @@ export DIRECT_URL=$DATABASE_URL
# Apply migrations
prisma migrate deploy
+status=$?
+
+# If migration fails (returns non-zero exit status), exit script with that status
+if [ $status -ne 0 ]; then
+ echo "Applying database migrations failed. Exiting..."
+ exit $status
+fi
# Start background cron job
node cron.js &