Commit Graph

192 Commits

Author SHA1 Message Date
Gmarker689 ad1ec79563 Merge pull request #128 from Gmaker689/feat/clouddm-auto-register
Feat/clouddm auto register
2026-07-29 18:28:35 +08:00
Gmarker689 0aac99c359 feat: register MySQL instances in CloudDM 2026-07-29 18:24:36 +08:00
Gmarker689 33449b60b2 Merge branch '1024XEngineer:main' into main 2026-07-29 18:02:01 +08:00
Emdream 221d6a6707 Merge pull request #127 from ztkkOip/feat/base-service-delivery
fix(delivery): 完善一些部署和机器管理
2026-07-29 16:54:47 +08:00
mac 35875218c9 feat(delivery): refine base service integrations 2026-07-29 16:47:41 +08:00
Wonder 2ca08f9360 Merge pull request #126 from 2311719626/fix/logs
fix(server): 修复 task log 模块多个问题及数据竞争
2026-07-29 14:48:35 +08:00
wonder 0027704169 fix(server): 修复 TestSubscribeTask_ConcurrentSafety 数据竞争问题
- 修复多个 goroutine 并发 append 同一 slice 导致的 DATA RACE
- 使用预分配 slice + 索引赋值替代并发 append
- 通过 go test -race 验证
2026-07-29 14:47:31 +08:00
Wonder 179d80604c Merge pull request #125 from 2311719626/fix/logs
fix(server): 修复 task log 模块多个问题并添加单元测试
2026-07-29 14:38:55 +08:00
wonder 11a92c429f test(server): 添加 task log 模块单元测试
- 添加 handler 层 16 个纯函数单元测试(状态映射、ID 解析、排序、格式化等)
- 添加 service 层 11 个 pub/sub 与缓存单元测试(订阅、取消、并发安全、TTL 过期等)
- 共 27 个测试用例,覆盖 task log 核心逻辑

背景:task log 模块经历了大量修改但缺乏测试覆盖,需要确保日志模块可用

关联 commit:61eeb0c, dbb930d
2026-07-29 14:13:53 +08:00
Gmarker689 f4a0a75ca1 Merge pull request #124 from Gmaker689/ci/github-actions
Ci/GitHub actions
2026-07-29 14:08:08 +08:00
wonder dbb930d0cb fix(frontend): 优化 task log 前端交互体验
- 简化虚拟滚动实现,移除 @tanstack/vue-virtual 依赖
- 添加分页组件,支持翻页查看历史任务
- 添加 SSE 指数退避重试机制(最多 3 次)
- 更新 API 接口支持分页参数
- 添加重试状态指示器

背景:前端存在虚拟滚动与 SSE 不兼容、缺少分页、连接断开无重试等问题

关联 commit:fix/logs 分支
2026-07-29 14:01:12 +08:00
wonder 61eeb0c8ac fix(server): 修复 task log 接口多个问题
- 修复 Wayne 任务状态映射,将数字状态统一为字符串状态
- 添加分页支持,支持 page/page_size 参数
- 添加 AWXJobStdout 内存缓存,减少重复 API 调用
- 修复 SubscribeTask 内存泄漏,自动清理 closed channel
- 统一 Stream 端点,AWX 使用 pub/sub,Wayne 使用轮询

背景:task log 接口存在多个潜在问题,包括状态判断错误导致无限轮询、
缺少分页、重复 API 调用性能问题、内存泄漏风险等

关联 commit:fix/logs 分支
2026-07-29 14:00:40 +08:00
Gmarker689 1f71efd8e0 Merge branch '1024XEngineer:main' into main 2026-07-29 13:56:58 +08:00
ztkkOip 699d4b6526 Merge pull request #123 from Hungerdream/feat/mysql-delivery-hardening
feat: MySQL 交付实例名唯一性与凭证领取加固 (#108, #97)
2026-07-29 13:55:09 +08:00
Gmarker689 82b0ad90ed Merge pull request #2 from Gmaker689/ci/github-actions
Ci/GitHub actions
2026-07-29 13:51:17 +08:00
Hungerdream 5715379a26 refactor(ui): embed delivery records into the service ledger
Replace the separate delivery records tab with a per-service dropdown column in the ledger table that opens the existing detail dialog with one-time credential claim. Sync now refreshes ledger, container services and delivery records together; errors surface via message toast. components.d.ts regenerated (dropdown components in, tabs out).
2026-07-29 13:50:29 +08:00
Hungerdream 244f6adfb8 feat(ui): harden MySQL delivery workbench session and credential flow
- Persist workbench state (form, view, task progress) per user/service in sessionStorage; restore on reload re-fetches the task and resumes polling, never persisting the root password itself
- Gate the result tab behind resultReady so an unfinished task cannot show a stale result view
- Add random instance name generation and an async precheck that detects name conflicts against active tasks and delivered instances, mirroring the backend occupancy rules
- Guarantee all four character classes in generated root passwords
- Fetch credentials via the one-time reveal endpoint instead of caching plaintext passwords in localStorage; sanitize legacy history entries and clear the form password once the task is created
2026-07-29 13:50:18 +08:00
Hungerdream ecad474785 feat(delivery): enforce instance name uniqueness at task creation
Wrap task creation in a transaction that locks the business line row (SELECT ... FOR UPDATE) so concurrent requests cannot both pass the availability check. A name is considered occupied by in-flight or retained tasks (pending through registering, finished, register_failed, canceling, rollback_pending/rolling_back/rollback_failed) and by active deployment results; it becomes reusable only after rollback or explicit cleanup releases it.
2026-07-29 13:50:03 +08:00
Gmarker689 68325aca42 ci: run checks only after main updates 2026-07-29 13:45:32 +08:00
Gmarker689 5e25d92d77 ci: add GitHub Actions test workflow 2026-07-29 11:53:27 +08:00
qudder eaba4d237a Merge pull request #122 from Hungerdream/feat/mysql-delivery-form-enhancements
feat: MySQL 交付工作台重构与交付记录管理 (#108)
2026-07-29 09:24:41 +08:00
Hungerdream 08e9466bad feat(ui): add delivery records tab to service management
Management.vue gains a second tab listing MySQL delivery tasks from the backend (search, status filter, detail dialog, one-time credential reveal with copy/download). components.d.ts regenerated for the new Element Plus components.

Also add narrow-viewport (<=760px) style tweaks to AppHeader/AppMain/DefaultLayout; these are partial small-screen optimizations, not a full mobile adaptation.
2026-07-28 19:15:29 +08:00
Hungerdream f01398cc67 feat(ui): rework MySQL delivery workbench form and flow
Rebuild the MySQL standardized delivery form in Catalog.vue: sectioned layout (scope/resources/db config/advanced params), client-generated root password with regenerate/copy, storage slider, install/data path hints, inline field validation, delivery history and task polling.

Align CreateMySQLDeliveryPayload with the backend MySQLDeliveryInput contract (cpu_milli/memory_mi/storage_gi required, legacy fields optional, drop nonexistent param_template) and send mysql_root_password/mysql_admin_password as a pair so the credential shown to the user is the one actually deployed.
2026-07-28 19:15:14 +08:00
Hungerdream c139ed6d2f fix(ui): remove duplicate function implementations in TaskCenter
scrollToBottom and handleScroll were defined twice (verbatim), causing TS2393 duplicate implementation errors now surfaced by vue-tsc 2.x.
2026-07-28 19:14:59 +08:00
Hungerdream e30f547891 fix(ansible): harden mysql data_disk path validation
Reject bare '/', path traversal ('..') and duplicated slashes ('//') in mysql_data_disk assertions to avoid deploying into unsafe directories.
2026-07-28 19:14:50 +08:00
ztkkOip 6ce8ab74d5 Merge pull request #118 from ztkkOip/feat/base-service-delivery
Fix(base delivery)新增一些基础服务部署的功能
2026-07-28 18:03:23 +08:00
ztkkOip f28bc99401 Merge branch 'main' into feat/base-service-delivery 2026-07-28 18:03:04 +08:00
mac 93981b9aad feat: update delivery and resource frontends 2026-07-28 17:56:58 +08:00
mac f7be87c7d9 feat: wire delivery result and infra data backends 2026-07-28 17:56:00 +08:00
Wonder 408aa3af0d Merge pull request #120 from 2311719626/feat/task-logs-virtual-scroll
feat(task-logs): 优化任务中心日志前端展示 & fix(auth): 移除安全漏洞
2026-07-28 17:47:36 +08:00
Wonder c0ec5758c6 Merge branch 'main' into feat/task-logs-virtual-scroll 2026-07-28 17:47:26 +08:00
Wonder 552c1a18ac Merge pull request #119 from 2311719626/feat/task-logs-sse
feat(task-logs): 实现任务日志 SSE 实时推送
2026-07-28 17:45:16 +08:00
wonder 2fb9c3ccfd fix(auth): remove access_token query parameter from AuthMiddleware
移除认证中间件中 access_token 查询参数的回退逻辑,防止令牌通过 URL 暴露

- 仅支持 Authorization: Bearer 请求头认证
- 防止令牌被反向代理日志、浏览器历史、监控系统等捕获
- 前端已使用安全的头部认证方式
2026-07-28 17:30:46 +08:00
wonder 221d7dcc95 feat(task-logs): 优化任务中心日志前端展示
- 引入 @tanstack/vue-virtual 实现虚拟滚动,仅渲染可见区域日志行
- 添加自动滚动开关,用户可手动控制是否自动滚动
- 实现用户滚动检测,向上滚动时暂停自动滚动,滚到底部时恢复
- 优化日志面板头部布局,添加自动滚动开关 UI
2026-07-28 17:23:03 +08:00
wonder 053fd7027c feat(task-logs): 优化任务中心日志前端展示
- 引入 @tanstack/vue-virtual 实现虚拟滚动,仅渲染可见区域日志行
- 添加自动滚动开关,用户可手动控制是否自动滚动
- 实现用户滚动检测,向上滚动时暂停自动滚动,滚到底部时恢复
- 优化日志面板头部布局,添加自动滚动开关 UI

关联 PR: #119
2026-07-28 17:18:51 +08:00
wonder 8904330632 feat(task-logs): 实现任务日志 SSE 实时推送
实现任务日志 SSE 实时推送功能,解决前端无法流式输出日志的问题

变更内容:
- 后端:新增 /task-logs/stream SSE 端点,支持实时日志推送
- 后端:实现 2 秒轮询间隔检测新日志,支持心跳机制
- 后端:支持通过 query 参数 access_token 传递 JWT 认证
- 前端:新增 createTaskLogStream 函数封装 EventSource
- 前端:修改 TaskCenter.vue 集成 SSE,支持实时更新和自动滚动
- 前端:添加流式连接状态指示器

关联 commit:
- 实现后端 SSE Stream 方法
- 注册 SSE 路由
- 实现前端 SSE 客户端
- 集成 SSE 到任务中心页面
2026-07-28 17:06:44 +08:00
mac 897670b721 Merge remote-tracking branch 'upstream/main' into feat/base-service-delivery
# Conflicts:
#	ansible/mysql-deploy.yml
#	frontend/src/api/delivery.ts
#	frontend/src/views/service/Catalog.vue
#	server/.env.example
#	server/internal/config/config.go
#	server/internal/handler/task_log.go
#	server/internal/service/delivery.go
2026-07-28 15:08:37 +08:00
mac 8e09c30d21 feat: wire mysql delivery to awx callbacks 2026-07-28 14:45:17 +08:00
ztkkOip 7d6efeb3dd Merge pull request #117 from Hungerdream/feat/mysql-delivery-rollback
feat: MySQL 交付失败自动回滚 (#97)
2026-07-28 14:39:54 +08:00
Hungerdream d5bf42ad01 feat(ui): surface rollback actions in the service catalog
Add retryRollback / releaseRollback / retryCloudDMRegistration API
bindings and wire the corresponding actions and status presentation
into the delivery task view.
2026-07-28 14:29:34 +08:00
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