Commit Graph

42 Commits

Author SHA1 Message Date
mac 8e09c30d21 feat: wire mysql delivery to awx callbacks 2026-07-28 14:45:17 +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
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 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
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
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 96aa493034 Merge branch 'main' into feat/mysql-service-delivery 2026-07-23 14:21:06 +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 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
mac 64f6bf6cea fix(container): avoid duplicate Wayne workload rows 2026-07-22 15:20:33 +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
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
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
mac 8d49230247 feat(server): add Wayne subsystem authorization APIs 2026-07-17 19:26:40 +08:00
mac a10d4a5921 fix: require Wayne user ID for role binding 2026-07-17 15:47:32 +08:00
mac d264924d1e feat: add business line permissions and Wayne namespace mapping 2026-07-17 15:02:18 +08:00
mac b151356045 fix(auth): handle saml logout and xml encryption padding 2026-07-17 09:43:42 +08:00
mac 487de70250 fix(auth): populate email for local login users 2026-07-16 17:08:23 +08:00
mac 2835cf2576 fix(auth): keep subsystem oauth working without sso 2026-07-16 16:43:01 +08:00
mac cafa8bc840 feat(auth): support local username login mode 2026-07-16 16:19:25 +08:00
mac eb2621d914 feat(auth): complete sso subsystem integration 2026-07-16 15:52:56 +08:00
mac da38acfcb5 merge: sync origin main into auth-login 2026-07-15 15:12:54 +08:00
mac 81d2a8a60b refactor(frontend): merge authserver web login 2026-07-15 14:47:42 +08:00
mac 6af511ed0b refactor(server): merge authserver implementation 2026-07-15 14:05:22 +08:00
wonder 509503a9a0 feat(server): 重构路由模块,优化开发体验
- 提取路由配置到独立的 router 包
- 优化 Makefile 并行启动前后端开发服务器
- 修复 Swagger 文档生成命令
2026-07-15 13:43:21 +08:00
wonder 1d799ac0e7 feat(server): 优化 Swagger 配置,支持动态 host
- 移除 swagger.json/yaml 中硬编码的 host 字段
- 在 docs.go 中将 Host 设置为空字符串以支持动态检测
- 添加前端 /swagger 代理配置,支持开发环境访问 Swagger UI
- 在 main.go 中导入 docs 包注册 Swagger 文档
2026-07-15 13:30:59 +08:00
wonder 8898437e9e feat(server): 集成 Swagger API 文档
- 引入 swaggo/gin-swagger 和 swaggo/files 依赖
- 配置 Swagger UI 路由 /swagger/*
- 为测试 handler 函数添加 Swagger 注解
- 将 main.go 中的内联 handler 重构到 handler/test.go 以支持注解
- 生成 Swagger 文档 (docs.go, swagger.json, swagger.yaml)
- Makefile 新增 make swagger 命令
- .gitignore 添加 server/docs/ 以跟踪生成的文档
- 添加 API 元信息(标题、版本、联系方式、许可证、安全定义)
2026-07-15 11:33:00 +08:00
wonder 3cbb1683a6 feat(server): 添加后端入口和统一响应格式测试路由
- 新增 server/cmd/server/main.go 作为服务入口
- 注册 /api/v1/test/* 测试端点,覆盖成功、业务错误、HTTP 错误、超时等场景
- 加载 Logger 和 Recovery 中间件
- 修复 recovery.go 未使用的 net/http 导入
- 更新 go.mod/go.sum 依赖
2026-07-15 11:03:28 +08:00
wonder 4f1df02f53 feat(server): 实现统一响应格式和错误码
- 添加 server/go.mod,模块路径为 github.com/1024XEngineer/xinfra/server
- 实现 response.go 统一 JSON 响应结构:
  - 响应信封:{ code, message, data, details }
  - 业务错误码 (10001-20002) 与 MVP 规范一致
  - 便捷函数:Success, Error, BadRequest, Unauthorized 等
  - 分页响应支持,包含 total 和 items
- 添加 recovery 中间件捕获 panic 并返回 500 错误
- 添加 logger 中间件记录请求日志

为所有后端处理器建立统一的 API 响应基础,与前端期望的格式保持一致。
2026-07-15 10:44:32 +08:00
wonder 1bd5921fd4 chore: 初始化项目骨架结构
- 创建前端 Vue3 项目目录结构(components、views、router、stores 等)
- 创建后端 Go 项目目录结构(cmd、internal、pkg 等分层架构)
- 创建部署配置目录(docker、k8s)
- 创建文档目录
- 添加 .gitignore 忽略规则
- 添加 Makefile 构建脚本
- 更新 README.md 项目说明文档
- 每个目录添加 .gitkeep 文件说明目录用途
2026-07-14 14:34:10 +08:00