DockerUbuntu

Deploy FlowiseAI with Docker and Caddy in Ubuntu

Installing FlowiseAI using Docker

FlowiseAI is an advanced AI platform that enables developers to build, train, and manage machine learning models efficiently. Its flexibility and scalability make it a popular choice for AI and ML projects. This blog will guide you through the deployment of FlowiseAI using Docker and setting up a simple proxy with Caddy on Ubuntu 24.04

What’s FlowiseAI

FlowiseAI is a powerful AI and machine learning platform designed for developing complex models with ease. With a user-friendly interface, it supports various AI frameworks and scales effortlessly to handle extensive datasets. FlowiseAI is ideal for professionals seeking to streamline AI operations and enhance model deployment.

Install Docker

Installing Docker on Ubuntu 24.04 is straightforward. First, update your package list:

apt update && apt upgrade -y

Then, install Docker’s package dependencies:

apt install apt-transport-https ca-certificates curl software-properties-common

Add Docker’s official GPG key and repository:

install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker:

apt update && apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Setup FlowiseAI Using Docker-Compose

Create a docker-compose.yml file to define the FlowiseAI service:

vim docker-compose.yml

---
services:
    flowise:
        image: flowiseai/flowise
        restart: always
        environment:
            - PORT=${PORT}
            - CORS_ORIGINS=${CORS_ORIGINS}
            - IFRAME_ORIGINS=${IFRAME_ORIGINS}
            - FLOWISE_USERNAME=${FLOWISE_USERNAME}
            - FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
            - FLOWISE_FILE_SIZE_LIMIT=${FLOWISE_FILE_SIZE_LIMIT}
            - DEBUG=${DEBUG}
            - DATABASE_PATH=${DATABASE_PATH}
            - DATABASE_TYPE=${DATABASE_TYPE}
            - DATABASE_PORT=${DATABASE_PORT}
            - DATABASE_HOST=${DATABASE_HOST}
            - DATABASE_NAME=${DATABASE_NAME}
            - DATABASE_USER=${DATABASE_USER}
            - DATABASE_PASSWORD=${DATABASE_PASSWORD}
            - DATABASE_SSL=${DATABASE_SSL}
            - DATABASE_SSL_KEY_BASE64=${DATABASE_SSL_KEY_BASE64}
            - APIKEY_PATH=${APIKEY_PATH}
            - SECRETKEY_PATH=${SECRETKEY_PATH}
            - FLOWISE_SECRETKEY_OVERWRITE=${FLOWISE_SECRETKEY_OVERWRITE}
            - LOG_LEVEL=${LOG_LEVEL}
            - LOG_PATH=${LOG_PATH}
            - BLOB_STORAGE_PATH=${BLOB_STORAGE_PATH}
            - DISABLE_FLOWISE_TELEMETRY=${DISABLE_FLOWISE_TELEMETRY}
            - MODEL_LIST_CONFIG_JSON=${MODEL_LIST_CONFIG_JSON}
        ports:
            - '${PORT}:${PORT}'
        volumes:
            - ~/.flowise:/root/.flowise
        entrypoint: /bin/sh -c "sleep 3; flowise start"

Create .env file to set docker-compose.yml vars:

vim .env

PORT=3000
DATABASE_PATH=/root/.flowise
APIKEY_PATH=/root/.flowise
SECRETKEY_PATH=/root/.flowise
LOG_PATH=/root/.flowise/logs
BLOB_STORAGE_PATH=/root/.flowise/storage

# NUMBER_OF_PROXIES= 1
# CORS_ORIGINS=*
# IFRAME_ORIGINS=*

# DATABASE_TYPE=postgres
# DATABASE_PORT=5432
# DATABASE_HOST=""
# DATABASE_NAME=flowise
# DATABASE_USER=root
# DATABASE_PASSWORD=mypassword
# DATABASE_SSL=true
# DATABASE_SSL_KEY_BASE64=<Self signed certificate in BASE64>

# FLOWISE_USERNAME=user
# FLOWISE_PASSWORD=1234
# FLOWISE_SECRETKEY_OVERWRITE=myencryptionkey
# FLOWISE_FILE_SIZE_LIMIT=50mb

# DISABLE_CHATFLOW_REUSE=true

# DEBUG=true
# LOG_LEVEL=debug (error | warn | info | verbose | debug)
# TOOL_FUNCTION_BUILTIN_DEP=crypto,fs
# TOOL_FUNCTION_EXTERNAL_DEP=moment,lodash

# LANGCHAIN_TRACING_V2=true
# LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
# LANGCHAIN_API_KEY=your_api_key
# LANGCHAIN_PROJECT=your_project

# DISABLE_FLOWISE_TELEMETRY=true

# Uncomment the following line to enable model list config, load the list of models from your local config file
# see https://raw.githubusercontent.com/FlowiseAI/Flowise/main/packages/components/models.json for the format
# MODEL_LIST_CONFIG_JSON=/your_model_list_config_file_path

# STORAGE_TYPE=local (local | s3)
# BLOB_STORAGE_PATH=/your_storage_path/.flowise/storage
# S3_STORAGE_BUCKET_NAME=flowise
# S3_STORAGE_ACCESS_KEY_ID=<your-access-key>
# S3_STORAGE_SECRET_ACCESS_KEY=<your-secret-key>
# S3_STORAGE_REGION=us-west-2

Run Docker Compose to start the service:

docker compose up -d

Simple Proxy with Caddy

Caddy is an excellent choice for setting up a reverse proxy due to its ease of use and automatic HTTPS support. Install Caddy on Ubuntu 24.04:

apt update && apt install caddy

Configure Caddy by editing the Caddyfile:

vim /etc/caddy/Caddyfile

Add the following configuration:

:80 {
    reverse_proxy localhost:3000
}

# OR
your_domain_or_IP {
    reverse_proxy localhost:3000
}

Start and enable Caddy:

systemctl enable caddy
systemctl restart caddy
systemctl status caddy

Check FlowiseAI Installation

curl -I localhost
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: public, max-age=0
Content-Length: 2374
Content-Security-Policy: frame-ancestors
Content-Type: text/html; charset=UTF-8
Date: Sat, 22 Jun 2024 19:45:06 GMT
Etag: W/"946-190094358d8"
Last-Modified: Tue, 11 Jun 2024 21:45:27 GMT
Server: Caddy
Vary: Origin

OR access FlowiseAI via web browser.

Reference

Hi, I’m Sysadmin.ID

Leave a Reply

Your email address will not be published. Required fields are marked *