215 lines
6.4 KiB
YAML
215 lines
6.4 KiB
YAML
x-logging: &default-logging
|
|
driver: json-file
|
|
options:
|
|
max-size: "50m"
|
|
max-file: "5"
|
|
|
|
x-backend-env: &backend-env
|
|
APP_ENV: ${APP_ENV:-production}
|
|
PLANET_ROLE: ${PLANET_ROLE:-all}
|
|
DATABASE_URL: ${DATABASE_URL:-postgresql+asyncpg://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-planet_db}}
|
|
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
|
|
REDIS_PASSWORD:
|
|
AI_PROVIDER_SERVICE_URL: ${AI_PROVIDER_SERVICE_URL:-http://aiprovider:8010}
|
|
AI_PROVIDER_SERVICE_TOKEN:
|
|
SECRET_KEY:
|
|
CORS_ORIGINS: ${CORS_ORIGINS:-[]}
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: ${ACCESS_TOKEN_EXPIRE_MINUTES:-60}
|
|
REFRESH_TOKEN_EXPIRE_DAYS: ${REFRESH_TOKEN_EXPIRE_DAYS:-7}
|
|
INITIAL_ADMIN_USERNAME:
|
|
INITIAL_ADMIN_EMAIL:
|
|
INITIAL_ADMIN_PASSWORD:
|
|
SETTINGS_ENCRYPTION_KEY:
|
|
COLLECTOR_MAX_CONCURRENCY: ${COLLECTOR_MAX_CONCURRENCY:-2}
|
|
COLLECTOR_HEAVY_CONCURRENCY: ${COLLECTOR_HEAVY_CONCURRENCY:-1}
|
|
HTTP_PROXY: ${HTTP_PROXY:-}
|
|
HTTPS_PROXY: ${HTTPS_PROXY:-}
|
|
NO_PROXY: ${NO_PROXY:-localhost,127.0.0.1,postgres,redis,backend,aiprovider,admin}
|
|
|
|
services:
|
|
postgres:
|
|
image: ${POSTGRES_IMAGE:-postgres:15}
|
|
container_name: planet_deploy_postgres
|
|
command:
|
|
- postgres
|
|
- -c
|
|
- shared_buffers=${POSTGRES_SHARED_BUFFERS:-256MB}
|
|
- -c
|
|
- work_mem=${POSTGRES_WORK_MEM:-16MB}
|
|
- -c
|
|
- maintenance_work_mem=${POSTGRES_MAINTENANCE_WORK_MEM:-128MB}
|
|
- -c
|
|
- max_connections=${POSTGRES_MAX_CONNECTIONS:-150}
|
|
- -c
|
|
- autovacuum_vacuum_scale_factor=0.1
|
|
- -c
|
|
- log_min_duration_statement=1000
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
|
POSTGRES_DB: ${POSTGRES_DB:-planet_db}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
mem_limit: ${PLANET_POSTGRES_MEM_LIMIT:-2g}
|
|
logging: *default-logging
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-planet_db}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: ${REDIS_IMAGE:-redis:7-alpine}
|
|
container_name: planet_deploy_redis
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
if [ -n "$$REDIS_PASSWORD" ]; then
|
|
exec redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru --requirepass "$$REDIS_PASSWORD"
|
|
else
|
|
exec redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
|
|
fi
|
|
environment:
|
|
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
|
|
volumes:
|
|
- redis_data:/data
|
|
mem_limit: ${PLANET_REDIS_MEM_LIMIT:-512m}
|
|
logging: *default-logging
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD-SHELL",
|
|
"if [ -n \"$$REDIS_PASSWORD\" ]; then redis-cli -a \"$$REDIS_PASSWORD\" ping; else redis-cli ping; fi",
|
|
]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
aiprovider:
|
|
image: ${AI_PROVIDER_IMAGE_NAME:-planet-aiprovider:latest}
|
|
build:
|
|
context: .
|
|
dockerfile: aiprovider/Dockerfile
|
|
args:
|
|
PYTHON_IMAGE: ${PYTHON_IMAGE:-python:3.14-slim}
|
|
UV_IMAGE: ${UV_IMAGE:-ghcr.io/astral-sh/uv:latest}
|
|
env_file:
|
|
- path: ./aiprovider/.env
|
|
required: false
|
|
environment:
|
|
APP_ENV: ${APP_ENV:-production}
|
|
AI_PROVIDER_SERVICE_TOKEN:
|
|
HTTP_PROXY: ${HTTP_PROXY:-}
|
|
HTTPS_PROXY: ${HTTPS_PROXY:-}
|
|
NO_PROXY: ${NO_PROXY:-localhost,127.0.0.1,postgres,redis,backend,aiprovider,admin}
|
|
container_name: planet_deploy_aiprovider
|
|
mem_limit: ${PLANET_AIPROVIDER_MEM_LIMIT:-512m}
|
|
logging: *default-logging
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8010/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
backend:
|
|
image: ${BACKEND_IMAGE_NAME:-planet-backend:latest}
|
|
build:
|
|
context: .
|
|
dockerfile: backend/Dockerfile
|
|
args:
|
|
PYTHON_IMAGE: ${PYTHON_IMAGE:-python:3.14-slim}
|
|
UV_IMAGE: ${UV_IMAGE:-ghcr.io/astral-sh/uv:latest}
|
|
secrets:
|
|
- planet_uv_config
|
|
env_file:
|
|
- path: ./backend/.env
|
|
required: false
|
|
container_name: planet_deploy_backend
|
|
environment: *backend-env
|
|
expose:
|
|
- "8000"
|
|
volumes:
|
|
- earth_brand_data:/app/backend/data/earth-brand
|
|
- collector_cache:/root/.cache/planet/downloads
|
|
mem_limit: ${PLANET_BACKEND_MEM_LIMIT:-2g}
|
|
logging: *default-logging
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
aiprovider:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8000/health/ready"]
|
|
interval: 15s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
restart: unless-stopped
|
|
|
|
worker:
|
|
profiles:
|
|
- split
|
|
image: ${BACKEND_IMAGE_NAME:-planet-backend:latest}
|
|
container_name: planet_deploy_worker
|
|
command: ["uv", "run", "--frozen", "--no-dev", "--project", "/app", "python", "-m", "app.worker"]
|
|
env_file:
|
|
- path: ./backend/.env
|
|
required: false
|
|
environment:
|
|
<<: *backend-env
|
|
PLANET_ROLE: worker
|
|
volumes:
|
|
- collector_cache:/root/.cache/planet/downloads
|
|
mem_limit: ${PLANET_WORKER_MEM_LIMIT:-2g}
|
|
logging: *default-logging
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
aiprovider:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
|
|
admin:
|
|
image: ${ADMIN_IMAGE_NAME:-planet-admin:latest}
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
args:
|
|
BUN_IMAGE: ${BUN_IMAGE:-oven/bun:1-alpine}
|
|
NGINX_IMAGE: ${NGINX_IMAGE:-nginx:1.27-alpine}
|
|
PLANET_FRONTEND_TARGET: ${PLANET_FRONTEND_TARGET:-full}
|
|
container_name: planet_deploy_admin
|
|
environment:
|
|
PLANET_BACKEND_UPSTREAM: backend:8000
|
|
ports:
|
|
- "${PLANET_ADMIN_BIND_HOST:-0.0.0.0}:${PLANET_ADMIN_PORT:-3000}:3000"
|
|
mem_limit: ${PLANET_ADMIN_MEM_LIMIT:-256m}
|
|
logging: *default-logging
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/health"]
|
|
interval: 15s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
earth_brand_data:
|
|
collector_cache:
|
|
|
|
secrets:
|
|
planet_uv_config:
|
|
file: ${PLANET_UV_CONFIG_FILE:-/dev/null}
|