Files
model-platform/docker-compose.yml
T

225 lines
6.5 KiB
YAML

name: ${COMPOSE_PROJECT_NAME:-model-platform-new}
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
services:
mysql:
image: mysql:8.0.36
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
- --default-time-zone=+08:00
ports:
- "${MYSQL_PORT:-3308}:3306"
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
start_period: 20s
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"
healthcheck:
test:
- CMD
- python
- -c
- "import os, urllib.request; r=urllib.request.Request('http://127.0.0.1:8888/jupyter/api/status', headers={'Authorization':'Bearer '+os.environ['JUPYTER_TOKEN']}); urllib.request.urlopen(r, timeout=3)"
interval: 10s
timeout: 5s
retries: 15
start_period: 30s
migrate:
build:
context: .
dockerfile: backend/Dockerfile
environment:
<<: *app-environment
command: ["alembic", "upgrade", "head"]
depends_on:
mysql:
condition: service_healthy
restart: "no"
backend:
build:
context: .
dockerfile: backend/Dockerfile
restart: unless-stopped
environment:
<<: *app-environment
SERVICE_NAME: backend
READINESS_TARGETS: mysql:3306,rustfs:9000
RUNTIME_API_URL: http://runtime:8000
SCHEDULE_API_URL: http://schedule: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
healthcheck:
test:
- CMD
- python
- -c
- "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health/ready', timeout=3)"
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
volumes:
- ./deploy/data/workspaces:/workspace/workspaces
ports:
- "${BACKEND_PORT:-8010}:8000"
depends_on:
migrate:
condition: service_completed_successfully
mysql:
condition: service_healthy
rustfs:
condition: service_started
runtime:
build:
context: .
dockerfile: runtime/Dockerfile
restart: unless-stopped
environment:
<<: *app-environment
SERVICE_NAME: runtime-manager
READINESS_TARGETS: mysql:3306,jupyter:8888
FILE_LOCK_ENABLED: "false"
FILE_LOCK_TTL_MS: "45000"
JUPYTER_INTERNAL_URL: http://jupyter:8888/jupyter/
JUPYTER_PROXY_BASE_PATH: /jupyter/
JUPYTER_TICKET_TTL_SECONDS: "300"
RUNTIME_LEASE_SECONDS: "1800"
healthcheck:
test:
- CMD
- python
- -c
- "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health/ready', timeout=3)"
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
ports:
- "${RUNTIME_PORT:-8012}:8000"
depends_on:
migrate:
condition: service_completed_successfully
mysql:
condition: service_healthy
jupyter:
condition: service_healthy
schedule:
build:
context: .
dockerfile: schedule/Dockerfile
restart: unless-stopped
environment:
<<: *app-environment
SERVICE_NAME: schedule-executor
READINESS_TARGETS: mysql:3306,rustfs:9000,backend:8000
RUSTFS_INTERNAL_ENDPOINT: http://rustfs:9000
RUSTFS_ACCESS_KEY: ${RUSTFS_ACCESS_KEY:-modelplatform}
RUSTFS_SECRET_KEY: ${RUSTFS_SECRET_KEY:-modelplatformsecret}
BACKEND_API_URL: http://backend:8000
healthcheck:
test:
- CMD
- python
- -c
- "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health/ready', timeout=3)"
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
volumes:
- ./deploy/data/workspaces:/workspace/workspaces
ports:
- "${SCHEDULE_PORT:-8013}:8000"
depends_on:
mysql:
condition: service_healthy
rustfs:
condition: service_started
backend:
condition: service_healthy
gateway:
build:
context: .
dockerfile: nginx/Dockerfile
restart: unless-stopped
environment:
INTERNAL_SERVICE_TOKEN: ${INTERNAL_SERVICE_TOKEN:-local-internal-token}
ports:
- "${GATEWAY_PORT:-8081}:80"
depends_on:
backend:
condition: service_healthy
runtime:
condition: service_healthy
schedule:
condition: service_healthy
jupyter:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1/health >/dev/null 2>&1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 5s
volumes:
mysql_data:
rustfs_data: