--- name: vm-migration description: Migracao zero-downtime de workloads CWP e EasyPanel para VMs Proxmox com safety nets e rollback procedures. --- # VM Migration 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) - 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 ```bash /vm-migration [--phase 1|2|3] [--batch-size 5] [--validate-days 7] ``` ## Exemplos ```bash # Fase 1: EasyPanel migration (batch 5 containers) /vm-migration easypanel easy.descomplicar.pt --phase 1 --batch-size 5 # Fase 2: CWP migration com 7 dias validation /vm-migration cwp server.descomplicar.pt --phase 2 --validate-days 7 # Fase 3: Apenas confirmar (sem migracao) /vm-migration finalize --phase 3 ``` --- ## Knowledge Sources (Consultar SEMPRE) ```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` --- ## Migration-Plan-OptionA Overview **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 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 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 ``` --- ## Workflow Pre-Migration (Todas Fases) ### 1. Backup Strategy Validation ```bash # Verificar PBS configurado pvesm status | grep pbs # Criar backup point actual vzdump --storage pbs-main --all 1 --mode snapshot ``` 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 # EasyPanel: Listar services curl -s http://localhost:3000/api/trpc/projects.list | jq > /tmp/easypanel-services.json # DNS TTLs (baixar para 300s ANTES de migration) ``` ### 3. Comunicar Clientes (se downtime esperado) - Email 48h antes - Status page update - Janela de manutencao agendada --- ## Fases Detalhadas | 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) | --- ## Backup Strategy Resumo | 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 | --- ## Anti-Patterns | 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 | --- ## 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 (Modulo 4: Workloads) - **Desk CRM:** Projecto #65, Tarefa #1712