Skip to content
Clone
ba6fe0f
99 lines 2.9 KB YAML
# 本地开发依赖服务(macOS / Linux)。
# 与 config/local.toml 的默认端口一一对应:
# PostgreSQL 5432 / Redis 6379 / S3(RustFS) 9000
# RocketMQ 是 KenApi 的启动必需项,由宿主机提供(默认 127.0.0.1:6876);
# 本 compose 不启动 MQ,启动 KenApi 前请先确认 nameserver 可达。
# 用法:
# just infra 启动
# just infra-down 停止
# 仅用于本地开发,账号密码均为固定值,请勿用于任何对外环境。
name: gitdata-dev
services:
postgres:
image: postgres:16-alpine
container_name: gitdata-dev-postgres
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: gitdata
ports:
- "127.0.0.1:5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d gitdata"]
interval: 5s
timeout: 3s
retries: 20
redis:
image: redis:7-alpine
container_name: gitdata-dev-redis
restart: unless-stopped
command: ["redis-server", "--appendonly", "no", "--save", ""]
ports:
- "127.0.0.1:6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 20
# S3 兼容对象存储:RustFS
rustfs:
image: rustfs/rustfs:latest
container_name: gitdata-dev-rustfs
restart: unless-stopped
environment:
RUSTFS_ADDRESS: ":9000"
RUSTFS_CONSOLE_ENABLE: "true"
RUSTFS_CONSOLE_ADDRESS: ":9001"
RUSTFS_ACCESS_KEY: rustfsadmin
RUSTFS_SECRET_KEY: rustfsadmin
RUSTFS_VOLUMES: /data
ports:
- "127.0.0.1:9000:9000"
- "127.0.0.1:9001:9001"
volumes:
- rustfs-data:/data
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:9000/ >/dev/null || exit 1"]
interval: 5s
timeout: 3s
retries: 20
# KenOAuth 认证中心。image 由外部构建;配置从 config/oauth.yaml 只读挂载。
# `just infra` 默认不启动,需要时:docker compose -f docker-compose.dev.yml --profile oauth up -d oauth
oauth:
profiles: ["oauth"]
image: harbor.gitdata.me/app/kenoauth:latest
container_name: gitdata-dev-oauth
restart: unless-stopped
network_mode: host
volumes:
- ./config/oauth.yaml:/app/config/config.yaml:ro
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
# 本地 S3 bucket 初始化(建出 config/local.toml 里声明的 bucket)
minio-init:
image: minio/mc:latest
container_name: gitdata-dev-bucket-init
depends_on:
rustfs:
condition: service_started
entrypoint: ["/bin/sh", "-c"]
command:
- |
until mc alias set local http://rustfs:9000 rustfsadmin rustfsadmin >/dev/null 2>&1; do sleep 1; done
mc mb --ignore-existing local/gitdata
echo "bucket ready: gitdata"
volumes:
postgres-data:
rustfs-data: