feat: refactor 30+ skills to Anthropic progressive disclosure pattern

- All SKILL.md files now <500 lines (avg reduction 69%)
- Detailed content extracted to references/ subdirectories
- Frontmatter standardised: only name + description (Anthropic standard)
- New skills: brand-guidelines, spec-coauthor, report-templates, skill-creator
- Design skills: anti-slop guidelines, premium-proposals reference
- Removed non-standard frontmatter fields (triggers, version, author, category)

Plugins affected: infraestrutura, marketing, dev-tools, crm-ops, gestao,
core-tools, negocio, perfex-dev, wordpress, design-media

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 15:05:03 +00:00
parent 9404af7ac9
commit 6b3a6f2698
397 changed files with 67154 additions and 17257 deletions

View File

@@ -1,30 +1,24 @@
---
name: vm-migration
description: Migração zero-downtime de workloads CWP/EasyPanel para Proxmox VMs seguindo Migration-Plan-OptionA. Use when user mentions "migrate to proxmox", "cwp migration", "easypanel migration", "workload migration".
author: Descomplicar® Crescimento Digital
version: 1.0.0
quality_score: 75
user_invocable: true
desk_task: 1712
allowed-tools: Task, Read, Bash
dependencies:
- ssh-unified
- notebooklm
- proxmox-setup
- pbs-config
description: Migracao zero-downtime de workloads CWP e EasyPanel para VMs Proxmox com safety nets e rollback procedures.
---
# VM Migration
Migração zero-downtime de workloads CWP e EasyPanel para Proxmox VMs seguindo Migration-Plan-OptionA com safety nets e rollback procedures.
Migracao zero-downtime de workloads CWP e EasyPanel para Proxmox VMs seguindo Migration-Plan-OptionA com safety nets e rollback procedures.
## Quando Usar
- Migrar servidores CWP para VMs Proxmox
- Migrar containers EasyPanel para VMs Proxmox
- Executar Migration-Plan-OptionA (3 fases)
- Migração phased com validation periods
- Zero-downtime para clientes production
- Migracao phased com validation periods
## Quando Nao Usar
- Migracoes non-CWP/EasyPanel (criar plan especifico)
- Ambientes teste/dev (menos rigor)
- Single-server setups (nao cluster)
## Sintaxe
@@ -41,74 +35,70 @@ Migração zero-downtime de workloads CWP e EasyPanel para Proxmox VMs seguindo
# Fase 2: CWP migration com 7 dias validation
/vm-migration cwp server.descomplicar.pt --phase 2 --validate-days 7
# Fase 3: Apenas confirmar (sem migração)
# Fase 3: Apenas confirmar (sem migracao)
/vm-migration finalize --phase 3
```
---
## Knowledge Sources (Consultar SEMPRE)
### NotebookLM Proxmox Research
```bash
mcp__notebooklm__notebook_query \
notebook_id:"276ccdde-6b95-42a3-ad96-4e64d64c8d52" \
query:"proxmox migration cwp easypanel docker lxc zero downtime"
```
### Hub Docs
- Hub/05-Projectos/Cluster Descomplicar/Planning/Migration-Plan-OptionA.md
- Fase 1: EasyPanel (Week 1-2)
- Fase 2: CWP (Week 3-6, 7 dias validation)
- Fase 3: Cluster + cleanup (Week 7-8)
Hub Docs: `Hub/05-Projectos/Cluster Descomplicar/Planning/Migration-Plan-OptionA.md`
---
## Migration-Plan-OptionA Overview
**Timeline:** 8 semanas
**Strategy:** Phased migration com safety nets
**Rollback:** Disponível em cada fase
**Timeline:** 8 semanas | **Strategy:** Phased migration com safety nets | **Rollback:** Disponivel em cada fase
```
Week 1-2: FASE 1 - EasyPanel Migration
├── Backup EasyPanel PBS
├── Create Docker VM Proxmox
├── Migrate containers (batch 5-10)
├── DNS cutover gradual
└── Validation + Rollback window
+-- Backup EasyPanel -> PBS
+-- Create Docker VM Proxmox
+-- Migrate containers (batch 5-10)
+-- DNS cutover gradual
+-- Validation + Rollback window
Week 3-6: FASE 2 - CWP Migration
├── 7 dias safety net (server intacto)
├── Create AlmaLinux 8 VM
├── Migrate CWP accounts (batch)
├── Validate sites + email
├── DNS cutover (TTL 300s)
└── Rollback até Day 7
+-- 7 dias safety net (server intacto)
+-- Create AlmaLinux 8 VM
+-- Migrate CWP accounts (batch)
+-- Validate sites + email
+-- DNS cutover (TTL 300s)
+-- Rollback ate Day 7
Week 7-8: FASE 3 - Cluster Formation
├── Prepare server.descomplicar.pt as Node A
├── Form cluster (pvecm)
├── Configure HA groups
├── Live migration tests
└── Cleanup legacy servers
+-- Prepare server.descomplicar.pt as Node A
+-- Form cluster (pvecm)
+-- Configure HA groups
+-- Live migration tests
+-- Cleanup legacy servers
```
## Workflow Completo
---
### PRE-MIGRATION (Todas Fases)
## Workflow Pre-Migration (Todas Fases)
### 1. Backup Strategy Validation
**1. Backup Strategy Validation**
```bash
# Verificar PBS configurado
pvesm status | grep pbs
# Criar backup point actual
vzdump --storage pbs-main --all 1 --mode snapshot
# Verificar 3-2-1 compliance:
# - Original: source server
# - Backup 1: PBS Node B
# - Backup 2: PBS Node A remote sync (ou VPS backup)
```
**2. Documentar Estado Actual**
Garantir 3-2-1 compliance: original + PBS Node B + PBS Node A remote sync.
### 2. Documentar Estado Actual
```bash
# CWP: Listar contas
/scripts/list_accounts > /tmp/cwp-accounts.txt
@@ -117,455 +107,51 @@ vzdump --storage pbs-main --all 1 --mode snapshot
curl -s http://localhost:3000/api/trpc/projects.list | jq > /tmp/easypanel-services.json
# DNS TTLs (baixar para 300s ANTES de migration)
# Verificar em: dns.descomplicar.pt ou Cloudflare
```
**3. Comunicar Clientes (se downtime esperado)**
### 3. Comunicar Clientes (se downtime esperado)
- Email 48h antes
- Status page update
- Janela de manutenção agendada
- Janela de manutencao agendada
---
### FASE 1: EasyPanel Migration (Week 1-2)
## Fases Detalhadas
**Target:** Migrar 108 containers Docker para VM Proxmox
**1.1 Criar VM Docker Host**
```bash
# Via Proxmox CLI
qm create 200 \
--name easypanel-docker \
--memory 32768 \
--cores 8 \
--net0 virtio,bridge=vmbr0 \
--scsi0 rpool/vm-disks:200 \
--ostype l26 \
--boot order=scsi0
# Install Ubuntu 24.04 LTS
# Via Cloud-Init ou ISO manual
```
**1.2 Instalar Docker + EasyPanel**
```bash
# SSH to VM
ssh root@10.10.10.200
# Docker
curl -fsSL https://get.docker.com | sh
# EasyPanel
curl -sSL https://get.easypanel.io | sh
```
**1.3 Backup Containers Actuais**
```bash
# Em easy.descomplicar.pt
# Backup docker volumes
tar -czf /tmp/easypanel-volumes.tar.gz /var/lib/easypanel/projects
# Transfer para PBS ou storage temporário
scp /tmp/easypanel-volumes.tar.gz root@cluster.descomplicar.pt:/mnt/migration/
```
**1.4 Migrar Containers (Batch 5-10)**
**Batch 1 (não-críticos para teste):**
```bash
# Containers teste: dev environments, staging
# IDs: 1-5
# Por cada container:
1. Exportar env vars do EasyPanel
2. Exportar docker-compose.yml
3. Copiar volumes
4. Recriar em novo EasyPanel
5. Testar health endpoint
6. DNS cutover se OK
```
**Workflow Batch:**
```bash
# Script semi-automatizado
for container_id in 1 2 3 4 5; do
# Export config
curl -s http://easy.descomplicar.pt:3000/api/trpc/services.get \
-d "serviceId=$container_id" > config_$container_id.json
# Copiar volumes
rsync -avz /var/lib/easypanel/projects/$container_id/ \
root@10.10.10.200:/var/lib/easypanel/projects/$container_id/
# Recriar service (via EasyPanel API ou UI)
# Test
curl -I http://10.10.10.200:PORT/health
# DNS cutover (se health OK)
# Actualizar DNS para apontar para 10.10.10.200 (via NAT port forward)
done
```
**1.5 Validation (24-48h por batch)**
```bash
# Monitoring:
- Uptime checks (UptimeRobot ou similar)
- Error rates (logs)
- Performance (response time <500ms)
- Cliente feedback
# Rollback triggers:
- >2 containers falham consecutivamente
- Cliente reporta down
- Health checks fail >10min
```
**1.6 DNS Cutover**
```bash
# Baixar TTL para 300s (5min) 24h ANTES
# Ex: Cloudflare ou dns.descomplicar.pt
# Cutover:
A record: old-ip → NAT port forward para 10.10.10.200:PORT
# Monitorizar por 1h
# Reverter se problemas
```
**1.7 Rollback Procedure (se necessário)**
```bash
# Reverter DNS (TTL 300s = 5min propagação)
# Reactivar container antigo
# Investigar causa falha
# Re-tentar após fix
```
**Batch 2-N:** Repetir até 108 containers migrados.
| Fase | Detalhes | Referencia |
|------|----------|------------|
| Fase 1: EasyPanel (Week 1-2) | 108 containers Docker -> VM Proxmox | [references/fase1-easypanel.md](references/fase1-easypanel.md) |
| Fase 2: CWP (Week 3-6) | 39 vhosts CWP -> VM AlmaLinux 8 | [references/fase2-cwp.md](references/fase2-cwp.md) |
| Fase 3: Cluster (Week 7-8) | 2-node cluster, HA, cleanup | [references/fase3-cluster.md](references/fase3-cluster.md) |
| Troubleshooting | Problemas comuns e resolucao | [references/troubleshooting.md](references/troubleshooting.md) |
---
### FASE 2: CWP Migration (Week 3-6)
## Backup Strategy Resumo
**Target:** Migrar 39 vhosts CWP para VM AlmaLinux 8
**CRITICAL:** 7 dias safety net - server.descomplicar.pt intacto
**2.1 Criar VM AlmaLinux 8 + CWP**
```bash
qm create 300 \
--name cwp-legacy \
--memory 16384 \
--cores 6 \
--net0 virtio,bridge=vmbr0 \
--scsi0 rpool/vm-disks:150 \
--ostype l26
# Instalar AlmaLinux 8
# Instalar CWP7
wget http://centos-webpanel.com/cwp-el8-latest
sh cwp-el8-latest
```
**2.2 Backup CWP Accounts**
```bash
# Em server.descomplicar.pt
for account in $(cat /tmp/cwp-accounts.txt); do
/scripts/pkgacct $account
done
# Transfer backups
rsync -avz /home/backup-*/cpmove-*.tar.gz \
root@cluster.descomplicar.pt:/mnt/migration/cwp/
```
**2.3 Migrar Contas (Batch 3-5 contas)**
**Workflow por conta:**
```bash
# 1. Restore backup em VM CWP
scp /mnt/migration/cwp/cpmove-ACCOUNT.tar.gz root@10.10.10.300:/home/
# 2. Restore via CWP
/scripts/restorepkg ACCOUNT
# 3. Validar:
- Site carrega (HTTP 200)
- Database conecta
- Email funciona (send test)
- SSL certificado válido
# 4. DNS cutover (TTL 300s)
A record: site.com → 10.10.10.300 (via NAT port forward)
# 5. Monitorizar 24h
```
**2.4 Validation Period (7 dias)**
```bash
# Days 1-7 após migration:
- Server antigo (server.descomplicar.pt) INTACTO
- Rollback instantâneo se problema critical
- Cliente pode reverter DNS manualmente se necessário
# Day 7: Confirmar com Emanuel
# Se tudo OK → proceder cleanup
# Se problemas → extend validation ou rollback completo
```
**2.5 Email Migration**
```bash
# Por cada conta CWP:
# 1. Backup mailboxes
tar -czf /tmp/mail-ACCOUNT.tar.gz /home/ACCOUNT/mail/
# 2. Transfer
scp /tmp/mail-ACCOUNT.tar.gz root@10.10.10.300:/tmp/
# 3. Restore
cd /home/ACCOUNT/
tar -xzf /tmp/mail-ACCOUNT.tar.gz
# 4. Fix permissions
chown -R ACCOUNT:ACCOUNT /home/ACCOUNT/mail/
# 5. Testar IMAP/SMTP
telnet localhost 143 # IMAP
telnet localhost 25 # SMTP
```
**2.6 Rollback Procedure (Fase 2)**
```bash
# Disponível até Day 7
# 1. Reverter DNS (todos sites)
A records → IP antigo (server.descomplicar.pt)
# 2. Verificar server antigo online
ping server.descomplicar.pt
# 3. Comunicar clientes
# 4. Analisar causa falha
# 5. Ajustar plan e re-tentar
```
| Fase | Locais Backup | RPO | RTO |
|------|---------------|-----|-----|
| Fase 1 | Original + PBS + VPS | 1h | 2-4h |
| Fase 2 | Server intacto + PBS + /mnt/migration/ | 1h | 2-4h |
| Fase 3 | Node A + Node B + PBS dual | 1h | 2-4h |
---
### FASE 3: Cluster Formation (Week 7-8)
## Anti-Patterns
**Target:** Formar cluster 2-node, HA, cleanup
**3.1 Preparar server.descomplicar.pt como Node A**
```bash
# APENAS após Fase 2 100% validada
# Backup final completo
tar -czf /tmp/final-backup-server.tar.gz /etc /home /var/www
# Reformatar com Proxmox (/proxmox-setup)
# Tornar Node A do cluster
```
**3.2 Cluster Formation**
```bash
# Usar skill /proxmox-cluster (criada a seguir)
/proxmox-cluster create --node-a server.descomplicar.pt --node-b cluster.descomplicar.pt
```
**3.3 HA Configuration**
```bash
# Usar skill /proxmox-ha (criada a seguir)
/proxmox-ha configure --critical-vms 200,300
```
**3.4 Cleanup**
```bash
# Cancelar easy.descomplicar.pt VPS (após validação)
# Backup final de tudo
# Documentar nova arquitectura
```
| Anti-Pattern | Risco | Alternativa |
|--------------|-------|-------------|
| Migrar tudo de uma vez | Downtime total | Batches de 5-10 |
| Nao baixar TTL antes | DNS lento a propagar | TTL 300s 24h antes |
| Apagar server antigo cedo | Sem rollback | Manter 7 dias |
| Sem backup pre-migration | Perda dados | vzdump + 3-2-1 |
---
## Backup Strategy Durante Migration
### Fase 1 (EasyPanel)
**3 locais:**
1. Containers em easy.descomplicar.pt (original)
2. PBS Node B backup
3. easy.descomplicar.pt VPS backup (mantido durante Fase 1)
### Fase 2 (CWP)
**Safety net 7 dias:**
1. Server antigo intacto (rollback rápido)
2. VM CWP → PBS backups automáticos
3. Backups manuais /mnt/migration/
**RPO:** 1h (PBS backups hourly se critical)
**RTO:** 2-4h (restore + DNS propagation)
### Fase 3 (Cluster)
**Redundância completa:**
1. VMs em Node A + Node B
2. PBS primary (Node B 16TB)
3. PBS secondary remote sync (Node A 12TB)
## Output Summary (Por Fase)
### Fase 1 Complete:
```
✅ EasyPanel migrado: 108 containers
📦 Containers:
- Migrados: 108/108
- Falhas: 0
- Rollbacks: 0
- Downtime médio: <2min por container
🎯 Validation:
- Health checks: 100% OK
- Cliente feedback: 0 issues
- Performance: <500ms avg response
🔄 DNS Cutover:
- TTL: 300s (5min)
- Domains migrados: ALL
- Rollback window: 7 dias
📋 Next: Fase 2 (CWP migration)
```
### Fase 2 Complete:
```
✅ CWP migrado: 39 vhosts
🌐 Sites:
- Migrados: 39/39
- HTTP 200: 100%
- SSL válido: 100%
- Email funcional: 100%
⏱️ Timeline:
- Week 3-6: Migration
- Day 1-7: Validation period
- Day 8: Cleanup (se OK)
🔒 Safety Net:
- Server antigo: ONLINE (Day 1-7)
- Rollback: Disponível (DNS reverter)
- Backups: 3 locais
📋 Next: Fase 3 (Cluster formation)
```
### Fase 3 Complete:
```
✅ Cluster Proxmox formado: 2 nodes
🖥️ Nodes:
- Node A: server.descomplicar.pt (reformatado)
- Node B: cluster.descomplicar.pt
- Quorum: 2 votes
🔄 HA:
- Critical VMs: 200, 300
- Failover: Automatic
- Live migration: Enabled
💾 PBS Redundancy:
- Primary: Node B (16TB)
- Secondary: Node A (12TB) remote sync
- RPO: 1h | RTO: 2-4h
🎉 Migration Complete:
- Total time: 8 weeks
- Downtime: <5min total
- Issues: 0 critical
- Cliente satisfaction: HIGH
📋 Post-Migration:
- Monitor por 30 dias
- Documentar em PROC-VM-Migration.md
- Cancelar VPS legacy
- Treino equipa Proxmox
```
## Troubleshooting
### Container migration fails
```bash
# Verificar logs
docker logs CONTAINER_ID
# Verificar volumes
ls -lah /var/lib/easypanel/projects/PROJECT/
# Testar manual
docker-compose up -d
# Rollback e investigar
```
### CWP site não carrega após migration
```bash
# Verificar Apache
systemctl status httpd
# Verificar vhost
cat /usr/local/apache/conf.d/vhosts/DOMAIN.conf
# Verificar database
mysql -u USER -p DATABASE
# Verificar DNS propagation
dig +short DOMAIN @8.8.8.8
```
### Email não funciona
```bash
# Verificar Postfix
systemctl status postfix
# Testar SMTP
telnet localhost 25
# Verificar DNS MX
dig +short MX DOMAIN
# Verificar logs
tail -f /var/log/maillog
```
## References
- **Migration Plan:** Hub/05-Projectos/Cluster Descomplicar/Planning/Migration-Plan-OptionA.md
- **NotebookLM:** 276ccdde-6b95-42a3-ad96-4e64d64c8d52
- **Guia Hub:** Guia-Definitivo-Proxmox-Hetzner.md (Módulo 4: Workloads)
---
**Versão:** 1.0.0 | **Autor:** Descomplicar® | **Data:** 2026-02-14
## Metadata (Desk CRM Task #1712)
```
Projeto: Cluster Proxmox Descomplicar (#65)
Tarefa: Migração Infraestrutura (#1712)
Tags: migration, cwp, easypanel, zero-downtime, phased
Status: Implementation
```
---
**/** @author Descomplicar® | @link descomplicar.pt | @copyright 2026 **/
---
## Quando NÃO Usar
- Para migrações non-CWP/EasyPanel (criar plan específico)
- Para teste/dev environments (menos rigor)
- Para single-server setups (não cluster)
- **Guia Hub:** Guia-Definitivo-Proxmox-Hetzner.md (Modulo 4: Workloads)
- **Desk CRM:** Projecto #65, Tarefa #1712