Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 4 additions & 38 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Then deploy:

### Model Serving Engine

`serving_engine` in `docker/config.cfg` selects the runtime that serves the models in `models=`. The rest of the stack (LiteLLM, Flowise, Postgres, Redis, Langfuse) is identical either way, and applications always talk to LiteLLM on port 4000 — so switching engines does not change any client code.
`serving_engine` in `docker/config.cfg` selects the runtime that serves the models in `models=`. The rest of the stack (LiteLLM, Postgres, Redis, Langfuse) is identical either way, and applications always talk to LiteLLM on port 4000 — so switching engines does not change any client code.

```ini
serving_engine=vllm # default
Expand Down Expand Up @@ -237,13 +237,12 @@ tool_call_parser=qwen3_coder # vLLM only
deploy_docker_fresh=off

# Optional services
deploy_agenticai_plugin=off # Flowise agent builder
deploy_observability=off # Langfuse LLM tracing (ClickHouse + MinIO)

# Proxy (if needed)
http_proxy=<http_proxy>
https_proxy=<https_proxy>
no_proxy=localhost,127.0.0.1,.genai-gateway,.redis,.postgres,.flowise
no_proxy=localhost,127.0.0.1,.genai-gateway,.redis,.postgres
```

Secrets are auto-generated and stored in `docker/vault.yml`.
Expand All @@ -257,7 +256,6 @@ Secrets are auto-generated and stored in `docker/vault.yml`.
|---|---|---|
| vLLM **or** OpenVINO Model Server | 2080+ | Model inference (one container per model, `serving_engine` selects which) |
| LiteLLM | 4000 | API Gateway |
| Flowise | 3000 | Agent builder |
| Langfuse | 3002 | LLM tracing (optional) |

---
Expand All @@ -266,7 +264,6 @@ Secrets are auto-generated and stored in `docker/vault.yml`.

| Service | URL |
|---|---|
| Flowise | `http://localhost:3000` |
| LiteLLM | `http://localhost:4000` |
| vLLM (`serving_engine=vllm`) | `http://localhost:2080/v1` |
| OpenVINO Model Server (`serving_engine=openvino`) | `http://localhost:2080/v3` |
Expand All @@ -275,37 +272,6 @@ Secrets are auto-generated and stored in `docker/vault.yml`.
Service credentials (databases, API keys) are in `docker/.env`, generated from
`docker/vault.yml`.

### Flowise First-Time Setup

Flowise has no environment-based admin bootstrap: the first administrator is created in the
browser on the **Setup Account** page, and that creation request is *unauthenticated* —
whoever submits it first becomes the sole organization owner, and everyone after them is
rejected with `You can only have one organization`.

So port 3000 is published on **loopback only**. Open `http://localhost:3000` on the Docker
host and complete Setup Account. Browsing from another machine? Tunnel rather than
publishing the port:

```bash
ssh -L 3000:127.0.0.1:3000 <user>@<docker-host>
```

Once the owner exists, any later `deploy.sh` run detects it and sets
`DENYLIST_URLS=/api/v1/account/register`, closing the endpoint for good. No manual step is
required, and nothing is lost: in open-source mode that endpoint only ever succeeds for the
first organization.

To publish the port on all interfaces anyway — only after Setup Account is done, and only
if the host is on a trusted network — set in `docker/.env`:

```properties
FLOWISE_BIND_ADDR=0.0.0.0
```

> ⚠ Clear `FLOWISE_DENYLIST_URLS` in `docker/.env` if you ever set
> `FLOWISE_EE_LICENSE_KEY`. Flowise Enterprise reuses that same endpoint to let invited
> users complete their signup with an invite code.

---

## Database Access
Expand All @@ -322,10 +288,10 @@ Per-service users/passwords are auto-generated into `docker/.env` (source: `dock
```bash
source docker/.env

# Postgres (swap PGVECTOR_* for LITELLM_DB_*, FLOWISE_DB_*, LANGFUSE_DB_*, or POSTGRES_ADMIN_PASSWORD)
# Postgres (swap PGVECTOR_* for LITELLM_DB_*, LANGFUSE_DB_*, or POSTGRES_ADMIN_PASSWORD)
psql "postgresql://${PGVECTOR_USER}:${PGVECTOR_PASSWORD}@localhost:5432/${PGVECTOR_DB}"

# Redis (swap REDIS_PASSWORD/user "admin" for LITELLM_REDIS_PASSWORD, FLOWISE_REDIS_PASSWORD, or LANGFUSE_REDIS_PASSWORD)
# Redis (swap REDIS_PASSWORD/user "admin" for LITELLM_REDIS_PASSWORD or LANGFUSE_REDIS_PASSWORD)
redis-cli -h localhost -p 6379 -a "${REDIS_PASSWORD}"
```

Expand Down
1 change: 0 additions & 1 deletion docker/config.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
hugging_face_token=
models=google/gemma-4-26B-A4B-it
deploy_docker_fresh=off
deploy_agenticai_plugin=off
deploy_observability=off
http_proxy=
https_proxy=
Expand Down
127 changes: 3 additions & 124 deletions docker/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ done
_dcfg() { grep "^${1}=" "${DOCKER_CFG}" 2>/dev/null | cut -d= -f2- | sed 's/#.*//' | tr -d '[:space:]' || true; }

if [[ "${#PROFILES[@]}" -eq 0 && -f "${DOCKER_CFG}" ]]; then
[[ "$(_dcfg deploy_agenticai_plugin)" == "on" ]] && PROFILES+=(flowise)
[[ "$(_dcfg deploy_observability)" == "on" ]] && PROFILES+=(observability)
fi

Expand Down Expand Up @@ -369,7 +368,7 @@ if [[ "${DO_DOWN}" == "true" ]]; then
COMPOSE_CMD="${DOCKER_COMPOSE_CMD} -f ${COMPOSE_FILE}"
[[ -f "${ENV_FILE}" ]] && COMPOSE_CMD+=" --env-file ${ENV_FILE}"
# Always include all known profiles so their volumes are also removed
for p in flowise observability; do
for p in observability; do
COMPOSE_CMD+=" --profile ${p}"
done
info "Stopping containers and removing all volumes (passwords are regenerated on each deploy)..."
Expand Down Expand Up @@ -529,37 +528,16 @@ LITELLM_DB_PASSWORD=$(_vault litellm_db_password)
[[ -z "${LITELLM_DB_PASSWORD}" ]] && LITELLM_DB_PASSWORD=$(_vault postgresql_password)
[[ -z "${LITELLM_DB_PASSWORD}" ]] && die "LITELLM_DB_PASSWORD not found in vault.yml. Please regenerate vault.yml by running: bash docker/scripts/generate-vault-secrets.sh"

FLOWISE_DB_PASSWORD=$(_vault flowise_db_password)
[[ -z "${FLOWISE_DB_PASSWORD}" ]] && FLOWISE_DB_PASSWORD=$(_vault agenticai_postgres_password)
[[ -z "${FLOWISE_DB_PASSWORD}" ]] && die "FLOWISE_DB_PASSWORD not found in vault.yml. Please regenerate vault.yml by running: bash docker/scripts/generate-vault-secrets.sh"

# Redis — admin + per-service ACL passwords (all from vault)
REDIS_PASSWORD=$(_vault redis_password)
[[ -z "${REDIS_PASSWORD}" ]] && die "REDIS_PASSWORD not found in vault.yml. Please regenerate vault.yml by running: bash docker/scripts/generate-vault-secrets.sh"

LITELLM_REDIS_PASSWORD=$(_vault litellm_redis_password)
[[ -z "${LITELLM_REDIS_PASSWORD}" ]] && die "LITELLM_REDIS_PASSWORD not found in vault.yml. Please regenerate vault.yml by running: bash docker/scripts/generate-vault-secrets.sh"

FLOWISE_REDIS_PASSWORD=$(_vault flowise_redis_password)
[[ -z "${FLOWISE_REDIS_PASSWORD}" ]] && die "FLOWISE_REDIS_PASSWORD not found in vault.yml. Please regenerate vault.yml by running: bash docker/scripts/generate-vault-secrets.sh"

LANGFUSE_REDIS_PASSWORD=$(_vault langfuse_redis_password)
[[ -z "${LANGFUSE_REDIS_PASSWORD}" ]] && die "LANGFUSE_REDIS_PASSWORD not found in vault.yml. Please regenerate vault.yml by running: bash docker/scripts/generate-vault-secrets.sh"

FLOWISE_API_KEY=$(_vault flowise_api_key) # may be empty — set after first run

# NOTE: Flowise 3.1.2 has NO environment-based admin bootstrap — the image contains no
# reference to FLOWISE_ADMIN_EMAIL/FLOWISE_ADMIN_PASSWORD, and its `user` CLI can only
# reset the password of an already-existing account. The first owner is therefore
# created by a human through the UI's "Setup Account" page on first run. Those two
# vault keys are intentionally NOT propagated to .env or the container: writing
# credentials that nothing consumes implies a pre-provisioned admin that does not exist.
FLOWISE_API_KEY=$(_vault flowise_api_key) # may be empty — set after first run

# Loopback-only publish address for Flowise (see docker-compose.yml). Override in
# config.cfg / environment only after first-time setup has been completed.
FLOWISE_BIND_ADDR="${FLOWISE_BIND_ADDR:-127.0.0.1}"

PGVECTOR_PASSWORD=$(_vault pgvector_password)
[[ -z "${PGVECTOR_PASSWORD}" ]] && die "PGVECTOR_PASSWORD not found in vault.yml. Please regenerate vault.yml by running: bash docker/scripts/generate-vault-secrets.sh"

Expand All @@ -586,12 +564,6 @@ MINIO_ROOT_USER="${MINIO_ROOT_USER:-minio}" # Username can have a default
MINIO_ROOT_PASSWORD=$(_vault minio_secret)
[[ -z "${MINIO_ROOT_PASSWORD}" ]] && die "MINIO_ROOT_PASSWORD not found in vault.yml. Please regenerate vault.yml by running: bash docker/scripts/generate-vault-secrets.sh"

# Preserve existing FLOWISE_API_KEY if .env exists
if [[ -f "${ENV_FILE}" ]]; then
_existing_key=$(grep '^FLOWISE_API_KEY=' "${ENV_FILE}" 2>/dev/null | cut -d= -f2- | tr -d '"' || true)
[[ -z "${FLOWISE_API_KEY}" && -n "${_existing_key}" ]] && FLOWISE_API_KEY="${_existing_key}"
fi

# Secrets from vault (stable across redeploys)
LANGFUSE_NEXTAUTH_SECRET=$(_vault langfuse_nextauth_secret)
LANGFUSE_NEXTAUTH_SECRET="${LANGFUSE_NEXTAUTH_SECRET:-$(openssl rand -hex 16 2>/dev/null || true)}"
Expand All @@ -606,7 +578,6 @@ cat > "${DOCKER_DIR}/redis/acl.conf" << ACLEOF
user default off nopass nocommands
user admin on #$(_sha256 "${REDIS_PASSWORD}") ~* &* +@all
user litellm on #$(_sha256 "${LITELLM_REDIS_PASSWORD}") ~* &* +@all
user flowise on #$(_sha256 "${FLOWISE_REDIS_PASSWORD}") ~* &* +@all
user langfuse on #$(_sha256 "${LANGFUSE_REDIS_PASSWORD}") ~* &* +@all
ACLEOF
chmod 600 "${DOCKER_DIR}/redis/acl.conf"
Expand All @@ -628,23 +599,20 @@ cat > "${DOCKER_DIR}/postgres/init.sql" << SQLEOF
-- Per-service roles (users)
-- =======================================================
CREATE USER litellm WITH PASSWORD '${LITELLM_DB_PASSWORD}';
CREATE USER flowise WITH PASSWORD '${FLOWISE_DB_PASSWORD}';
CREATE USER langfuse WITH PASSWORD '${LANGFUSE_DB_PASSWORD}';
CREATE USER agentuser WITH PASSWORD '${PGVECTOR_PASSWORD}';

-- =======================================================
-- Per-service databases (each owned by its user)
-- =======================================================
CREATE DATABASE litellm OWNER litellm;
CREATE DATABASE flowisedb OWNER flowise;
CREATE DATABASE langfuse OWNER langfuse;
CREATE DATABASE agentdb OWNER agentuser;

-- =======================================================
-- Revoke public connection access (defence-in-depth)
-- =======================================================
REVOKE CONNECT ON DATABASE litellm FROM PUBLIC;
REVOKE CONNECT ON DATABASE flowisedb FROM PUBLIC;
REVOKE CONNECT ON DATABASE langfuse FROM PUBLIC;
REVOKE CONNECT ON DATABASE agentdb FROM PUBLIC;

Expand All @@ -660,7 +628,7 @@ chmod 644 "${DOCKER_DIR}/postgres/init.sql"
# without routing through the corporate proxy. We also export the variable so
# that docker compose (invoked below) uses this value even when the host shell
# already has $NO_PROXY set from /etc/environment or similar system-wide files.
_docker_services="flowise,litellm,vllm,ovms,pgvector,langfuse-web,redis,postgres,clickhouse,minio"
_docker_services="litellm,vllm,ovms,pgvector,langfuse-web,redis,postgres,clickhouse,minio"
_model_containers=$(get_model_container_names)
NO_PROXY="${NO_PROXY:+${NO_PROXY},}localhost,127.0.0.1,${_docker_services},${_model_containers}"
export NO_PROXY
Expand All @@ -669,12 +637,6 @@ export NO_PROXY
_litellm_no_proxy_before=""
[[ -f "${ENV_FILE}" ]] && _litellm_no_proxy_before=$(grep '^NO_PROXY=' "${ENV_FILE}" 2>/dev/null | cut -d= -f2-)

# Preserve the Flowise registration lockdown across redeploys. Empty on a fresh
# deployment (the admin still has to create the owner account); set to the register
# endpoint by the post-start reconcile below once an owner exists.
FLOWISE_DENYLIST_URLS=""
[[ -f "${ENV_FILE}" ]] && FLOWISE_DENYLIST_URLS=$(grep '^FLOWISE_DENYLIST_URLS=' "${ENV_FILE}" 2>/dev/null | cut -d= -f2-)

# Write .env
cat > "${ENV_FILE}" << EOF
# Auto-generated by deploy.sh on $(date)
Expand All @@ -698,19 +660,8 @@ LITELLM_DB_NAME=litellm
# Redis — admin (health checks) + per-service ACL passwords
REDIS_PASSWORD="${REDIS_PASSWORD}"
LITELLM_REDIS_PASSWORD="${LITELLM_REDIS_PASSWORD}"
FLOWISE_REDIS_PASSWORD="${FLOWISE_REDIS_PASSWORD}"
LANGFUSE_REDIS_PASSWORD="${LANGFUSE_REDIS_PASSWORD}"

# Flowise host publish address — loopback by default so that an instance with an empty
# database is not reachable from an untrusted network before its owner account exists.
FLOWISE_BIND_ADDR=${FLOWISE_BIND_ADDR}
# Set to /api/v1/account/register once the owner exists (managed by deploy.sh).
FLOWISE_DENYLIST_URLS=${FLOWISE_DENYLIST_URLS}
FLOWISE_DB_USER=flowise
FLOWISE_DB_PASSWORD="${FLOWISE_DB_PASSWORD}"
FLOWISE_DB_NAME=flowisedb
FLOWISE_API_KEY="${FLOWISE_API_KEY}"

PGVECTOR_USER=agentuser
PGVECTOR_PASSWORD="${PGVECTOR_PASSWORD}"
PGVECTOR_DB=agentdb
Expand Down Expand Up @@ -837,7 +788,6 @@ print_deployment_config() {
# Components
echo -e "${CYAN}── Components ─────────────────────────────────────────${NC}"
echo " GenAI Gateway (LiteLLM) : on"
echo " Flowise : on"
echo " Consumer Portal : on"
echo " PostgreSQL + pgvector : on"
echo " Redis Stack : on"
Expand Down Expand Up @@ -874,7 +824,7 @@ check_system_resources() {
local models=$(get_model_list)
IFS=',' read -ra _MODEL_LIST <<< "$models"
local model_count=${#_MODEL_LIST[@]}
local base_memory=8 # Base services (litellm, flowise, etc.)
local base_memory=8 # Base services (litellm, postgres, redis, etc.)
local model_memory=$((model_count * 80)) # ~80GB per model

local required_memory=$((base_memory + model_memory))
Expand Down Expand Up @@ -1026,56 +976,6 @@ elif [[ -n "${_litellm_config_hash_after}" && "${_litellm_config_hash_before}" !
eval "${DOCKER_COMPOSE_CMD} -f ${COMPOSE_FILE} ${MODEL_COMPOSE_ARG} --env-file ${ENV_FILE} restart litellm" || warn "LiteLLM restart failed (non-fatal)"
fi

# ---------------------------------------------------------------------------
# Post-start: Flowise first-boot protection (flowise profile)
# ---------------------------------------------------------------------------
# Flowise 3.1.2 creates its first organization owner through an UNAUTHENTICATED
# POST /api/v1/account/register. Only the first caller to reach that endpoint can ever
# become the owner — every later attempt is refused with "You can only have one
# organization" — so that account needs to be claimed by the administrator. Two
# measures, applied here:
# 1. Flowise is published on loopback only (FLOWISE_BIND_ADDR), so an instance with
# an empty database is not reachable from an untrusted network.
# 2. Once an owner exists, /api/v1/account/register is dropped from Flowise's public
# whitelist via DENYLIST_URLS so the endpoint cannot be reached at all.
# Step 2 costs no functionality in open-source mode: that endpoint only ever succeeds
# for the first organization and returns 400 for every later caller, authenticated or
# not. It MUST be reverted if FLOWISE_EE_LICENSE_KEY is ever set, because Enterprise
# mode reuses the same endpoint for invited users completing their signup.
FLOWISE_SETUP_PENDING=0
if [[ " ${PROFILES[*]} " =~ " flowise " ]]; then
info "Flowise: checking first-boot state..."
for i in $(seq 1 36); do
if ${DOCKER_CMD} exec agentic-flowise curl -sf http://localhost:3000/api/v1/ping &>/dev/null 2>&1; then
break
fi
sleep 5
done

# Does an owner already exist? No output (table absent on a fresh database) => no.
_flowise_orgs=$(${DOCKER_CMD} exec -e PGPASSWORD="${FLOWISE_DB_PASSWORD}" agentic-postgres \
psql -U "${FLOWISE_DB_USER:-flowise}" -d "${FLOWISE_DB_NAME:-flowisedb}" \
-tAc "SELECT count(*) FROM organization" 2>/dev/null | tr -d '[:space:]' || true)
[[ "${_flowise_orgs}" =~ ^[0-9]+$ ]] || _flowise_orgs=0

if [[ "${_flowise_orgs}" -gt 0 ]]; then
if [[ "${FLOWISE_DENYLIST_URLS}" != "/api/v1/account/register" ]]; then
info "Flowise: owner account found — closing the registration endpoint..."
sed -i 's|^FLOWISE_DENYLIST_URLS=.*|FLOWISE_DENYLIST_URLS=/api/v1/account/register|' "${ENV_FILE}"
if eval "${DOCKER_COMPOSE_CMD} -f ${COMPOSE_FILE} --env-file ${ENV_FILE} --profile flowise up -d --force-recreate flowise"; then
ok "Flowise: registration endpoint closed"
else
warn "Flowise: could not recreate container to apply the lockdown (non-fatal)"
fi
else
ok "Flowise: registration endpoint already closed"
fi
else
FLOWISE_SETUP_PENDING=1
info "Flowise: no owner account yet — claim it in the UI (see summary below)"
fi
fi

# ---------------------------------------------------------------------------
# Post-start: create MinIO langfuse bucket (observability profile)
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -1104,11 +1004,6 @@ echo -e "${BLUE}═════════════════════
echo -e "${GREEN} Agentic AI Stack — Deployed Successfully!${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════${NC}"
echo ""
for p in "${PROFILES[@]:-}"; do
case "${p}" in
flowise) echo " Flowise Admin : http://localhost:3000 (bound to ${FLOWISE_BIND_ADDR})" ;;
esac
done
echo " LiteLLM UI : http://localhost:4000"
for p in "${PROFILES[@]:-}"; do
case "${p}" in
Expand All @@ -1117,22 +1012,6 @@ for p in "${PROFILES[@]:-}"; do
;;
esac
done
if [[ "${FLOWISE_SETUP_PENDING}" -eq 1 ]]; then
echo ""
echo -e "${YELLOW}── Flowise first-time setup ───────────────────────────────────${NC}"
echo " Flowise has no owner account yet. The first caller to reach port 3000"
echo " becomes the sole organization owner, so claim it before anyone else:"
echo ""
echo -e " 1. Open ${CYAN}http://localhost:3000${NC} on this machine."
echo " Browsing from elsewhere? Tunnel rather than publishing the port:"
echo -e " ${CYAN}ssh -L 3000:127.0.0.1:3000 <user>@$(hostname -f 2>/dev/null || hostname)${NC}"
echo " 2. Complete the \"Setup Account\" page (name, email, password)."
echo ""
echo " The port is bound to ${FLOWISE_BIND_ADDR}, so only this host can reach it."
echo " Nothing further is required. Any later run of this script will notice"
echo " the owner exists and close the registration endpoint for good."
echo -e "${YELLOW}──────────────────────────────────────────────────────────────${NC}"
fi
echo ""
echo " Logs: docker compose -f docker/docker-compose.yml logs -f [service]"
echo " Stop+clean: bash docker/deploy.sh --down"
Expand Down
Loading
Loading