Files
smartmate/docker-compose.full.yml
2026-05-09 17:51:04 +08:00

320 lines
9.0 KiB
YAML

name: smartflow-full
x-backend-common: &backend-common
restart: unless-stopped
working_dir: /app/backend
environment:
TZ: Asia/Shanghai
SMARTFLOW_CONFIG_FILE: /app/backend/config.docker.yaml
ARK_API_KEY: ${ARK_API_KEY:-}
SMARTFLOW_USERAUTH_ALLOWREGISTER: ${SMARTFLOW_USERAUTH_ALLOWREGISTER:-}
SMARTFLOW_NOTIFICATION_FRONTENDBASEURL: ${SMARTFLOW_NOTIFICATION_FRONTENDBASEURL:-}
SMARTFLOW_CORS_ALLOWEDORIGINS: ${SMARTFLOW_CORS_ALLOWEDORIGINS:-}
volumes:
- ./backend/config.docker.yaml:/app/backend/config.docker.yaml:ro
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
etcd:
condition: service_healthy
minio:
condition: service_healthy
milvus-standalone:
condition: service_healthy
services:
mysql:
image: ${SMARTFLOW_MYSQL_IMAGE:-mysql:8.0}
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: root_password_123
MYSQL_DATABASE: smartflow
MYSQL_USER: smartflow_user
MYSQL_PASSWORD: smartflow_password_456
command: --default-authentication-plugin=mysql_native_password
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h localhost -uroot -proot_password_123"]
interval: 10s
timeout: 5s
retries: 10
redis:
image: ${SMARTFLOW_REDIS_IMAGE:-redis:7}
restart: unless-stopped
command: redis-server --appendonly yes --requirepass redis_password_789
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "redis_password_789", "ping"]
interval: 10s
timeout: 5s
retries: 10
kafka:
image: ${SMARTFLOW_KAFKA_IMAGE:-apache/kafka:3.7.2}
restart: unless-stopped
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
CLUSTER_ID: MkU3OEVBNTcwNTJENDM2Qk
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_NUM_PARTITIONS: 3
KAFKA_DEFAULT_REPLICATION_FACTOR: 1
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_LOG_DIRS: /var/lib/kafka/data
volumes:
- kafka_data:/var/lib/kafka/data
healthcheck:
test: ["CMD-SHELL", "/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list >/dev/null 2>&1"]
interval: 10s
timeout: 5s
retries: 15
kafka-init:
image: ${SMARTFLOW_KAFKA_IMAGE:-apache/kafka:3.7.2}
restart: "no"
depends_on:
kafka:
condition: service_healthy
entrypoint:
- /bin/bash
- -lc
- |
set -e
for topic in \
smartflow.agent.outbox \
smartflow.task.outbox \
smartflow.memory.outbox \
smartflow.active-scheduler.outbox \
smartflow.notification.outbox \
smartflow.taskclass-forum.outbox \
smartflow.llm.outbox \
smartflow.token-store.outbox
do
/opt/kafka/bin/kafka-topics.sh \
--bootstrap-server kafka:9092 \
--create \
--if-not-exists \
--topic "$$topic" \
--partitions 3 \
--replication-factor 1
done
etcd:
image: ${SMARTFLOW_ETCD_IMAGE:-quay.io/coreos/etcd:v3.5.5}
restart: unless-stopped
environment:
ETCD_AUTO_COMPACTION_MODE: revision
ETCD_AUTO_COMPACTION_RETENTION: "1000"
ETCD_QUOTA_BACKEND_BYTES: "4294967296"
ETCD_SNAPSHOT_COUNT: "50000"
command: >
etcd
-advertise-client-urls=http://etcd:2379
-listen-client-urls=http://0.0.0.0:2379
--data-dir=/etcd
volumes:
- etcd_data:/etcd
healthcheck:
test: ["CMD", "etcdctl", "endpoint", "health"]
interval: 10s
timeout: 5s
retries: 20
minio:
image: ${SMARTFLOW_MINIO_IMAGE:-minio/minio:RELEASE.2023-03-20T20-16-18Z}
restart: unless-stopped
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
command: minio server /minio_data --console-address ":9001"
ports:
- "${SMARTFLOW_MINIO_API_PORT:-9000}:9000"
- "${SMARTFLOW_MINIO_CONSOLE_PORT:-9001}:9001"
volumes:
- minio_data:/minio_data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 20
milvus-standalone:
image: ${SMARTFLOW_MILVUS_IMAGE:-milvusdb/milvus:v2.4.4}
restart: unless-stopped
command: ["milvus", "run", "standalone"]
environment:
ETCD_USE_EMBED: "false"
ETCD_ENDPOINTS: etcd:2379
MINIO_ADDRESS: minio:9000
ports:
- "${SMARTFLOW_MILVUS_PORT:-19530}:19530"
- "${SMARTFLOW_MILVUS_HEALTH_PORT:-9091}:9091"
volumes:
- milvus_data:/var/lib/milvus
depends_on:
etcd:
condition: service_healthy
minio:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
interval: 10s
timeout: 5s
retries: 30
attu:
image: ${SMARTFLOW_ATTU_IMAGE:-zilliz/attu:v2.4.3}
restart: unless-stopped
profiles: ["ops"]
ports:
- "${SMARTFLOW_ATTU_PORT:-8000}:3000"
environment:
MILVUS_URL: milvus-standalone:19530
depends_on:
milvus-standalone:
condition: service_healthy
userauth:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_USERAUTH:-smartflow/userauth:latest}
command: ["/app/bin/userauth"]
notification:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_NOTIFICATION:-smartflow/notification:latest}
command: ["/app/bin/notification"]
active-scheduler:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_ACTIVE_SCHEDULER:-smartflow/active-scheduler:latest}
command: ["/app/bin/active-scheduler"]
schedule:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_SCHEDULE:-smartflow/schedule:latest}
command: ["/app/bin/schedule"]
task:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_TASK:-smartflow/task:latest}
command: ["/app/bin/task"]
task-class:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_TASK_CLASS:-smartflow/task-class:latest}
command: ["/app/bin/task-class"]
course:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_COURSE:-smartflow/course:latest}
command: ["/app/bin/course"]
memory:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_MEMORY:-smartflow/memory:latest}
command: ["/app/bin/memory"]
agent:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_AGENT:-smartflow/agent:latest}
command: ["/app/bin/agent"]
taskclassforum:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_TASKCLASSFORUM:-smartflow/taskclassforum:latest}
command: ["/app/bin/taskclassforum"]
tokenstore:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_TOKENSTORE:-smartflow/tokenstore:latest}
command: ["/app/bin/tokenstore"]
llm:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_LLM:-smartflow/llm:latest}
command: ["/app/bin/llm"]
api:
<<: *backend-common
image: ${SMARTFLOW_IMAGE_API:-smartflow/api:latest}
command: ["/app/bin/api"]
ports:
- "${SMARTFLOW_API_PORT:-8080}:8080"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
etcd:
condition: service_healthy
minio:
condition: service_healthy
milvus-standalone:
condition: service_healthy
userauth:
condition: service_started
notification:
condition: service_started
active-scheduler:
condition: service_started
schedule:
condition: service_started
task:
condition: service_started
task-class:
condition: service_started
course:
condition: service_started
memory:
condition: service_started
agent:
condition: service_started
taskclassforum:
condition: service_started
tokenstore:
condition: service_started
llm:
condition: service_started
frontend:
image: ${SMARTFLOW_IMAGE_FRONTEND:-smartflow/frontend:latest}
restart: unless-stopped
ports:
- "${SMARTFLOW_FRONTEND_PORT:-80}:80"
- "${SMARTFLOW_FRONTEND_HTTPS_PORT:-443}:443"
volumes:
- ./deploy/certs:/etc/nginx/certs:ro
- ./deploy/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
api:
condition: service_started
volumes:
mysql_data:
redis_data:
kafka_data:
etcd_data:
minio_data:
milvus_data: