diff --git a/server-configs/proxmox/qemu/106.conf b/server-configs/proxmox/qemu/106.conf index 1e1231d..aa20f52 100644 --- a/server-configs/proxmox/qemu/106.conf +++ b/server-configs/proxmox/qemu/106.conf @@ -1,7 +1,7 @@ agent: 1 boot: order=scsi0;net0 cores: 4 -memory: 16384 +memory: 6144 meta: creation-qemu=6.1.0,ctime=1646083628 name: docker-home net0: virtio=BA:65:DF:88:85:4C,bridge=vmbr0,firewall=1 @@ -11,5 +11,5 @@ ostype: l26 scsi0: local-lvm:vm-106-disk-0,size=256G scsihw: virtio-scsi-pci smbios1: uuid=54ef12fc-edcc-4744-a109-dd2de9a6dc03 -sockets: 2 +sockets: 1 vmgenid: a13c92a2-a955-485e-a80e-391e99b19fbd diff --git a/server-configs/proxmox/right-sizing-vm-106.md b/server-configs/proxmox/right-sizing-vm-106.md new file mode 100644 index 0000000..74a939a --- /dev/null +++ b/server-configs/proxmox/right-sizing-vm-106.md @@ -0,0 +1,141 @@ +--- +title: "VM 106 (docker-home) Right-Sizing Runbook" +description: "Runbook for right-sizing VM 106 from 16 GB/8 vCPU to 6 GB/4 vCPU — pre-checks, resize commands, and post-resize validation." +type: runbook +domain: server-configs +tags: [proxmox, infra-audit, right-sizing, docker-home] +--- + +# VM 106 (docker-home) Right-Sizing Runbook + +## Context + +Infrastructure audit (2026-04-02) found VM 106 severely overprovisioned: + +| Resource | Allocated | Actual Usage | Target | +|----------|-----------|--------------|--------| +| RAM | 16 GB | 1.1–1.5 GB | 6 GB (4× headroom) | +| vCPUs | 8 (2 sockets × 4 cores) | load 0.12/core | 4 (1 socket × 4 cores) | + +**Services**: Pi-hole, Nginx Proxy Manager, Portainer + +## Pre-Check Results (2026-04-03) + +Automated checks were run before resizing. **All clear.** + +### Container memory limits + +```bash +docker inspect pihole nginx-proxy-manager_app_1 portainer \ + | python3 -c "import json,sys; c=json.load(sys.stdin); \ + [print(x['Name'], 'MemoryLimit:', x['HostConfig']['Memory']) for x in c]" +``` + +Result: +``` +/pihole MemoryLimit: 0 +/nginx-proxy-manager_app_1 MemoryLimit: 0 +/portainer MemoryLimit: 0 +``` + +`0` = no limit — no containers will OOM at 6 GB. + +### Docker Compose memory reservations + +```bash +grep -rn 'memory\|mem_limit\|memswap' /home/cal/container-data/*/docker-compose.yml +``` + +Result: **no matches** — no compose-level memory reservations. + +### Live memory usage at audit time + +``` +total: 15 GiB used: 1.1 GiB free: 6.8 GiB buff/cache: 7.7 GiB +Pi-hole: 463 MiB +NPM: 367 MiB +Portainer: 12 MiB +Total containers: ~842 MiB +``` + +## Resize Procedure + +Brief downtime: Pi-hole and NPM will be unavailable during shutdown. +Manticore runs Pi-hole 2 (10.10.0.226) for HA DNS — clients fail over automatically. + +### Step 1 — Shut down the VM + +```bash +ssh proxmox "qm shutdown 106 --timeout 60" +# Wait for shutdown +ssh proxmox "qm status 106" # Should show: status: stopped +``` + +### Step 2 — Apply new hardware config + +```bash +# Reduce RAM: 16384 MB → 6144 MB +ssh proxmox "qm set 106 --memory 6144" + +# Reduce vCPUs: 2 sockets × 4 cores → 1 socket × 4 cores (8 → 4 vCPUs) +ssh proxmox "qm set 106 --sockets 1 --cores 4" + +# Verify +ssh proxmox "qm config 106 | grep -E 'memory|cores|sockets'" +``` + +Expected output: +``` +cores: 4 +memory: 6144 +sockets: 1 +``` + +### Step 3 — Start the VM + +```bash +ssh proxmox "qm start 106" +``` + +Wait ~30 seconds for Docker to come up. + +### Step 4 — Verify services + +```bash +# Pi-hole DNS resolution +ssh pihole "docker exec pihole dig google.com @127.0.0.1 | grep -E 'SERVER|ANSWER'" + +# NPM — check it's running +ssh pihole "docker ps --filter name=nginx-proxy-manager --format '{{.Status}}'" + +# Portainer +ssh pihole "docker ps --filter name=portainer --format '{{.Status}}'" + +# Memory usage post-resize +ssh pihole "free -h" +``` + +### Step 5 — Monitor for 24h + +Check memory doesn't approach the 6 GB limit: + +```bash +ssh pihole "free -h && docker stats --no-stream --format 'table {{.Name}}\t{{.MemUsage}}'" +``` + +Alert threshold: if `used` exceeds 4.5 GB (75% of 6 GB), consider increasing to 8 GB. + +## Rollback + +If services fail to come up after resizing: + +```bash +# Restore original allocation +ssh proxmox "qm set 106 --memory 16384 --sockets 2 --cores 4" +ssh proxmox "qm start 106" +``` + +## Related + +- [Maintenance Reboot Runbook](maintenance-reboot.md) — VM 106 is Tier 2 (shut down after apps, before databases) +- Issue: cal/claude-home#19