claude-home/server-configs/proxmox/right-sizing-vm-106.md
Cal Corum 9b47f0c027
All checks were successful
Auto-merge docs-only PRs / auto-merge-docs (pull_request) Successful in 5s
docs: right-size VM 106 (docker-home) — 16 GB/8 vCPU → 6 GB/4 vCPU (#19)
Pre-checks confirmed safe to right-size: no container --memory limits,
no Docker Compose memory reservations. Live usage 1.1 GB / 15 GB (7%).

- Update 106.conf: memory 16384 → 6144, sockets 2 → 1 (8 → 4 vCPUs)
- Add right-sizing-vm-106.md runbook with pre-check results and resize commands

Closes #19

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 23:05:43 -05:00

142 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
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.11.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