Commit Graph

202 Commits

Author SHA1 Message Date
Hungerdream be39f2a03c feat(delivery): expose rollback retry, release ack and CloudDM retry APIs
- POST /delivery/tasks/:id/rollback/retry  (platform admin) re-launches
  the rollback job after a previous cleanup failure
- POST /delivery/tasks/:id/rollback/release (platform admin) releases
  bookkeeping after the operator verified the target host manually
- POST /delivery/tasks/:id/clouddm/retry retries only the CloudDM
  registration step for an already healthy instance
- task logs now include rollback AWX job stdout and localized
  text/classes for the new rollback states
2026-07-28 14:29:26 +08:00
Hungerdream f0c1b38c5b feat(delivery): add automatic rollback state machine for failed deployments
Introduce a compensating workflow that launches the dedicated AWX
rollback template when a deployment cannot be started or fails midway.

- add task states: rollback_pending, rolling_back, rolled_back,
  rollback_failed, rollback_acknowledged
- add RollbackJob model to track the compensating AWX run separately
  from the deploy run, preserving both job IDs for audit
- hold resource reservations in 'rollback' status until cleanup
  succeeds so a failed cleanup cannot be masked by a later delivery
- poll rollback jobs with a 2-minute launch timeout; an unknown launch
  result surfaces as a recoverable failure instead of re-launching
- protect finished/register_failed/rolled-back tasks from rollback;
  register_failed keeps the healthy instance and its resource usage
- add DELIVERY_ROLLBACK_TEMPLATE_ID config; without it, failures are
  marked rollback_failed and require manual cleanup
- use unique pending-<task_id> placeholder for executor job IDs
2026-07-28 14:29:09 +08:00
Hungerdream 7a800b0307 fix(ansible): treat empty or auto redo capacity as unset
innodb_redo_log_capacity passed as '' or 'auto' from the delivery
payload previously bypassed the memory-based tier calculation and was
rendered verbatim into the instance config. Fall back to the automatic
tier when the value is empty or 'auto'.
2026-07-28 14:28:53 +08:00
Hungerdream b9a3ddd9e3 feat(ansible): add mysql-rollback playbook for instance cleanup
Add a compensating playbook that removes a single delivered MySQL
instance from a target host. The rollback scope is pinned by
target_hosts + instance_name + data_disk, with pre-task assertions
rejecting instance names or disk paths outside the delivery layout
to prevent accidental deletion.

- stop and disable mysql-delivery@<instance>.service, reset failed state
- remove instance data dir, install dir, config file and run dir
2026-07-28 14:28:42 +08:00
Wonder 3e5c8b8a19 Merge pull request #114 from 2311719626/docs/ansible-add-chinese-comments
docs(ansible): 为 MySQL 交付 Ansible 文件添加详细中文注释
2026-07-28 11:16:19 +08:00
wonder c26790f84b docs(ansible): 为 mysql-deploy 相关文件添加详细中文注释
- mysql-deploy.yml: 为所有变量、任务、handlers 添加中文注释,解释参数含义、设计逻辑和平台契约
- mysql-delivery@.service: 为 Systemd 模板单元添加中文注释,说明 %i 参数机制、Type=notify、OOMScoreAdjust 等配置项
- mysql-instance.cnf.j2: 为 MySQL 配置模板添加中文注释,说明各参数含义、版本差异、复制配置逻辑
- inventory.example.yml: 为 Inventory 示例添加中文注释,说明主机组与拓扑对应关系及使用方式
2026-07-28 11:05:57 +08:00
mac 5a260c443f feat(delivery): stream task updates with SSE 2026-07-28 09:55:04 +08:00
mac 7b4b9d2ee7 Merge remote-tracking branch 'upstream/main' into feat/base-service-delivery
# Conflicts:
#	server/.env.example
#	server/internal/config/config.go
#	server/internal/service/delivery.go
#	server/internal/service/delivery_test.go
2026-07-28 09:34:37 +08:00
mac 8378427d3d fix(delivery): use unique pending AWX job placeholders 2026-07-27 18:33:33 +08:00
mac 4637228bae feat(delivery): add AWX callback MySQL playbook 2026-07-27 17:25:03 +08:00
ztkkOip 2e84a48847 Merge pull request #110 from Hungerdream/feat/mysql-custom-params
feat: MySQL 交付参数自定义与同机多实例调度 (#108)
2026-07-27 15:38:56 +08:00
mac 6ddba9aa03 feat(delivery): restore active MySQL tasks 2026-07-27 15:20:03 +08:00
Hungerdream 41b2f45420 feat(delivery): support multi-instance scheduling on a single host
- Per-host instance limit (DELIVERY_HOST_INSTANCE_LIMIT, default 4)
- Optional target_host to pin a host from the candidate pool
- Regenerate swagger docs
2026-07-27 15:19:44 +08:00
mac e0ee36cadb feat(delivery): switch AWX delivery to callbacks 2026-07-27 15:19:18 +08:00
Hungerdream bfb4f0df4d feat(delivery): complete MySQL version-to-package mapping
- 8.0 from Ubuntu archive, 8.4 from MySQL official APT repo
- 5.6/5.7 not supported for now; enforce one MySQL series per host
- Sync Go version whitelist with the playbook package map
2026-07-27 15:18:54 +08:00
Hungerdream e8e9612527 fix(ansible): use dict-form shell tasks with explicit bash
Free-form split_args breaks on quotes/Jinja at AWX runtime,
and default dash rejects pipefail.
2026-07-27 15:17:46 +08:00
Hungerdream 3c3645f8d5 feat(delivery): extend MySQL delivery parameters and tighten resource bounds
- Add topology/port/data_disk, DB options and 8 advanced parameters
  with whitelist validation, rendered via extra_vars into the playbook
- Hybrid port allocation over pool 13306-13999
- Tighten bounds: memory 2048-65536 MiB, storage 20-2000 GiB
2026-07-27 15:16:57 +08:00
ztkkOip e4596d5662 Merge pull request #106 from 1024XEngineer/feat/base-service-delivery
Fix(base service delivery)任务日志
2026-07-27 09:47:46 +08:00
mac 97f0de16bc chore: tighten authserver docker context 2026-07-23 18:36:40 +08:00
mac a934380c9c feat: switch base delivery to awx task logs 2026-07-23 18:36:24 +08:00
ztkkOip c2a3bbbdc0 Merge pull request #104 from Hungerdream/fix/delivery-review-feedback
fix(delivery): address review feedback on idempotency, crash recovery, and security (#97)
2026-07-23 14:56:24 +08:00
mac f91df3be3d fix(delivery): address review feedback on idempotency, crash recovery, and security
- Idempotency: verify RequestedBy matches caller to prevent cross-user key reuse
- Crash recovery: persist ExecutionJob (launching) before AWX Launch, update to running after
- Terminal state: finish ExecutionJob on success/cancel/failure; failTask accepts canceling
- Reservation TTL: filter expired reservations in quota aggregation
- Ansible heredoc: use <<'EOF' to prevent shell expansion of secrets; escape single quotes
- Validation: align Go resource ranges with playbook (mem 1024-4096, storage 10-100)
- Version whitelist: only allow 8.0, pass mysql_version to AWX extra_vars; playbook selects package via map

Relates-to: #97
2026-07-23 14:39:09 +08:00
ztkkOip b34ebcea83 Merge pull request #102 from Hungerdream/feat/mysql-service-delivery
feat: MySQL 一键交付 (#97)
2026-07-23 14:21:23 +08:00
ztkkOip 96aa493034 Merge branch 'main' into feat/mysql-service-delivery 2026-07-23 14:21:06 +08:00
ztkkOip 22eaa3001e Merge pull request #98 from ztkkOip/auth-login
fix(Auth login) 增加了一些主系统数据抽取
2026-07-23 14:17:53 +08:00
mac c421be3ae9 docs(delivery): add Swagger annotations and regenerate API docs
Add Swagger annotations to all 7 delivery handlers. Fix existing
test.go type references (Response -> response.Response). Add swaggo
dependencies to go.mod. Regenerate swagger.json/yaml/docs.go with
delivery endpoints visible in /swagger/index.html.

Relates-to: #97
2026-07-23 13:50:21 +08:00
mac 5ddb434b74 feat(delivery): add Ansible playbook for native MySQL provisioning
Add mysql-deploy.yml playbook for bare-metal MySQL 8.0 delivery via
AWX: parameter validation, resource preflight checks, apt install,
AppArmor adaptation, per-instance directory layout, Jinja2 config
template (buffer pool sizing, binlog, GTID), systemd template unit
(mysql-delivery@.service), admin account setup, and TCP health
verification. Includes example inventory.

Relates-to: #97
2026-07-23 12:05:07 +08:00
mac 699eaa5225 feat(delivery): add HTTP handlers and route registration
Add DeliveryHandler (7 endpoints under /auth/api/v1/delivery/*):
CreateMySQL, List, Get, Cancel, Targets, CreateTarget, UpsertQuota.
Add ExecutionHandler for internal service callback. Register routes
with JWT auth middleware and start scheduler goroutine when enabled.

Relates-to: #97
2026-07-23 12:04:51 +08:00
mac e11bc6f3d6 feat(delivery): implement delivery scheduler and state machine
Core delivery service with: task creation (idempotent, validated),
background scheduler (claimAndReserve with SELECT FOR UPDATE SKIP
LOCKED), 4-level concurrency control, resource quota enforcement,
host allocation from candidate pool, AWX job dispatch, polling,
TCP health check, instance registration, CloudDM integration
(optional), and cancel support. 11-state machine with optimistic
locking and full event audit trail.

Relates-to: #97
2026-07-23 12:04:37 +08:00
mac 81a94322f7 feat(delivery): add AWX API client
Implement AWXClient with Launch, GetJob, and Cancel methods for
orchestrating Ansible job templates via AWX REST API. Uses Bearer
token auth with 30s timeout. Includes unit tests with mock transport.

Relates-to: #97
2026-07-23 12:04:15 +08:00
mac 76583c6766 feat(delivery): add delivery configuration and environment variables
Add 10 config fields: AWX connection (AWX_BASE_URL, AWX_TOKEN),
scheduler controls (DELIVERY_SCHEDULER_ENABLED, DELIVERY_POLL_SECONDS,
DELIVERY_RESERVATION_TTL_MINUTES), concurrency limits (GLOBAL/TARGET/
BUSINESS), service token, and CloudDM registration (CLOUDDM_REGISTER_URL,
CLOUDDM_API_TOKEN). Update .env.example with new variables.

Relates-to: #97
2026-07-23 12:04:02 +08:00
mac 8676963bac feat(delivery): add delivery data models and auto-migration
Add 8 GORM models for MySQL one-click delivery: DeploymentTarget,
ResourceQuota, DeliveryTask, ResourceReservation, ResourceUsage,
MySQLInstance, ExecutionJob, TaskEvent. Register them in AutoMigrate.

Relates-to: #97
2026-07-23 12:03:47 +08:00
Gmarker689 d191948f6d Merge pull request #99 from Gmaker689/fix/dependabot-alerts-7-8-vite-upgrade
fix: upgrade vite to 6.4.3 to fix launch-editor command injection and…
2026-07-22 17:00:26 +08:00
Gmarker689 a974dd03cb fix: upgrade vite to 6.4.3 to fix launch-editor command injection and fs.deny bypass vulnerabilities
- Fixes Dependabot alert #7 (GHSA-c27g-q93r-2cwf): launch-editor command injection via crafted request on Windows, patched in vite >= 5.4.9
- Fixes Dependabot alert #8 (GHSA-fx2h-pf6j-xcff): server.fs.deny bypass on Windows alternate paths, patched in vite >= 6.4.3
- Upgraded @vitejs/plugin-vue to ^5.2.4 for vite 6 compatibility
- Upgraded vue-tsc to ^2.2.12 for vite 6 compatibility
2026-07-22 16:22:01 +08:00
mac 64f6bf6cea fix(container): avoid duplicate Wayne workload rows 2026-07-22 15:20:33 +08:00
mac c8762619fb chore(frontend): clarify namespace auto binding prompts 2026-07-22 15:05:42 +08:00
mac d150d0f0dd feat(business-line): auto bind Wayne namespace on create 2026-07-22 15:05:41 +08:00
mac 7f6f6fa41e feat(container): show business line workloads from Wayne 2026-07-22 15:05:41 +08:00
ztkkOip 89a23ef60d Merge pull request #95 from ztkkOip/feat/base-service-delivery
Feat(base service delivery)基础服务部署在主系统的初始化
2026-07-22 14:55:44 +08:00
qudder ebf7577e7e Merge pull request #92 from 2311719626/docs/README
docs: 重写 README.md,完善项目文档
2026-07-22 10:55:15 +08:00
ztkkOip 75e1177b70 Merge pull request #94 from 2311719626/fix/upgrade-golang-x-crypto
修复: 升级 golang.org/x/crypto 修复多个 Critical 安全漏洞
2026-07-22 10:29:13 +08:00
wonder 5e47dee022 fix: upgrade golang.org/x/crypto to fix critical security vulnerabilities
- 升级 golang.org/x/crypto 从 v0.40.0 到 v0.54.0
- 修复 FIDO/U2F 安全密钥物理存在检查绕过漏洞
- 修复服务器意外响应导致的死锁问题
- 修复未强制执行 @revoked 状态导致的认证绕过漏洞
- 修复大通道写入导致的无限循环漏洞
- 修复未强制执行调用密钥约束问题
- 修复未删除调用代理约束转发密钥问题
- 修复 VerifiedPublicKeyCallback 权限跳过强制执行问题
- 同步升级相关依赖: x/net v0.56.0, x/sys v0.47.0, x/text v0.40.0, x/sync v0.22.0, x/mod v0.37.0, x/tools v0.47.0
2026-07-22 10:23:33 +08:00
wonder 55addea694 docs: 重写 README.md,完善项目文档
- 新增项目徽章(License、Go、Vue、Element Plus、PRs Welcome)
- 重写核心能力板块:资源纳管、基础服务部署、业务交付、统一认证与审计
- 完善技术栈表格,增加说明列
- 扩充项目结构目录,覆盖前后端完整模块
- 优化快速开始指南,新增构建与部署说明
- 补充 API 文档、开发指南、Git 提交规范
- 新增参与贡献、路线图、许可证等板块
2026-07-22 10:13:57 +08:00
mac 2db8264c8e feat(service): add deployment task integration 2026-07-21 18:26:50 +08:00
mac c324e2ec59 feat(auth): use Wayne native role APIs 2026-07-21 17:05:48 +08:00
ztkkOip b1fa41c24f Merge pull request #90 from ztkkOip/auth-login 子系统赋权初始化
feet(子系统赋权)初始化
2026-07-17 19:35:51 +08:00
mac 981e9557fe feat(frontend): make mock panels follow business line 2026-07-17 19:28:19 +08:00
mac a112cf742c feat(frontend): add Wayne subsystem authorization page 2026-07-17 19:27:33 +08:00
mac 8d49230247 feat(server): add Wayne subsystem authorization APIs 2026-07-17 19:26:40 +08:00
mac add4b1566e chore: refresh generated component types 2026-07-17 16:32:46 +08:00