Update Makefile with new variables and start command

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-04-01 16:12:19 -03:00
commit 305745273f

View file

@ -1,6 +1,11 @@
.PHONY: all init format lint build build_frontend install_frontend run_frontend run_backend dev help tests coverage .PHONY: all init format lint build build_frontend install_frontend run_frontend run_backend dev help tests coverage
all: help all: help
log_level ?= debug
host ?= 0.0.0.0
port ?= 7860
env ?= .env
open_browser ?= true
setup_poetry: setup_poetry:
pipx install poetry pipx install poetry
@ -69,17 +74,16 @@ endif
run_cli: run_cli:
@echo 'Running the CLI' @echo 'Running the CLI'
@make install_frontend > /dev/null @make install_frontend > /dev/null
@echo 'Building the frontend'
@make build_frontend > /dev/null
@echo 'Install backend dependencies' @echo 'Install backend dependencies'
@make install_backend > /dev/null @make install_backend > /dev/null
@echo 'Building the frontend'
@make build_frontend > /dev/null
ifdef env ifdef env
poetry run langflow run --path src/frontend/build --host $(host) --port $(port) --env-file $(env) @make start env=$(env) host=$(host) port=$(port) log_level=$(log_level)
else else
poetry run langflow run --path src/frontend/build --host $(host) --port $(port) --env-file .env @make start host=$(host) port=$(port) log_level=$(log_level)
endif endif
run_cli_debug: run_cli_debug:
@echo 'Running the CLI in debug mode' @echo 'Running the CLI in debug mode'
@make install_frontend > /dev/null @make install_frontend > /dev/null
@ -88,11 +92,21 @@ run_cli_debug:
@echo 'Install backend dependencies' @echo 'Install backend dependencies'
@make install_backend > /dev/null @make install_backend > /dev/null
ifdef env ifdef env
poetry run langflow run --path src/frontend/build --log-level debug --host $(host) --port $(port) --env-file $(env) @make start env=$(env) host=$(host) port=$(port) log_level=debug
else else
poetry run langflow run --path src/frontend/build --log-level debug --host $(host) --port $(port) --env-file .env @make start host=$(host) port=$(port) log_level=debug
endif endif
start:
@echo 'Running the CLI'
ifeq ($(open_browser),false)
poetry run langflow run --path src/frontend/build --log-level $(log_level) --host $(host) --port $(port) --env-file $(env) --no-open-browser
else
poetry run langflow run --path src/frontend/build --log-level $(log_level) --host $(host) --port $(port) --env-file $(env)
endif
setup_devcontainer: setup_devcontainer:
make init make init
make build_frontend make build_frontend
@ -123,7 +137,7 @@ ifeq ($(login),1)
poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env --loop asyncio poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env --loop asyncio
else else
@echo "Running backend with autologin"; @echo "Running backend with autologin";
LANGFLOW_AUTO_LOGIN=True poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env --loop asyncio LANGFLOW_AUTO_LOGIN=True poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env
endif endif
build_and_run: build_and_run: