# Swag cleanup steps

1. Don't destroy the account/cert state — just version the parts that matter
The SWAG /config volume has a mix of:
Config you authored (nginx site-confs, proxy-confs, fail2ban jail overrides, .env/compose) → put this in git
Secrets (DNS API tokens in dns-conf/*.ini, if you ever add them) → git-ignore these, or use a separate secrets file/Unraid's own secrets store
State certbot manages (/config/etc/letsencrypt/{live,archive,renewal,accounts}) → don't hand-manage this in git, just back it up as a tarball before you touch anything
2. Suggested low-impact day plan
# 1. Snapshot everything first, untouched
docker exec swag tar czf /config/pre-rebuild-backup.tar.gz \
  --exclude='pre-rebuild-backup.tar.gz' /config
docker cp swag:/config/pre-rebuild-backup.tar.gz ./swag-config-backup-$(date +%F).tar.gz

# 2. Pull out just the human-authored bits into a git repo
mkdir -p ~/swag-config/{nginx/proxy-confs,nginx/site-confs,fail2ban}
docker cp swag:/config/nginx/proxy-confs ~/swag-config/nginx/
docker cp swag:/config/nginx/site-confs ~/swag-config/nginx/
docker cp swag:/config/fail2ban ~/swag-config/
# grab your docker-compose/unraid template too
cp /boot/config/plugins/dockerMan/templates-user/*swag* ~/swag-config/ 2>/dev/null

cd ~/swag-config && git init && git add -A && git commit -m "snapshot of working swag config before rebuild"
3. Rebuild clean
Delete the container (keep the /config appdata folder as a reference, don't wipe it yet — rename it to swag-old instead of deleting)
Recreate the container fresh in Unraid with a brand-new empty appdata path
Let SWAG's first-run wizard generate everything from scratch (new ACME account, new cert, new default nginx confs)
Copy your versioned proxy-confs/site-confs/fail2ban customizations back in from git
Validate each subdomain one at a time
4. Things worth deciding before you do this
Do you actually use DNS-01 anywhere (namecheap plugin is configured but you're using http challenge per cli.ini) — if not, you can probably simplify/remove the unused DNS plugin config
Pin the SWAG image tag (e.g. linuxserver/swag:1.x-ls123) in your compose instead of :latest, so the next migration-style surprise happens on your schedule, not on an auto-update
Add a simple watchdog (described below) regardless of rebuild, so this class of failure pages you instead of silently expiring