Go to file
2026-03-20 22:46:21 +08:00
.agent/docs feat(agent-persistence): implement PostgreSQL persistence for agent registry 2026-02-05 08:34:25 +08:00
.github Align image tagging and accounts image names 2026-03-17 20:02:23 +08:00
ansible feat(release): split accounts public and secret vars 2026-03-16 19:10:37 +08:00
api fix(xworkmate): reject nested raw token payloads 2026-03-20 22:46:21 +08:00
cmd feat(api): add homepage video settings endpoints 2026-03-18 15:14:08 +08:00
config feat(auth): add readonly review account 2026-03-16 09:24:49 +08:00
deploy feat: Implement initial Cloud Run deployment configurations for the accounts service, including a preview environment and stunnel sidecar. 2026-02-10 12:59:34 +08:00
docs fix(auth): replace public token exchange with one-time code 2026-03-17 08:51:01 +08:00
internal fix(service): reuse shared db init error 2026-03-18 15:16:39 +08:00
scripts feat(xworkmate): add tenant-aware profile storage 2026-03-17 13:27:30 +08:00
skills feat(xworkmate): add tenant-aware profile storage 2026-03-17 13:27:30 +08:00
sql feat: Implement persistent session management by moving session logic to the store interface and adding a sessions table. 2026-02-05 11:27:11 +08:00
tests/e2e/superadmin-login chore(tests): move integration tests to tests/e2e 2026-02-09 11:29:29 +08:00
.env.example docs: add stripe billing setup guide 2026-03-16 20:15:42 +08:00
.gitignore feat(deploy): add single-node compose migration for accounts 2026-03-15 18:52:49 +08:00
.gitleaksignore chore: ignore false positive secrets in historical LOGIN_API_GUIDE.md 2026-01-30 23:17:05 +08:00
.gitmodules Add NeuraPress submodule metadata (#794) 2025-12-14 21:01:34 +08:00
accounts-svc-plus-remote.yaml feat: Add Cloud Run service definitions for accounts.svc.plus preview and main deployments. 2026-02-10 13:00:34 +08:00
ansible.cfg feat(release): split accounts public and secret vars 2026-03-16 19:10:37 +08:00
api.test test: Replace hardcoded test password with a named variable in api_test.go and add api.test. 2026-02-06 12:29:10 +08:00
Dockerfile build: bump go builder image to 1.25.1 2026-01-23 23:34:46 +08:00
entrypoint.sh feat(deploy): add single-node compose migration for accounts 2026-03-15 18:52:49 +08:00
go.mod feat: add user management APIs for management page 2026-01-30 08:59:55 +08:00
go.sum feat: implement user management features (pause, delete, blacklist, renew uuid) 2026-02-02 20:19:06 +08:00
LICENSE feat: Add Apache License 2.0 to the project. 2026-02-02 18:09:42 +08:00
Makefile chore(tests): move integration tests to tests/e2e 2026-02-09 11:29:29 +08:00
preview-accounts-svc-plus-remote.yaml feat: Add Cloud Run service definitions for accounts.svc.plus preview and main deployments. 2026-02-10 13:00:34 +08:00
README.md docs(readme): document dynamic pre-commit sync target 2026-03-17 18:33:56 +08:00

accounts.svc.plus

Cloud Neutral Toolkit 的账号与身份服务 (Account Service).

A production-oriented account service for sign-in, sessions, MFA, and agent coordination.

部署要求 (Deployment Requirements)

维度 要求 / 规格 说明
网络 可访问的 API 域名 (可选) 生产建议配置 server.publicUrl
端口 :8080 API 服务默认监听端口
数据库 PostgreSQL 存储账号/会话/状态等核心数据
缓存 (可选) Redis session.cache=redis 时需要
最低 1 CPU / 1GB RAM 开发/小规模
推荐 2 CPU / 2GB RAM 生产建议

快速开始 (Quickstart)

一键初始化 (Setup Script)

curl -fsSL "https://raw.githubusercontent.com/cloud-neutral-toolkit/accounts.svc.plus/main/scripts/setup.sh?$(date +%s)" \
  | bash -s -- accounts.svc.plus --mode process --deploy

Docker 部署模式:

curl -fsSL "https://raw.githubusercontent.com/cloud-neutral-toolkit/accounts.svc.plus/main/scripts/setup.sh?$(date +%s)" \
  | bash -s -- accounts.svc.plus --mode docker --deploy

Cloud Run 部署模式:

curl -fsSL "https://raw.githubusercontent.com/cloud-neutral-toolkit/accounts.svc.plus/main/scripts/setup.sh?$(date +%s)" \
  | bash -s -- accounts.svc.plus --mode cloudrun

单机 process / docker 模式默认会写入 Caddy 站点配置到 /etc/caddy/conf.d/accounts.svc.plus.conf,并反向代理到本机 127.0.0.1:8080

本地运行 (Local Dev)

cp .env.example .env
make dev

提交前同步要求 (Pre-Commit Sync Requirement)

控制仓库中的 subrepos/accounts.svc.plus 在每次提交前,必须先同步当前线上运行实例。

线上实例命名规则:

  • <server-name>-<hostname-or-env>-<git-commit-short-id>.<domain>

例如:

  • accounts-us-xhttp-2886a64.svc.plus

执行要求:

cd /Users/shenlan/workspaces/cloud-neutral-toolkit/github-org-cloud-neutral-toolkit/subrepos/accounts.svc.plus

# 1. 确认线上当前运行 revision / image
ssh root@us-xhttp.svc.plus 'docker ps --format "table {{.Names}}\t{{.Image}}\t{{.RunningFor}}" | grep accounts'

# 2. 动态定位当前 active accounts 实例并核对 compose 目录与镜像 tag
ssh root@us-xhttp.svc.plus '
name=$(docker ps --format "{{.Names}}" | grep "^accounts-" | head -n 1) &&
echo "$name" &&
sed -n "1,80p" "/opt/cloud-neutral/accounts/${name}/docker-compose.yml"
'

# 3. 再开始本地提交
git status

如果线上 revision 已变化,应先以新的 <server-name>-<hostname-or-env>-<git-commit-short-id>.<domain> 实例为准完成同步,再提交本地改动。

Stripe 配置 (Stripe Billing Setup)

Stripe 相关服务端能力现在由 accounts.svc.plus 承担,包括:

  • Checkout Session 创建
  • Customer Portal 跳转
  • Webhook 验签与订阅状态回写

需要的环境变量:

变量 用途
STRIPE_SECRET_KEY Stripe API secret key
STRIPE_WEBHOOK_SECRET Stripe webhook endpoint secret
STRIPE_ALLOWED_PRICE_IDS 允许下单的 price_... 白名单,逗号分隔

联调说明见 docs/usage/stripe-billing.md

核心特性 & 技术栈 (Features & Tech Stack)

核心特性:

  • 账号体系:注册/登录/会话/角色与权限
  • 安全能力邮件验证、TOTP MFA可选
  • Agent 协同:与节点/控制面协作的同步与状态上报
  • 多部署形态:本地/VM、Docker、Cloud Run含 stunnel sidecar 示例)

技术栈:

  • Go + Gin
  • PostgreSQL (primary store)
  • Redis (optional session cache)
  • stunnel (optional secure DB connectivity; Cloud Run example included)

说明文档 (Docs)

  • 文档入口:docs/README.md
  • 快速开始:docs/getting-started/quickstart.md
  • 配置说明:docs/usage/config.md
  • Stripe 联调:docs/usage/stripe-billing.md
  • 部署方式:docs/usage/deployment.md
  • API 参考:docs/api/overview.md
  • 运维:docs/operations/monitoring.md, docs/operations/troubleshooting.md
  • Runbooksdocs/Runbook/README.md