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