ian / swag-cleanup.txt

Last active 2 weeks ago

Like 0

Revision 2a30fc3129a78e278444749168b863c21d440779

swag-cleanup.txt Raw
1# Swag cleanup steps
2
31. Don't destroy the account/cert state — just version the parts that matter
4The SWAG /config volume has a mix of:
5Config you authored (nginx site-confs, proxy-confs, fail2ban jail overrides, .env/compose) → put this in git
6Secrets (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
7State 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
82. Suggested low-impact day plan
9# 1. Snapshot everything first, untouched
10docker exec swag tar czf /config/pre-rebuild-backup.tar.gz \
11 --exclude='pre-rebuild-backup.tar.gz' /config
12docker cp swag:/config/pre-rebuild-backup.tar.gz ./swag-config-backup-$(date +%F).tar.gz
13
14# 2. Pull out just the human-authored bits into a git repo
15mkdir -p ~/swag-config/{nginx/proxy-confs,nginx/site-confs,fail2ban}
16docker cp swag:/config/nginx/proxy-confs ~/swag-config/nginx/
17docker cp swag:/config/nginx/site-confs ~/swag-config/nginx/
18docker cp swag:/config/fail2ban ~/swag-config/
19# grab your docker-compose/unraid template too
20cp /boot/config/plugins/dockerMan/templates-user/*swag* ~/swag-config/ 2>/dev/null
21
22cd ~/swag-config && git init && git add -A && git commit -m "snapshot of working swag config before rebuild"
233. Rebuild clean
24Delete the container (keep the /config appdata folder as a reference, don't wipe it yet — rename it to swag-old instead of deleting)
25Recreate the container fresh in Unraid with a brand-new empty appdata path
26Let SWAG's first-run wizard generate everything from scratch (new ACME account, new cert, new default nginx confs)
27Copy your versioned proxy-confs/site-confs/fail2ban customizations back in from git
28Validate each subdomain one at a time
294. Things worth deciding before you do this
30Do 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
31Pin 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
32Add a simple watchdog (described below) regardless of rebuild, so this class of failure pages you instead of silently expiring