22 Commits

Author SHA1 Message Date
Hungerdream 454df86021 fix(ansible): 一主多从从库强制只读
- mysql-instance.cnf.j2 按 mysql_node_role=replica 注入 read-only/super-read-only,
  阻止业务直接写入从库导致主从数据分叉(复制线程与复制管理语句不受影响)
- 账号配置任务在从库上临时放开只读、配置完成后回锁,
  避免 cnf 只读拒绝 ALTER/CREATE USER;主库与 standalone 不受影响
2026-07-31 18:49:21 +08:00
Hungerdream 69a12d778e feat(ansible): MySQL 交付剧本接入 GTID 异步主从复制
- mysql_expected_hosts 按 replica_count 推导预期节点数
- 主节点判定改为 mysql_primary_host 显式指定,IP 经 hostvars 回退解析
- 副本节点等待主节点端口就绪后执行 CHANGE REPLICATION SOURCE
  (defaults-extra-file 临时凭据文件 + SOURCE_AUTO_POSITION + GET_SOURCE_PUBLIC_KEY)
- 复制线程验证含 IO/SQL Running 与错误字段空值检查
  (锚点带 ^[[:space:]]* 适配 SHOW REPLICA STATUS\G 的字段名前导空格)
2026-07-31 18:12:15 +08:00
l x 363ad5f9be fix(delivery): add PostgreSQL rollback and CloudDM isolation 2026-07-31 11:16:19 +08:00
l x 66fde73792 feat(delivery): integrate PostgreSQL delivery 2026-07-31 10:30:03 +08:00
mac 1aa984c7e5 feat(delivery): sync mysql service ledger and credentials 2026-07-30 16:09:13 +08:00
Hungerdream b3eb10a81d fix(ansible): reload systemd daemon before restarting delivery instance
Ensure updated mysql-delivery@.service unit definitions are picked up
by running daemon-reload before the instance restart in both delivery
playbooks.
2026-07-29 18:39:37 +08:00
Hungerdream ef6508938c feat(delivery): switch to a single root@% admin account model
- CreateTask now accepts only mysql_root_password; drop
  mysql_admin_password and the paired root/admin validation,
  keeping the >=16-char length and alphanumeric-only checks
- deploymentCredentialVars extracts mysql_root_password only,
  remaining compatible with legacy root@localhost records
- Both delivery playbooks drop xinfra_admin provisioning and
  the mysql_admin_password assertion, creating 'root'@'%'
  as the remote admin account instead
2026-07-29 18:39:37 +08:00
mac 35875218c9 feat(delivery): refine base service integrations 2026-07-29 16:47:41 +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
mac f7be87c7d9 feat: wire delivery result and infra data backends 2026-07-28 17:56:00 +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
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 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 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 4637228bae feat(delivery): add AWX callback MySQL playbook 2026-07-27 17:25:03 +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
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
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