f63e800f21
Adds the ops-api container, ops-config volume, and migrate-ops step so the operations console backend boots alongside the rest of the stack. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
276 lines
8.3 KiB
YAML
276 lines
8.3 KiB
YAML
# geo-rankly — Production One-Click Deployment
|
|
#
|
|
# Usage:
|
|
# 1. cp .env.example .env && edit .env
|
|
# 2. docker compose up -d
|
|
#
|
|
# To rebuild images from source (developer workflow):
|
|
# docker compose --profile build up -d --build
|
|
|
|
name: geo-rankly
|
|
|
|
x-app-env: &app-env
|
|
CONFIG_PATH: /app/configs/config.yaml
|
|
LLM_API_KEY: ${LLM_API_KEY}
|
|
SILICONFLOW_API_KEY: ${SILICONFLOW_API_KEY}
|
|
JWT_SECRET: ${JWT_SECRET:-change-me-in-production}
|
|
JWT_ACCESS_TTL: ${JWT_ACCESS_TTL:-15m}
|
|
JWT_REFRESH_TTL: ${JWT_REFRESH_TTL:-720h}
|
|
OBJECT_STORAGE_ACCESS_KEY: ${MINIO_ROOT_USER:-minioadmin}
|
|
OBJECT_STORAGE_SECRET_KEY: ${MINIO_ROOT_PASSWORD:-minioadmin}
|
|
|
|
x-app-volumes: &app-volumes
|
|
- ./config.yaml:/app/configs/config.yaml:ro
|
|
- ./prompts.yml:/app/configs/prompts.yml:ro
|
|
|
|
x-app-depends: &app-depends
|
|
postgres:
|
|
condition: service_healthy
|
|
monitoring-postgres:
|
|
condition: service_healthy
|
|
rabbitmq:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_started
|
|
qdrant:
|
|
condition: service_started
|
|
minio:
|
|
condition: service_started
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
|
|
services:
|
|
|
|
# ────────────────── Infrastructure ──────────────────────────────────────────
|
|
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: geo-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: geo
|
|
POSTGRES_USER: geo
|
|
POSTGRES_PASSWORD: geo_dev
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U geo -d geo"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
monitoring-postgres:
|
|
image: postgres:16-alpine
|
|
container_name: geo-monitoring-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: geo_monitoring
|
|
POSTGRES_USER: geo
|
|
POSTGRES_PASSWORD: geo_dev
|
|
volumes:
|
|
- monitoring_pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U geo -d geo_monitoring"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
rabbitmq:
|
|
image: rabbitmq:3.13-management-alpine
|
|
container_name: geo-rabbitmq
|
|
restart: unless-stopped
|
|
environment:
|
|
RABBITMQ_DEFAULT_USER: geo
|
|
RABBITMQ_DEFAULT_PASS: geo_dev
|
|
RABBITMQ_DEFAULT_VHOST: geo
|
|
volumes:
|
|
- rabbitmq_data:/var/lib/rabbitmq
|
|
ports:
|
|
- "${RABBITMQ_MGMT_PORT:-15672}:15672"
|
|
healthcheck:
|
|
test: ["CMD", "rabbitmq-diagnostics", "ping"]
|
|
interval: 10s
|
|
timeout: 10s
|
|
retries: 10
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: geo-redis
|
|
restart: unless-stopped
|
|
volumes:
|
|
- redis_data:/data
|
|
command: redis-server --save 60 1 --loglevel warning
|
|
|
|
qdrant:
|
|
image: qdrant/qdrant:v1.13.2
|
|
container_name: geo-qdrant
|
|
restart: unless-stopped
|
|
volumes:
|
|
- qdrant_data:/qdrant/storage
|
|
|
|
minio:
|
|
image: minio/minio:RELEASE.2025-03-12T18-04-18Z
|
|
container_name: geo-minio
|
|
restart: unless-stopped
|
|
command: server /data --console-address ":9001"
|
|
environment:
|
|
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
|
|
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
|
|
volumes:
|
|
- minio_data:/data
|
|
ports:
|
|
- "${MINIO_CONSOLE_PORT:-9001}:9001"
|
|
|
|
# ─── MinIO bucket initializer (one-shot) ────────────────────────────────────
|
|
minio-init:
|
|
image: minio/mc:latest
|
|
container_name: geo-minio-init
|
|
depends_on:
|
|
minio:
|
|
condition: service_started
|
|
environment:
|
|
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
|
|
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
|
|
entrypoint: >
|
|
/bin/sh -c "
|
|
sleep 3;
|
|
mc alias set local http://minio:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD;
|
|
mc mb --ignore-existing local/geo-private;
|
|
echo 'MinIO bucket ready.';
|
|
"
|
|
restart: "no"
|
|
|
|
# ────────────────── Database Migrations (one-shot) ──────────────────────────
|
|
|
|
migrate:
|
|
image: ${IMAGE_REGISTRY:-ghcr.io/your-org/geo-rankly}/migrate:${IMAGE_TAG:-latest}
|
|
container_name: geo-migrate
|
|
# build section — used only when running with --build or --profile build
|
|
build:
|
|
context: ../server
|
|
dockerfile: Dockerfile
|
|
target: migrate
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
monitoring-postgres:
|
|
condition: service_healthy
|
|
entrypoint: >
|
|
/bin/sh -c "
|
|
/usr/local/bin/migrate -path /migrations -database 'postgres://geo:geo_dev@postgres:5432/geo?sslmode=disable' up &&
|
|
/usr/local/bin/migrate -path /migrations_monitoring -database 'postgres://geo:geo_dev@monitoring-postgres:5432/geo_monitoring?sslmode=disable' up &&
|
|
/usr/local/bin/migrate -path /migrations_ops -database 'postgres://geo:geo_dev@postgres:5432/geo?sslmode=disable&x-migrations-table=schema_migrations_ops' up
|
|
"
|
|
restart: "no"
|
|
|
|
# ────────────────── Application Services ────────────────────────────────────
|
|
|
|
tenant-api:
|
|
image: ${IMAGE_REGISTRY:-ghcr.io/your-org/geo-rankly}/tenant-api:${IMAGE_TAG:-latest}
|
|
container_name: geo-tenant-api
|
|
build:
|
|
context: ../server
|
|
dockerfile: Dockerfile
|
|
target: runtime
|
|
args:
|
|
SERVICE: tenant-api
|
|
restart: unless-stopped
|
|
environment:
|
|
<<: *app-env
|
|
volumes: *app-volumes
|
|
depends_on: *app-depends
|
|
ports:
|
|
- "${API_PORT:-8080}:8080"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/health || exit 1"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
|
|
worker-generate:
|
|
image: ${IMAGE_REGISTRY:-ghcr.io/your-org/geo-rankly}/worker-generate:${IMAGE_TAG:-latest}
|
|
container_name: geo-worker-generate
|
|
build:
|
|
context: ../server
|
|
dockerfile: Dockerfile
|
|
target: runtime
|
|
args:
|
|
SERVICE: worker-generate
|
|
restart: unless-stopped
|
|
environment:
|
|
<<: *app-env
|
|
volumes: *app-volumes
|
|
depends_on: *app-depends
|
|
|
|
scheduler:
|
|
image: ${IMAGE_REGISTRY:-ghcr.io/your-org/geo-rankly}/scheduler:${IMAGE_TAG:-latest}
|
|
container_name: geo-scheduler
|
|
build:
|
|
context: ../server
|
|
dockerfile: Dockerfile
|
|
target: runtime
|
|
args:
|
|
SERVICE: scheduler
|
|
restart: unless-stopped
|
|
environment:
|
|
<<: *app-env
|
|
volumes: *app-volumes
|
|
depends_on: *app-depends
|
|
|
|
ops-api:
|
|
image: ${IMAGE_REGISTRY:-ghcr.io/your-org/geo-rankly}/ops-api:${IMAGE_TAG:-latest}
|
|
container_name: geo-ops-api
|
|
build:
|
|
context: ../server
|
|
dockerfile: Dockerfile
|
|
target: runtime
|
|
args:
|
|
SERVICE: ops-api
|
|
restart: unless-stopped
|
|
environment:
|
|
CONFIG_PATH: /app/configs/ops-config.yaml
|
|
OPS_JWT_SECRET: ${OPS_JWT_SECRET:-change-me-in-production}
|
|
OPS_DEFAULT_ADMIN_USERNAME: ${OPS_DEFAULT_ADMIN_USERNAME:-admin}
|
|
OPS_DEFAULT_ADMIN_PASSWORD: ${OPS_DEFAULT_ADMIN_PASSWORD:-}
|
|
OPS_DEFAULT_ADMIN_DISPLAY_NAME: ${OPS_DEFAULT_ADMIN_DISPLAY_NAME:-系统管理员}
|
|
OPS_DEFAULT_ADMIN_EMAIL: ${OPS_DEFAULT_ADMIN_EMAIL:-}
|
|
volumes:
|
|
- ./ops-config.yaml:/app/configs/ops-config.yaml:ro
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
ports:
|
|
- "${OPS_API_PORT:-8090}:8090"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -qO- http://localhost:8090/api/health/live || exit 1"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
|
|
# ────────────────── Frontend ─────────────────────────────────────────────────
|
|
|
|
frontend:
|
|
image: ${IMAGE_REGISTRY:-ghcr.io/your-org/geo-rankly}/frontend:${IMAGE_TAG:-latest}
|
|
container_name: geo-frontend
|
|
build:
|
|
context: ..
|
|
dockerfile: Dockerfile.frontend
|
|
restart: unless-stopped
|
|
depends_on:
|
|
tenant-api:
|
|
condition: service_healthy
|
|
ports:
|
|
- "${FRONTEND_PORT:-80}:80"
|
|
|
|
volumes:
|
|
pgdata:
|
|
monitoring_pgdata:
|
|
rabbitmq_data:
|
|
redis_data:
|
|
qdrant_data:
|
|
minio_data:
|