Files
AILab/server/docker-compose.yaml
T
2025-09-26 16:24:44 +08:00

215 lines
5.0 KiB
YAML

x-kong-config:
&kong-env
KONG_DATABASE: postgres
KONG_PG_HOST: postgres
KONG_PG_DATABASE: kong
KONG_PG_USER: postgres
KONG_PG_PASSWORD: 123456
services:
# ---------- Vue 前端 ----------
vue:
container_name: ce_vue
image: ce_vue:latest
networks:
- ce_network
restart: always
# ---------- Python 后端 ----------
backend:
container_name: ce_pybackend
image: ce_pybackend:latest
networks:
- ce_network
restart: unless-stopped
depends_on:
- vue
extra_hosts:
- "s1.ronsunny.cn:10.10.10.9"
# ---------- PostgreSQL ----------
postgres:
container_name: ce_postgres
image: postgres:15-alpine
environment:
POSTGRES_DB: ktor # 实际上这里已经没用了,因为卷已经创建了,现在在用ktor2、kong两个数据库
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 123456
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- ce_network
restart: unless-stopped
# ---------- Redis ----------
redis:
container_name: ce_redis
image: redis:7.2.3-alpine
volumes:
- redis_data:/data
ports:
- "6379:6379"
networks:
- ce_network
restart: unless-stopped
# ---------- MinIO ----------
minio:
container_name: ce_minio
image: minio/minio:RELEASE.2025-03-12T18-04-18Z
environment:
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio_data:/data
networks:
- ce_network
restart: unless-stopped
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
# ---------- ETCD ----------
etcd:
container_name: ce_etcd
image: quay.io/coreos/etcd:v3.5.18
environment:
- ETCD_AUTO_COMPACTION_MODE=revision
- ETCD_AUTO_COMPACTION_RETENTION=1000
- ETCD_QUOTA_BACKEND_BYTES=4294967296
- ETCD_SNAPSHOT_COUNT=50000
networks:
- ce_network
volumes:
- etcd_data:/data/etcd
command: etcd -advertise-client-urls=http://etcd:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /data/etcd
healthcheck:
test: ["CMD", "etcdctl", "endpoint", "health"]
interval: 30s
timeout: 20s
retries: 3
# ---------- Milvus ----------
milvus:
container_name: ce_milvus
image: milvusdb/milvus:v2.6.1
command: ["milvus", "run", "standalone"]
security_opt:
- seccomp:unconfined
environment:
ETCD_ENDPOINTS: etcd:2379
MINIO_ADDRESS: minio:9000
MQ_TYPE: woodpecker
networks:
- ce_network
volumes:
- milvus_data:/var/lib/milvus
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
interval: 30s
start_period: 90s
timeout: 20s
retries: 3
ports:
- "19530:19530" # 服务用
- "9091:9091" # GUI用
depends_on:
- etcd
- minio
# ---------- Attu ----------
attu:
container_name: ce_attu
image: zilliz/attu:v2.6
environment:
MILVUS_URL: ce_milvus:19530
networks:
- ce_network
ports:
- "3000:3000" # 浏览器访问端口
restart: unless-stopped
depends_on:
- milvus
# ---------- Kong 网关 ----------
kong-migrations:
image: kong:3.9.1-ubuntu
container_name: ce_kong_migrations
command: kong migrations bootstrap
depends_on:
- postgres
environment:
<<: *kong-env
networks:
- ce_network
restart: on-failure
kong-migrations-up:
image: kong:3.9.1-ubuntu
container_name: ce_kong_migrations_up
command: kong migrations up && kong migrations finish
depends_on:
- postgres
environment:
<<: *kong-env
networks:
- ce_network
restart: on-failure
kong:
image: kong:3.9.1-ubuntu
container_name: ce_kong
user: kong
environment:
<<: *kong-env
KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_PROXY_ACCESS_LOG: /dev/stdout
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_PREFIX: /var/run/kong
KONG_PROXY_LISTEN: "0.0.0.0:8090" # 对外暴露端口
KONG_ADMIN_LISTEN: "0.0.0.0:8001" # Admin GUI
KONG_ADMIN_GUI_LISTEN: "0.0.0.0:8002"
ports:
- "8090:8090" # 代理端口对外
- "8001:8001/tcp"
- "8002:8002/tcp"
- "8444:8444/tcp"
volumes:
- kong_prefix_vol:${KONG_PREFIX:-/var/run/kong}
- kong_tmp_vol:/tmp
- ./config:/opt/kong
networks:
- ce_network
restart: unless-stopped
# ---------- 数据卷 ----------
volumes:
postgres_data:
redis_data:
minio_data:
etcd_data:
milvus_data:
kong_prefix_vol:
driver_opts:
type: tmpfs
device: tmpfs
kong_tmp_vol:
driver_opts:
type: tmpfs
device: tmpfs
# ---------- 网络 ----------
networks:
ce_network:
driver: bridge