Skip to content
Clone
e8e8f2c
53 lines 2.2 KB YAML
# KenApi 单机部署(本机 stack 版)
#
# docker compose up -d # 用已有镜像启动
# docker compose up -d --build # 从仓库根目录 Dockerfile 重新构建
#
# 端口:7051 = API;7021 = OAuth HTTP/登录页;7022 = 兼容外部服务的认证 gRPC。
# config 里另留了 7052(githost HTTP)与 7053(git SSH)两个口,但当前 apihost
# 二进制不监听它们(git 读写走 KenShell),改由 KenShell 的 7011/7012 承担。
#
# 为什么用 host 网络:PostgreSQL / Redis / RustFS / KenShell 都在
# 宿主机 127.0.0.1 上(与其它服务一致)。
#
# 首次部署前置(本机已执行):
# 1. 建库 + 迁移
# docker exec postgres psql -U postgres -c 'CREATE DATABASE gitdata'
# docker run --rm --network host -v "$PWD/config:/app/config:ro" \
# --entrypoint /usr/local/bin/kenapi kenapi:local migrate
# 2. S3 桶(RustFS):gitdata(与 config/local.toml 的 [s3].bucket 一致)
# 3. [identity.auth.oauth] 配置 gitdata-web 客户端;OAuth 已内嵌,无需独立服务。
#
# 配置:镜像内 config/default.toml + 挂载的 config/local.toml(本机地址与密钥)。
name: kenapi
services:
apihost:
image: ${KENAPI_IMAGE:-kenapi:local}
build:
context: ..
dockerfile: Dockerfile
container_name: kenapi
restart: unless-stopped
network_mode: host
environment:
RUST_LOG: ${RUST_LOG:-info}
TZ: ${TZ:-Asia/Shanghai}
KENAPI_HEALTH_PORT: ${KENAPI_HEALTH_PORT:-7051}
# 兜底回调地址:请求 Host 命中 oauth.redirect_uri_hosts(5173 / 7041)时,
# KenApi 会按该主机改写;命中不了才用这个值。
APP_OAUTH__REDIRECT_URI: http://127.0.0.1:7041/api/v1/auth/callback
# 进程内没有家目录,避免各 SDK 往 / 下写缓存。
HOME: /tmp
volumes:
# default.toml 已烘进镜像;local.toml 提供本机数据库/Redis/S3/OAuth 地址。
# 整个 config 目录只读挂载,顺便保留未来新增的本地配置文件。
- ../config:/app/config:ro
stop_grace_period: 120s
working_dir: /app
logging:
driver: json-file
options:
max-size: "20m"
max-file: "5"