Skip to content

Commit

Permalink
Merge pull request #24 from logspace-ai/dev
Browse files Browse the repository at this point in the history
Release 0.0.33
  • Loading branch information
rodrigosnader authored Mar 16, 2023
2 parents 7ce3d05 + e06565e commit 472b0d6
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 51 deletions.
35 changes: 33 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,44 @@ so that more people can benefit from it.
remember to include the code you ran and if possible, extract only the relevant
parts and don't just dump your entire script. This will make it easier for us to
reproduce the error.

- **Sharing long blocks of code or logs:** If you need to include long code,
logs or tracebacks, you can wrap them in `<details>` and `</details>`. This
[collapses the content](https://developer.mozilla.org/en/docs/Web/HTML/Element/details)
so it only becomes visible on click, making the issue easier to read and follow.

### Issue labels

[See this page](https://github.com/logspace-ai/langflow/labels) for an overview of
the system we use to tag our issues and pull requests.


### Local development
You can develop LangFlow using docker compose, or locally.

#### **Docker compose**
This will run the backend and frontend in separate containers. The frontend will be available at `localhost:3000` and the backend at `localhost:5003`.
```bash
docker compose up --build
```

#### **Locally**
Run locally by cloning the repository and installing the dependencies. We recommend using a virtual environment to isolate the dependencies from your system.

Before you start, make sure you have the following installed:
- Poetry
- Node.js

For the backend, you will need to install the dependencies and start the development server.
```bash
poetry install
# Port 5003 is required for the backend to work with the frontend
make run_backend
```
For the frontend, you will need to install the dependencies and start the development server.
```bash
cd langflow/frontend
npm install
npm start
```

6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ lint:
install_frontend:
cd langflow/frontend && npm install

run_frontend:
cd langflow/frontend && npm start

run_backend:
poetry run uvicorn langflow_backend.main:app --port 5003 --reload

build_frontend:
cd langflow/frontend && CI='' npm run build

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<img alt="" src="https://img.shields.io/github/repo-size/logspace-ai/langflow" />
<img alt="GitHub Issues" src="https://img.shields.io/github/issues/logspace-ai/langflow" />
<img alt="GitHub Pull Requests" src="https://img.shields.io/github/issues-pr/logspace-ai/langflow" />
<img alt="Github License" src="https://img.shields.io/github/license/logspace-ai/langflow" />
<img alt="Github License" src="https://img.shields.io/github/license/logspace-ai/langflow" />
</p>

<a href="https://github.com/logspace-ai/langflow">
Expand All @@ -26,7 +26,7 @@ You can install LangFlow from pip:

Next, run:

`python -m langflow` or just `langflow`
`langflow`

## 🎨 Creating Flows

Expand Down
14 changes: 6 additions & 8 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10
FROM python:3.10-slim

WORKDIR /app

# Install Poetry
RUN apt-get update && apt-get install -y curl
RUN curl -sSL https://install.python-poetry.org | python3 -
# Add Poetry to PATH
RUN curl -sSL https://install.python-poetry.org | python3 -
# # Add Poetry to PATH
ENV PATH="${PATH}:/root/.local/bin"
# Copy the pyproject.toml and poetry.lock files
# # Copy the pyproject.toml and poetry.lock files
COPY poetry.lock pyproject.toml ./
# Copy the rest of the application codes
COPY ./ ./


# install dependencies
# Install dependencies
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi


CMD ["uvicorn", "langflow.cli:app", "--host", "0.0.0.0", "--port", "5003"]
CMD ["uvicorn", "langflow_backend.main:app", "--host", "0.0.0.0", "--port", "5003", "--reload"]
11 changes: 8 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ services:
- "5003:5003"
volumes:
- ./:/app
environment:
- PYTHONPATH=/langflow # add this line to set PYTHONPATH
platform: linux/amd64
command: bash -c "uvicorn langflow_backend.main:app --host 0.0.0.0 --port 5003 --reload"

frontend:
build: ./langflow/frontend
build:
context: ./langflow/frontend
dockerfile: ./dev.Dockerfile
ports:
- "3000:3000"
volumes:
- ./langflow/frontend:/app
# Set process.env.BACKEND to the backend service
environment:
- BACKEND="http://backend:5003"
8 changes: 8 additions & 0 deletions docker_example/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.11-slim

WORKDIR /app
COPY ./ /app
RUN pip install langflow>=0.0.33

EXPOSE 5003
CMD ["langflow", "--host", "0.0.0.0"]
11 changes: 11 additions & 0 deletions docker_example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3'

services:
langflow:
build:
context: ./
dockerfile: Dockerfile
ports:
- "5003:5003"
command: langflow --host 0.0.0.0
platform: linux/amd64
3 changes: 1 addition & 2 deletions langflow/backend/langflow_backend/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def get_number_of_workers(workers=None):


def serve(
host: str = "127.0.0.1",
workers: int = 1,
timeout: int = 60,
):
Expand All @@ -27,8 +28,6 @@ def serve(
StaticFiles(directory=static_files_dir, html=True),
name="static",
)

host = "127.0.0.1"
port = 5003
options = {
"bind": f"{host}:{port}",
Expand Down
7 changes: 6 additions & 1 deletion langflow/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
FROM logspace/frontend_build as frontend_build
FROM node:14-alpine as frontend_build
ARG BACKEND
WORKDIR /app
COPY . /app
RUN npm install
RUN npm run build

FROM nginx
COPY --from=frontend_build /app/build/ /usr/share/nginx/html
Expand Down
6 changes: 6 additions & 0 deletions langflow/frontend/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:14-alpine as frontend_build
ARG BACKEND
WORKDIR /app
COPY . /app
RUN npm install
CMD ["npm", "start"]
Loading

0 comments on commit 472b0d6

Please sign in to comment.