feat: add control plane authentication baseline

This commit is contained in:
wlx committed 2026-08-21 15:47:57 +08:00
1 parent a4c93ff1a7
commit 0d10e2d124
21 files changed
+1403 -18

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
CONTROL_PLANE_POSTGRES_PORT=5434
CONTROL_PLANE_POSTGRES_USER=moyi
CONTROL_PLANE_POSTGRES_PASSWORD=replace-with-a-long-random-password
CONTROL_PLANE_POSTGRES_DB=moyi_control
+17
View File
@@ -0,0 +1,17 @@
# Control Plane 数据库
这是 D3 身份与权限服务使用的本地 PostgreSQL。它与 \`infra/otari/\` 的网关数据库独立,避免平台身份数据与网关执行数据混用。
\`\`\`powershell
cd infra/control-plane
Copy-Item .env.example .env
docker compose up -d
\`\`\`
然后在 \`control-plane/.env\` 中设置:
\`\`\`dotenv
DATABASE_URL=postgresql://moyi:你的数据库密码@127.0.0.1:5434/moyi_control
\`\`\`
再运行 \`pnpm migrate\` 与 \`pnpm seed:admin\`。
+22
View File
@@ -0,0 +1,22 @@
name: moyi-control-plane
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
ports:
- "${CONTROL_PLANE_POSTGRES_PORT:-5434}:5432"
environment:
POSTGRES_USER: ${CONTROL_PLANE_POSTGRES_USER:-moyi}
POSTGRES_PASSWORD: ${CONTROL_PLANE_POSTGRES_PASSWORD:?Set CONTROL_PLANE_POSTGRES_PASSWORD in infra/control-plane/.env}
POSTGRES_DB: ${CONTROL_PLANE_POSTGRES_DB:-moyi_control}
volumes:
- control_plane_postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 10
volumes:
control_plane_postgres_data: