Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/docker server #1274

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@

## compressed
**/*.tgz

.gitcommands
.gitconfig
.bash-helpers
.gitcommands
.gitconfig
41 changes: 0 additions & 41 deletions Dockerfile

This file was deleted.

60 changes: 20 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,9 @@ Download and Install [NodeJS](https://nodejs.org/en/download) >= 18.15.0

## 🐳 Docker

### Docker Compose
**Go here for [Instructions](https://github.com/FlowiseAI/Flowise/blob/main/docker/README.md)**

1. Go to `docker` folder at the root of the project
2. Copy `.env.example` file, paste it into the same location, and rename to `.env`
3. `docker-compose up -d`
4. Open [http://localhost:3000](http://localhost:3000)
5. You can bring the containers down by `docker-compose stop`

### Docker Image

1. Build the image locally:
```bash
docker build --no-cache -t flowise .
```
2. Run image:

```bash
docker run -d --name flowise -p 3000:3000 flowise
```

3. Stop image:
```bash
docker stop flowise
```


## 👨‍💻 Developers

Expand All @@ -88,31 +67,32 @@ Flowise has 3 different modules in a single mono repository.
git clone https://github.com/FlowiseAI/Flowise.git
```

2. Go into repository folder
2. Use Docker for a better Dev flow (see Docker [Instructions](https://github.com/FlowiseAI/Flowise/blob/main/docker/README.md), and skip the other steps) or Manually:
- Go into repository folder

```bash
cd Flowise
```
```bash
cd Flowise
```

3. Install all dependencies of all modules:
- Install all dependencies of all modules:

```bash
yarn install
```
```bash
yarn install
```

4. Build all the code:
- Build all the code:

```bash
yarn build
```
```bash
yarn build
```

5. Start the app:
- Start the app:

```bash
yarn start
```
```bash
yarn start
```

You can now access the app on [http://localhost:3000](http://localhost:3000)
- You can now access the app on [http://localhost:3000](http://localhost:3000)

6. For development build:

Expand Down
30 changes: 24 additions & 6 deletions docker/.env.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
PORT=3000
DATABASE_PATH=/root/.flowise
APIKEY_PATH=/root/.flowise
SECRETKEY_PATH=/root/.flowise
LOG_PATH=/root/.flowise/logs
#------------------------------------
#-->Docker/codespace
# Avoids the use of 'root' for better compatibility and adherence
DOCKER_USER=flowise
DOCKER_USER_UID=1000
DOCKER_USER_DIR="/home/${DOCKER_USER}"
DOCKER_WORKSPACE_DIR="${DOCKER_USER_DIR}"

#------------------------------------
#-->Standard settings
PORT=3000
APIKEY_PATH="${DOCKER_USER_DIR}/.flowise"
SECRETKEY_PATH="${DOCKER_USER_DIR}/.flowise"
LOG_PATH="${DOCKER_USER_DIR}/.flowise/logs"
DATABASE_PATH="${DOCKER_USER_DIR}/.flowise"
# NUMBER_OF_PROXIES= 1

#------------------------------------
#-->DB [uncomment when in use]
# DATABASE_TYPE=postgres
# DATABASE_PORT=""
# DATABASE_HOST=""
# DATABASE_NAME="flowise"
# DATABASE_USER=""
# DATABASE_PASSWORD=""

#------------------------------------
#-->LangChain [uncomment when in use]
# FLOWISE_USERNAME=user
# FLOWISE_PASSWORD=1234
# FLOWISE_SECRETKEY_OVERWRITE=myencryptionkey
Expand All @@ -21,7 +34,12 @@ LOG_PATH=/root/.flowise/logs
# TOOL_FUNCTION_BUILTIN_DEP=crypto,fs
# TOOL_FUNCTION_EXTERNAL_DEP=moment,lodash

#------------------------------------
#-->LangChain [uncomment when in use]
# LANGCHAIN_TRACING_V2=true
# LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
# LANGCHAIN_API_KEY=your_api_key
# LANGCHAIN_PROJECT=your_project
# LANGCHAIN_PROJECT=your_project

# --> Note:
# --> when uncommenting the above, make sure to also uncomment the following in the docker-compose file
49 changes: 35 additions & 14 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
FROM node:18-alpine
# @knighttower - https://knighttower.io

USER root
# Use Node.js official base image
FROM node:20.2.0-slim

RUN apk add --no-cache git
RUN apk add --no-cache python3 py3-pip make g++
# needed for pdfjs-dist
RUN apk add --no-cache build-base cairo-dev pango-dev
ARG DOCKER_WORKSPACE_DIR

# Install Chromium
RUN apk add --no-cache chromium
# Set environment variables
ENV PUPPETEER_SKIP_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
# Set working directory
WORKDIR $DOCKER_WORKSPACE_DIR

# You can install a specific version like: [email protected]
RUN npm install -g flowise
# Install necessary packages to extend the dev environment and allow other integrations or manipulations
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
curl \
build-essential \
python3 \
python3-pip \
make \
g++ \
git \
libcairo2-dev \
libpango1.0-dev \
chromium \
bash \
wget \
nano \
gcc \
zip \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /data
# Ensure .bashrc exists for root and is executable
RUN touch ~/.bashrc && chmod +x ~/.bashrc
SHELL ["/bin/bash", "--login", "-c"]

CMD "flowise"
# Expose port 3000
EXPOSE 3000
47 changes: 25 additions & 22 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
# Flowise Docker Hub Image
# Docker User Guide

Starts Flowise from [DockerHub Image](https://hub.docker.com/repository/docker/flowiseai/flowise/general)
## 📦 Prerequisites
- NPM or CLI console that supports bash

## Usage
## 🌱 Env Variables
The Autosetup will copy the ENV file automatically, but if you want to customize the configuration, you can copy the `.env.example` file to `.env` and change the values. Otherwise, just skip this step.

1. Create `.env` file and specify the `PORT` (refer to `.env.example`)
2. `docker-compose up -d`
3. Open [http://localhost:3000](http://localhost:3000)
4. You can bring the containers down by `docker-compose stop`
Flowise also support different environment variables to configure your instance. Read [more](https://docs.flowiseai.com/environment-variables)

## 🚀 Quick Start

#### Method A:
From the root dir, run the following command:
`npm run docker:start`

#### Method B:
From the root dir, run the following command:
`sh ./docker/start`

Open [http://localhost:3000](http://localhost:3000)

**Note**: Yarn install, yarn build and start, are automatically executed when you run the start script. If they are not or you need to add other packages or execute them manually, enter the container and run them from there. Do not run these commands outside of the container because they will not work or bring issues with docker performance.
Use: `npm run docker:cli` it will get you inside the docker container bash.

## 🔒 Authentication

1. Create `.env` file and specify the `PORT`, `FLOWISE_USERNAME`, and `FLOWISE_PASSWORD` (refer to `.env.example`)
2. Pass `FLOWISE_USERNAME` and `FLOWISE_PASSWORD` to the `docker-compose.yml` file:
1. Pass `FLOWISE_USERNAME` and `FLOWISE_PASSWORD` to the `docker-compose.yml` file:
```
environment:
- PORT=${PORT}
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
```
3. `docker-compose up -d`
4. Open [http://localhost:3000](http://localhost:3000)
5. You can bring the containers down by `docker-compose stop`

## 🌱 Env Variables

If you like to persist your data (flows, logs, apikeys, credentials), set these variables in the `.env` file inside `docker` folder:

- DATABASE_PATH=/root/.flowise
- APIKEY_PATH=/root/.flowise
- LOG_PATH=/root/.flowise/logs
- SECRETKEY_PATH=/root/.flowise
2. Run `npm run docker:start`
3. Open [http://localhost:3000](http://localhost:3000)
5. You can bring the containers down by `npm run docker:stop`

Flowise also support different environment variables to configure your instance. Read [more](https://docs.flowiseai.com/environment-variables)
25 changes: 25 additions & 0 deletions docker/cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# @knighttower - https://github.com/knighttower
# ------------------
# Docker Start Script
# ------------------

# DO NOT EDIT THIS FILE OR RUN IT DIRECTLY.
# --> Use it executing from the root directory of the project: npm run docker:start
# ------------------

rootDir="$(pwd)"
echo "$rootDir"
dockerDir="$rootDir/docker"
source "$dockerDir/helpers.sh"

# ------------------
# Run the docker command
dockerUser="$(getEnv DOCKER_USER)"
# Check if it is empty and set the default value if it is
# User and container will be the same. It avoid issues/confusions with permissions and allows easy access via bash cli.
if [ "$dockerUser" = "" ]; then
dockerUser="flowise"
fi
echo -e "\e[32m Using dockerUser ----> $dockerUser!\e[0m"
docker exec -it $dockerUser bash
28 changes: 0 additions & 28 deletions docker/docker-compose.yml

This file was deleted.