🪢 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
chore: add worker entrypoint to handle alternative database config (#3283)
Steffen Schmitz9cce111be61f
diff --git a/worker/Dockerfile b/worker/Dockerfileindex 1ddc8c24f8..8737b3f36e 100644--- a/worker/Dockerfile+++ b/worker/Dockerfile@@ -61,9 +61,14 @@ RUN addgroup --system --gid 1001 expressjsRUN adduser --system --uid 1001 expressjsUSER expressjsCOPY --from=builder --chown=expressjs:expressjs /app .+COPY --chown=expressjs:expressjs ./worker/entrypoint.sh ./worker/entrypoint.sh+RUN chmod +x ./worker/entrypoint.shEXPOSE 3030ENV PORT=3030-ENTRYPOINT ["dumb-init", "--", "node", "worker/dist/index.js"]+ENTRYPOINT ["dumb-init", "--", "./worker/entrypoint.sh"]++# startup command+CMD ["node", "worker/dist/index.js"]diff --git a/worker/entrypoint.sh b/worker/entrypoint.shnew file mode 100644index 0000000000..c4e2de5810--- /dev/null+++ b/worker/entrypoint.sh@@ -0,0 +1,18 @@+#!/bin/sh++# Run cleanup script before running migrations+# Check if DATABASE_URL is not set+if [ -z "$DATABASE_URL" ]; then+ # Check if all required variables are provided+ if [ -n "$DATABASE_HOST" ] && [ -n "$DATABASE_USERNAME" ] && [ -n "$DATABASE_PASSWORD" ] && [ -n "$DATABASE_NAME" ]; then+ # Construct DATABASE_URL from the provided variables+ DATABASE_URL="postgresql://${DATABASE_USERNAME}:${DATABASE_PASSWORD}@${DATABASE_HOST}/${DATABASE_NAME}"+ export DATABASE_URL+ else+ echo "Error: Required database environment variables are not set. Provide a postgres url for DATABASE_URL."+ exit 1+ fi+fi++# Run the command passed to the docker image on start+exec "$@"