PhoenixShield:自愈式备份与更新系统 - Openclaw Skills
作者:互联网
2026-04-14
什么是 PhoenixShield?
PhoenixShield 为需要管理关键更新且不愿承担停机风险的开发人员和系统管理员提供了一个强大的安全网。作为 Openclaw Skills 生态系统中的专业条目,它实现了安全更新整个生命周期的自动化——从执行飞行前完整性检查到在系统健康状况下降时执行智能回滚。它通过自动恢复到最近的稳定状态,确保您的服务能够从失败更新的灰烬中重生。
通过将智能备份策略与持续健康监测相结合,PhoenixShield 消除了生产部署的手动压力。它旨在与各种环境无缝协作,提供对备份内容和系统恢复方式的细粒度控制,使其成为维护高可用性基础设施的必备工具。
下载入口:https://github.com/openclaw/skills/tree/main/skills/mig6671/phoenix-shield
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install phoenix-shield
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 phoenix-shield。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
PhoenixShield 应用场景
- 在停机不可接受的生产服务器上执行关键系统或软件包更新。
- 为需要健康验证的复杂应用管理零停机部署。
- 实施金丝雀测试,在全面推广前在隔离环境中验证更新。
- 自动化部署后坚控,以在 24 小时窗口内检测回归。
- 保护 Openclaw Skills 环境免受配置错误或依赖安装失败的影响。
- 流程始于飞行前检查,以验证磁盘空间、网络连接和当前服务健康基准。
- PhoenixShield 创建更新前快照,捕获配置、数据库状态和系统元数据。
- 通过受保护的部署封装器执行更新命令,该封装器实时退出代码和健康信号。
- 触发更新后健康检查,以验证所有关键服务是否按预期响应。
- 如果健康检查失败,智能回滚引擎将启动恢复序列,范围从服务重启到完整的系统还原。
- 在可配置的时间内继续进行扩展坚控,以确保初始部署阶段之后的稳定性。
PhoenixShield 配置指南
要将此工具集成到您的 Openclaw Skills 工作流中,请先初始化您的项目目录:
phoenix-shield init --project myapp --backup-dir /var/backups
在运行任何更新之前,创建当前系统状态的基准快照:
phoenix-shield snapshot --name "pre-update-baseline"
然后,您可以在 phoenix-shield.yaml 配置文件中定义更新参数和健康检查,以启用自动化保护。
PhoenixShield 数据架构与分类体系
PhoenixShield 维护着结构化的数据层级,以确保恢复的完整性和可审计性:
| 组件 | 格式 | 描述 |
|---|---|---|
| 配置 | YAML | 存储项目设置、健康检查命令和保留策略。 |
| 快照 | 压缩存档 | 包含系统状态、配置文件和带有 SHA-256 校验和的数据库转储。 |
| 健康指标 | JSON | 存储基准性能数据,用于与更新后的结果进行对比。 |
| 操作日志 | 文本/日志 | 所有部署、回滚和坚控事件的审计追踪。 |
| 元数据存储 | 键值对 | 为智能回滚引擎追踪备份版本、时间戳和部署历史。 |
name: phoenix-shield
description: Self-healing backup and update system with intelligent rollback. Protects against failed updates by automatically monitoring system health post-update and recovering from backups when needed. Features canary deployment testing, health baselines, smart rollback, and 24/7 automated monitoring. Use when performing critical system updates, managing production deployments, or ensuring high availability of services. Prevents downtime through pre-flight checks, integrity verification, and automatic recovery workflows.
PhoenixShield ?????
"Like the Phoenix, your system rises from its own backup"
Self-healing backup and update system with intelligent rollback capabilities.
Why PhoenixShield?
Problem: System updates can fail, leaving services broken and causing downtime.
Solution: PhoenixShield provides a complete safety net with automatic rollback when things go wrong.
Benefits:
- ?? Automatic Recovery - Self-heals when updates fail
- ?? Canary Testing - Test updates before production
- ?? Health Monitoring - 24h post-update monitoring
- ? Smart Rollback - Only revert changed components
- ??? Zero-Downtime - Graceful degradation when possible
Quick Start
1. Initialize PhoenixShield
phoenix-shield init --project myapp --backup-dir /var/backups
2. Create Pre-Update Snapshot
phoenix-shield snapshot --name "pre-update-$(date +%Y%m%d)"
3. Safe Update with Auto-Recovery
phoenix-shield update r
--command "npm update" r
--health-check "curl -f http://localhost/health" r
--auto-rollback
4. Monitor Post-Update
phoenix-shield monitor --duration 24h --interval 5m
Core Features
1. Pre-Flight Checks
Before any update, PhoenixShield verifies:
phoenix-shield preflight
Checks:
- ? Disk space available
- ? No critical processes running
- ? Backup storage accessible
- ? Network connectivity
- ? Service health baseline
2. Intelligent Backup
# Full system snapshot
phoenix-shield backup --full
# Incremental (only changed files)
phoenix-shield backup --incremental
# Config-only backup
phoenix-shield backup --config
Backup includes:
- Configuration files
- Database dumps
- System state
- Process list
- Network connections
- Health metrics baseline
3. Canary Deployment
Test updates on isolated environment first:
phoenix-shield canary r
--command "apt upgrade" r
--test-duration 5m r
--test-command "systemctl status nginx"
4. Production Update
Execute update with safety net:
phoenix-shield deploy r
--command "npm install -g openclaw@latest" r
--health-checks "openclaw --version" r
--health-checks "openclaw health" r
--rollback-on-failure
5. Post-Update Monitoring
Automatic monitoring stages:
| Timeframe | Checks |
|---|---|
| 0-5 min | Critical services running |
| 5-30 min | All services responding |
| 30-120 min | Integration tests |
| 2-24h | Stability monitoring |
phoenix-shield monitor --start
6. Smart Rollback
When update fails, PhoenixShield:
- Attempts soft recovery - Restart services
- Config rollback - Revert configuration
- Package rollback - Downgrade packages
- Full restore - Complete system restore
- Emergency mode - Minimal services, notify admin
# Manual rollback
phoenix-shield rollback --to-snapshot "pre-update-20260205"
# Check what would be rolled back (dry run)
phoenix-shield rollback --dry-run
Workflow Examples
Safe OpenClaw Update
#!/bin/bash
# Update OpenClaw with PhoenixShield protection
phoenix-shield preflight || exit 1
phoenix-shield snapshot --name "openclaw-$(date +%Y%m%d)"
phoenix-shield deploy r
--command "npm install -g openclaw@latest && cd /usr/lib/node_modules/openclaw && npm update" r
--health-check "openclaw --version" r
--health-check "openclaw doctor" r
--rollback-on-failure
phoenix-shield monitor --duration 2h
Ubuntu Server Update
phoenix-shield deploy r
--command "apt update && apt upgrade -y" r
--health-check "systemctl status nginx" r
--health-check "systemctl status mysql" r
--pre-hook "/root/notify-start.sh" r
--post-hook "/root/notify-complete.sh" r
--auto-rollback
Multi-Server Update
# Update multiple servers with PhoenixShield
SERVERS="server1 server2 server3"
for server in $SERVERS; do
phoenix-shield deploy r
--target "$server" r
--command "apt upgrade -y" r
--batch-size 1 r
--rollback-on-failure
done
Configuration
Create phoenix-shield.yaml:
project: my-production-app
backup:
directory: /var/backups/phoenix
retention: 10 # Keep last 10 backups
compression: gzip
health_checks:
- command: "curl -f http://localhost/health"
interval: 30s
retries: 3
- command: "systemctl status nginx"
interval: 60s
monitoring:
enabled: true
duration: 24h
intervals:
critical: 1m # 0-5 min
normal: 5m # 5-30 min
extended: 30m # 30-120 min
stability: 2h # 2-24h
rollback:
strategy: smart # smart, full, manual
auto_rollback: true
max_attempts: 3
notifications:
on_start: true
on_success: true
on_failure: true
on_rollback: true
Commands Reference
| Command | Description |
|---|---|
init |
Initialize PhoenixShield for project |
snapshot |
Create system snapshot |
backup |
Create backup (full/incremental) |
preflight |
Run pre-update checks |
canary |
Test update in isolated environment |
deploy |
Execute update with protection |
monitor |
Start post-update monitoring |
rollback |
Rollback to previous state |
status |
Show current status |
history |
Show update history |
verify |
Verify backup integrity |
Integration with CI/CD
# GitHub Actions example
- name: Safe Deployment
run: |
phoenix-shield preflight
phoenix-shield snapshot --name "deploy-$GITHUB_SHA"
phoenix-shield deploy r
--command "./deploy.sh" r
--health-check "curl -f http://localhost/ready" r
--auto-rollback
Best Practices
1. Always Use Preflight
# Bad
phoenix-shield deploy --command "apt upgrade"
# Good
phoenix-shield preflight && r
phoenix-shield deploy --command "apt upgrade"
2. Test Rollback Before Production
phoenix-shield snapshot --name test
phoenix-shield deploy --command "echo test"
phoenix-shield rollback --dry-run # See what would happen
3. Monitor Critical Updates
phoenix-shield deploy --command "major-update.sh"
phoenix-shield monitor --duration 48h # Extended monitoring
4. Maintain Backup Hygiene
# Regular cleanup
phoenix-shield cleanup --keep-last 10 --older-than 30d
# Verify backups
phoenix-shield verify --all
Troubleshooting
"Preflight check failed"
- Check disk space:
df -h - Verify backup location exists
- Ensure no critical processes running
"Rollback failed"
- Check backup integrity:
phoenix-shield verify - Manual restore from:
/var/backups/phoenix/ - Contact admin for emergency recovery
"Health checks failing"
- Extend monitoring:
phoenix-shield monitor --duration 48h - Check service logs:
journalctl -u myservice - Consider partial rollback:
phoenix-shield rollback --config-only
Architecture
┌─────────────────────────────────────┐
│ PhoenixShield Core │
├─────────────────────────────────────┤
│ PreFlight │ Deploy │ Monitor │ Roll │
├─────────────────────────────────────┤
│ Backup Engine │ Health Engine │
├─────────────────────────────────────┤
│ Snapshots │ Recovery │
├─────────────────────────────────────┤
│ Config │ State │ Logs │ Metrics │
└─────────────────────────────────────┘
Security
- Backups are encrypted at rest
- Integrity verification with checksums
- Secure handling of credentials
- Audit trail for all operations
License
MIT License - Free for personal and commercial use.
?? Links
- ClawHub: https://clawhub.com/skills/phoenix-shield
- GitHub: https://github.com/mig6671/phoenix-shield
- Documentation: This file
- Author: @mig6671 (OpenClaw Agent)
Like the Phoenix, your system rises from backup ?????
Credits
Created by OpenClaw Agent (@mig6671)
Inspired by the need for bulletproof system updates
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
HealthClaw 牙科:AI 驱动的牙科诊所管理 - Openclaw Skills
ERPClaw 销售:AI 订单到现金全生命周期管理 - Openclaw Skills
ERPClaw 欧盟区域合规:增值税、OSS 和电子发票 - Openclaw Skills
ERPClaw 人事:AI 人力资源与美国薪酬管理 - Openclaw Skills
erpclaw-journals:安全且AI原生的簿记系统 - Openclaw Skills
ERPClaw Growth:AI CRM 与业务分析 - Openclaw Skills
ERPClaw Billing:基于用量与计量的计费 - Openclaw Skills
educlaw: AI 原生教育与 SIS 管理 - Openclaw Skills
EduClaw K-12 扩展组件:学生管理与合规 - Openclaw Skills
AuditClaw AWS:自动化 AWS 合规证据收集 - Openclaw Skills
AI精选
