From e557c0d234c72dab30c626e12f9bf3ae51f5d5d9 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 11 Sep 2023 14:01:48 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(.env.example):=20add=20POS?= =?UTF-8?q?TGRES=5FPORT=20variable=20to=20specify=20the=20port=20for=20Pos?= =?UTF-8?q?tgreSQL=20connection=20=F0=9F=94=A7=20chore(startup-backend.sh)?= =?UTF-8?q?:=20modify=20startup=20script=20to=20start=20the=20backend=20in?= =?UTF-8?q?=20development=20or=20production=20mode=20based=20on=20the=20EN?= =?UTF-8?q?VIRONMENT=20variable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/.env.example | 2 ++ deploy/startup-backend.sh | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/deploy/.env.example b/deploy/.env.example index 20413727c..ab24e0114 100644 --- a/deploy/.env.example +++ b/deploy/.env.example @@ -1,5 +1,6 @@ DOMAIN=localhost STACK_NAME=langflow-stack +ENVIRONMENT=development TRAEFIK_PUBLIC_NETWORK=traefik-public TRAEFIK_TAG=langflow-traefik @@ -19,6 +20,7 @@ LOG_LEVEL=debug POSTGRES_USER=langflow POSTGRES_PASSWORD=langflow POSTGRES_DB=langflow +POSTGRES_PORT=5432 # Flower configuration LANGFLOW_CACHE_TYPE=redis diff --git a/deploy/startup-backend.sh b/deploy/startup-backend.sh index c8a634f65..75c8002a5 100755 --- a/deploy/startup-backend.sh +++ b/deploy/startup-backend.sh @@ -2,5 +2,16 @@ export LANGFLOW_DATABASE_URL="postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}" + # Your command to start the backend -exec python -m uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --log-level ${LOG_LEVEL:-info} --workers -1 + +# If the ENVIRONMENT variable is set to "development", then start the backend in development mode +# else start the backend in production mode with guvicorn +if [ "$ENVIRONMENT" = "development" ]; then + echo "Starting backend in development mode" + exec python -m uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --log-level ${LOG_LEVEL:-info} --workers 2 --reload +else + echo "Starting backend in production mode" + exec langflow run --host 0.0.0.0 --port 7860 --log-level ${LOG_LEVEL:-info} --workers -1 --backend-only +fi +