diff --git a/deploy/docker-compose.yaml b/deploy/docker-compose.yaml index dff8d44..195690c 100644 --- a/deploy/docker-compose.yaml +++ b/deploy/docker-compose.yaml @@ -158,7 +158,8 @@ services: 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_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" @@ -217,6 +218,39 @@ services: 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: diff --git a/deploy/ops-config.yaml b/deploy/ops-config.yaml new file mode 100644 index 0000000..f1845a7 --- /dev/null +++ b/deploy/ops-config.yaml @@ -0,0 +1,27 @@ +server: + port: 8090 + mode: release + +database: + host: postgres + port: 5432 + user: geo + password: geo_dev + dbname: geo + sslmode: disable + max_open_conns: 10 + max_idle_conns: 2 + +log: + level: info + format: json + +jwt: + secret: "" # 由 OPS_JWT_SECRET 环境变量注入 + access_ttl: 8h + +default_admin: + username: admin + display_name: 系统管理员 + email: "" + password: "" # 由 OPS_DEFAULT_ADMIN_PASSWORD 环境变量注入(仅在 operator_accounts 为空时生效)