feat: deploy langflow using langchain-serve
This commit is contained in:
parent
ad1a1e683f
commit
52093240b1
5 changed files with 57 additions and 0 deletions
11
Makefile
11
Makefile
|
|
@ -46,6 +46,17 @@ build:
|
||||||
poetry build --format sdist
|
poetry build --format sdist
|
||||||
rm -rf src/backend/langflow/frontend
|
rm -rf src/backend/langflow/frontend
|
||||||
|
|
||||||
|
lcserve_push:
|
||||||
|
make build_frontend
|
||||||
|
@version=$$(poetry version --short); \
|
||||||
|
lc-serve push --app langflow.lcserve:app --app-dir . \
|
||||||
|
--image-name langflow --image-tag $${version} \
|
||||||
|
--version deep-0.0.1 --verbose
|
||||||
|
|
||||||
|
lcserve_deploy:
|
||||||
|
@:$(if $(uses),,$(error `uses` is not set. Please run `make uses=... lcserve_deploy`))
|
||||||
|
lc-serve deploy jcloud --app langflow.lcserve:app --app-dir . --uses $(uses) --verbose
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
make install_frontend
|
make install_frontend
|
||||||
ifeq ($(build),1)
|
ifeq ($(build),1)
|
||||||
|
|
|
||||||
2
jcloud.yml
Normal file
2
jcloud.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
instance: C4
|
||||||
|
autoscale_min: 1
|
||||||
16
lcserve.Dockerfile
Normal file
16
lcserve.Dockerfile
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# This file is used by `lc-serve` to build the image.
|
||||||
|
# Don't change the name of this file.
|
||||||
|
|
||||||
|
FROM jinawolf/serving-gateway:${version}
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install --no-install-recommends -y build-essential libpq-dev
|
||||||
|
|
||||||
|
COPY . /appdir/
|
||||||
|
|
||||||
|
RUN pip install poetry==1.4.0 && cd /appdir && pip install . && \
|
||||||
|
pip uninstall -y poetry && \
|
||||||
|
apt-get remove --auto-remove -y build-essential libpq-dev && \
|
||||||
|
apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*
|
||||||
|
|
||||||
|
ENTRYPOINT [ "jina", "gateway", "--uses", "config.yml" ]
|
||||||
|
|
@ -69,6 +69,20 @@ def serve(
|
||||||
LangflowApplication(app, options).run()
|
LangflowApplication(app, options).run()
|
||||||
|
|
||||||
|
|
||||||
|
@app.command()
|
||||||
|
def jcloud():
|
||||||
|
"""
|
||||||
|
Deploy Langflow server on Jina AI Cloud
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
from importlib.metadata import version as mod_version
|
||||||
|
|
||||||
|
app_name = "langflow.lcserve:app"
|
||||||
|
version = mod_version("langflow")
|
||||||
|
uses = f"jinaai+docker://langflow:{version}"
|
||||||
|
os.system(f"lc-serve deploy jcloud --app {app_name} --app-dir . --uses {uses}")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
app()
|
app()
|
||||||
|
|
||||||
|
|
|
||||||
14
src/backend/langflow/lcserve.py
Normal file
14
src/backend/langflow/lcserve.py
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# This file is used by lc-serve to load the mounted app and serve it.
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
from langflow.main import create_app
|
||||||
|
|
||||||
|
app = create_app()
|
||||||
|
path = Path(__file__).parent
|
||||||
|
static_files_dir = path / "frontend"
|
||||||
|
app.mount(
|
||||||
|
"/",
|
||||||
|
StaticFiles(directory=static_files_dir, html=True),
|
||||||
|
name="static",
|
||||||
|
)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue