This commit is contained in:
tao.chen
2026-07-30 20:02:19 +08:00
parent c1e15758a3
commit ec53edbce5
23 changed files with 191 additions and 1085 deletions
+41 -144
View File
@@ -1,100 +1,16 @@
name: ${COMPOSE_PROJECT_NAME:-model-platform-refactored}
x-app-environment: &app-environment
DATABASE_URL: mysql+asyncmy://${MYSQL_USER:-model_platform}:${MYSQL_PASSWORD:-model_platform}@mysql:3306/${MYSQL_DATABASE:-model_platform}?charset=utf8mb4
INTERNAL_SERVICE_TOKEN: ${INTERNAL_SERVICE_TOKEN:-local-internal-token}
JUPYTER_TOKEN: ${JUPYTER_TOKEN:-local-jupyter-token}
WORKSPACE_ROOT: /workspace/workspaces
version: '3.8'
services:
mysql:
image: mysql:8.0.36
web:
image: nginx:alpine
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-model_platform_root}
MYSQL_DATABASE: ${MYSQL_DATABASE:-model_platform}
MYSQL_USER: ${MYSQL_USER:-model_platform}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-model_platform}
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_0900_ai_ci
ports:
- "${MYSQL_PORT:-3308}:3306"
- "${GATEWAY_PORT:-8888}:80"
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -u root -p$$MYSQL_ROOT_PASSWORD --silent"]
interval: 10s
timeout: 5s
retries: 15
redis:
image: redis:7.2.5-alpine
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes", "--requirepass", "${REDIS_PASSWORD:-model_platform_redis}"]
ports:
- "${REDIS_PORT:-6380}:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD-SHELL", "redis-cli -a '${REDIS_PASSWORD:-model_platform_redis}' ping | grep PONG"]
interval: 10s
timeout: 5s
retries: 10
rustfs:
image: ${RUSTFS_IMAGE:-rustfs/rustfs:latest}
restart: unless-stopped
environment:
RUSTFS_ADDRESS: ":9000"
RUSTFS_CONSOLE_ENABLE: "true"
RUSTFS_CONSOLE_ADDRESS: ":9001"
RUSTFS_ACCESS_KEY: ${RUSTFS_ACCESS_KEY:-modelplatform}
RUSTFS_SECRET_KEY: ${RUSTFS_SECRET_KEY:-modelplatformsecret}
command: ["/data"]
ports:
- "${RUSTFS_API_PORT:-9010}:9000"
- "${RUSTFS_CONSOLE_PORT:-9011}:9001"
volumes:
- rustfs_data:/data
jupyter:
image: ${JUPYTER_IMAGE:-quay.io/jupyter/base-notebook:2025-12-31}
restart: unless-stopped
environment:
JUPYTER_TOKEN: ${JUPYTER_TOKEN:-local-jupyter-token}
command:
- start-notebook.py
- --ServerApp.base_url=/jupyter/
- --ServerApp.root_dir=/home/jovyan/work
- --ServerApp.ip=0.0.0.0
- --ServerApp.allow_remote_access=True
- --IdentityProvider.token=${JUPYTER_TOKEN:-local-jupyter-token}
- --PasswordIdentityProvider.hashed_password=
volumes:
- ./deploy/data/workspaces:/home/jovyan/work
expose:
- "8888"
migrate:
build:
context: .
dockerfile: backend/Dockerfile
environment:
<<: *app-environment
command:
- uv
- run
- --frozen
- --package
- backend
- alembic
- upgrade
- head
- ./default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
mysql:
condition: service_healthy
restart: "no"
- backend
- runtime
backend:
build:
@@ -102,38 +18,39 @@ services:
dockerfile: backend/Dockerfile
restart: unless-stopped
environment:
<<: *app-environment
SERVICE_NAME: backend
READINESS_TARGETS: mysql:3306,redis:6379,rustfs:9000
DATABASE_URL: mysql+asyncmy://${MYSQL_USER:-model_platform}:${MYSQL_PASSWORD:-model_platform}@mysql:3306/${MYSQL_DATABASE:-model_platform}?charset=utf8mb4
JWT_SECRET: ${JWT_SECRET:-local-jwt-secret}
RUNTIME_API_URL: http://runtime:8000
RUNTIME_BASE_URL: http://runtime:8000
RUSTFS_INTERNAL_ENDPOINT: http://rustfs:9000
RUSTFS_PUBLIC_ENDPOINT: http://localhost:${RUSTFS_API_PORT:-9010}
RUSTFS_ACCESS_KEY: ${RUSTFS_ACCESS_KEY:-modelplatform}
RUSTFS_SECRET_KEY: ${RUSTFS_SECRET_KEY:-modelplatformsecret}
RUSTFS_DEFAULT_BUCKET: model-platform
WORKSPACE_ROOT: /workspace/workspaces
volumes:
- ./deploy/data/workspaces:/workspace/workspaces
- ./backend:/app/backend:ro
- ./common:/app/common:ro
ports:
- "${BACKEND_PORT:-8010}:8000"
- "${BACKEND_PORT:-8004}:8000"
depends_on:
migrate:
condition: service_completed_successfully
mysql:
condition: service_healthy
redis:
condition: service_healthy
rustfs:
condition: service_started
- runtime
runtime:
build:
context: .
dockerfile: runtime/Dockerfile
restart: unless-stopped
cap_add:
- SYS_ADMIN
devices:
- /dev/fuse:/dev/fuse
security_opt:
- apparmor:unconfined
environment:
<<: *app-environment
DATABASE_URL: mysql+asyncmy://${MYSQL_USER:-model_platform}:${MYSQL_PASSWORD:-model_platform}@mysql:3306/${MYSQL_DATABASE:-model_platform}?charset=utf8mb4
SERVICE_NAME: runtime-manager
READINESS_TARGETS: mysql:3306,redis:6379,jupyter:8888
REDIS_HOST: redis
REDIS_PORT: "6379"
REDIS_PASSWORD: ${REDIS_PASSWORD:-model_platform_redis}
@@ -141,15 +58,23 @@ services:
JUPYTER_INTERNAL_URL: http://jupyter:8888/jupyter/
JUPYTER_PROXY_BASE_PATH: /jupyter/
JUPYTER_TICKET_TTL_SECONDS: "300"
WORKSPACES_ROOT: /workspace/workspaces
PUBLIC_BASE_URL: http://runtime
REMOTE_BUCKET: rustfs:workspaces
RCLONE_CONFIG_RUSTFS_TYPE: s3
RCLONE_CONFIG_RUSTFS_PROVIDER: Other
RCLONE_CONFIG_RUSTFS_ACCESS_KEY_ID: ${RUSTFS_ACCESS_KEY:-modelplatform}
RCLONE_CONFIG_RUSTFS_SECRET_ACCESS_KEY: ${RUSTFS_SECRET_KEY:-modelplatformsecret}
RCLONE_CONFIG_RUSTFS_ENDPOINT: http://rustfs:9000
RCLONE_CONFIG_RUSTFS_ENV_AUTH: "false"
RCLONE_CONFIG_RUSTFS_FORCE_PATH_STYLE: "true"
RCLONE_CONFIG_RUSTFS_REGION: other
volumes:
- ./deploy/data/workspaces:/workspace/workspaces
- ./runtime:/app/runtime:ro
- ./common:/app/common:ro
ports:
- "${RUNTIME_PORT:-8012}:8000"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
jupyter:
condition: service_started
- "${RUNTIME_PORT:-8002}:8001"
schedule:
build:
@@ -157,9 +82,7 @@ services:
dockerfile: schedule/Dockerfile
restart: unless-stopped
environment:
<<: *app-environment
SERVICE_NAME: schedule-executor
READINESS_TARGETS: mysql:3306,redis:6379,rustfs:9000,backend:8000
DATABASE_URL: mysql+asyncmy://${MYSQL_USER:-model_platform}:${MYSQL_PASSWORD:-model_platform}@mysql:3306/${MYSQL_DATABASE:-model_platform}?charset=utf8mb4
REDIS_HOST: redis
REDIS_PORT: "6379"
REDIS_PASSWORD: ${REDIS_PASSWORD:-model_platform_redis}
@@ -167,36 +90,10 @@ services:
RUSTFS_ACCESS_KEY: ${RUSTFS_ACCESS_KEY:-modelplatform}
RUSTFS_SECRET_KEY: ${RUSTFS_SECRET_KEY:-modelplatformsecret}
STORAGE_API_URL: http://backend:8000
WORKSPACE_ROOT: /workspace/workspaces
volumes:
- ./deploy/data/workspaces:/workspace/workspaces
ports:
- "${SCHEDULE_PORT:-8013}:8000"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
backend:
condition: service_started
gateway:
image: nginx:1.27-alpine
restart: unless-stopped
environment:
INTERNAL_SERVICE_TOKEN: ${INTERNAL_SERVICE_TOKEN:-local-internal-token}
volumes:
- ./nginx/default.conf.template:/etc/nginx/templates/default.conf.template:ro
ports:
- "${GATEWAY_PORT:-8081}:80"
depends_on:
backend:
condition: service_started
runtime:
condition: service_started
jupyter:
condition: service_started
volumes:
mysql_data:
redis_data:
rustfs_data:
- backend