🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: fail on errors in database migrations (#4252)
Steffen Schmitzfc94c02058e3
diff --git a/web/entrypoint.sh b/web/entrypoint.shindex ac4e384c06..642df79f73 100644--- a/web/entrypoint.sh+++ b/web/entrypoint.sh@@ -19,23 +19,35 @@ if [ -z "$DIRECT_URL" ]; thenexport DIRECT_URL=$DATABASE_URLfi-# Always execute the scripts, except when disabled.+# Always execute the postgres migration, except when disabled.if [ "$LANGFUSE_AUTO_POSTGRES_MIGRATION_DISABLED" != "true" ]; thenprisma db execute --url "$DIRECT_URL" --file "./packages/shared/scripts/cleanup.sql"# Apply migrationsprisma migrate deploy --schema=./packages/shared/prisma/schema.prisma+fi+status=$?++# If migration fails (returns non-zero exit status), exit script with that status+if [ $status -ne 0 ]; then+ echo "Applying database migrations failed. This is mostly caused by the database being unavailable."+ echo "Exiting..."+ exit $status+fi+# Execute the Clickhouse migration, except when disabled.+# TODO: For now, we use the same flag as for the Postgres migration.+if [ "$LANGFUSE_AUTO_POSTGRES_MIGRATION_DISABLED" != "true" ]; then# Apply Clickhouse migrationscd ./packages/sharedsh ./clickhouse/scripts/up.sh+ status=$?cd ../../fi-status=$?# If migration fails (returns non-zero exit status), exit script with that statusif [ $status -ne 0 ]; then- echo "Applying database migrations failed. This is mostly caused by the database being unavailable."+ echo "Applying clickhouse migrations failed. This is mostly caused by the database being unavailable."echo "Exiting..."exit $statusfi