Skip to content
infrastructure-backup-restore logo

Infrastructure Backup and Restore Skill

infrastructure-backup-restore

Creates automated backup procedures, executes restoration operations, and implements disaster recovery workflows for network infrastructure. Use when backing up infrastructure before changes, preparing for disaster recovery, migrating to new server, or restoring after failure. Triggers on "backup...

SKILL.md

Full skill instructions

Works with Docker volumes (caddy_data, pihole_data), configuration files, and .env secrets.

Infrastructure Backup and Restore Skill

Complete backup and disaster recovery procedures for network infrastructure including Docker volumes, configuration files, and secrets.

Quick Start

Quick full backup:

# Create backup directory
backup_dir="/​home/​dawiddutoit/​projects/​network/​backups/​full-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$backup_dir"

# Backup Docker volumes
tar -czf "$backup_dir/​pihole_data.tar.gz" \
  -C /​var/​lib/​docker/​volumes/​network_pihole_data/​_data .
tar -czf "$backup_dir/​caddy_data.tar.gz" \
  -C /​var/​lib/​docker/​volumes/​network_caddy_data/​_data .

# Backup configuration
cp -r /​home/​dawiddutoit/​projects/​network/​docker-compose.yml "$backup_dir/"
cp -r /​home/​dawiddutoit/​projects/​network/​caddy "$backup_dir/"
cp -r /​home/​dawiddutoit/​projects/​network/​config "$backup_dir/"
cp -r /​home/​dawiddutoit/​projects/​network/​.env "$backup_dir/​.env"

echo "Backup completed: $backup_dir"

Table of Contents

  1. When to Use This Skill
  2. What This Skill Does
  3. Instructions
    • Full Infrastructure Backup
    • Restore Full Infrastructure
    • Disaster Recovery
  4. Supporting Files
  5. Expected Outcomes
  6. Requirements
  7. Red Flags to Avoid

When to Use This Skill

Explicit Triggers:

  • "Backup infrastructure"
  • "Restore from backup"
  • "Disaster recovery"
  • "Backup before upgrade"
  • "Migrate to new server"

Implicit Triggers:

  • Planning major infrastructure changes
  • Before OS upgrade or Docker upgrade
  • Hardware failure requiring migration
  • Testing disaster recovery procedures

Debugging Triggers:

  • "What should I backup?"
  • "How to restore from backup?"
  • "Disaster recovery plan?"

What This Skill Does

  1. Full Backup - Creates complete infrastructure backup (volumes + config)
  2. Volume Backup - Backs up Docker volumes (Pi-hole data, Caddy certificates)
  3. Config Backup - Backs up configuration files and .env secrets
  4. Full Restore - Restores complete infrastructure from backup
  5. Partial Restore - Restores specific components (volume or config only)
  6. Disaster Recovery - Complete rebuild procedure from backups
  7. Backup Management - Retention policies and cleanup procedures

Instructions

Use this skill to create and restore infrastructure backups. The skill provides workflows for:

  • Full infrastructure backups (volumes + configuration + secrets)
  • Partial backups (volumes only or configuration only)
  • Full restoration from backups
  • Disaster recovery from scratch on new hardware
  • Automated backup scheduling and retention

See detailed procedures in sections below and references/​backup-procedures.md for comprehensive guides.

Full Infrastructure Backup

Create complete backup with all components:

backup_dir="/​home/​dawiddutoit/​projects/​network/​backups/​full-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$backup_dir"

# Backup Docker volumes
tar -czf "$backup_dir/​pihole_data.tar.gz" \
  -C /​var/​lib/​docker/​volumes/​network_pihole_data/​_data .
tar -czf "$backup_dir/​caddy_data.tar.gz" \
  -C /​var/​lib/​docker/​volumes/​network_caddy_data/​_data .

# Backup configuration
cp /​home/​dawiddutoit/​projects/​network/​docker-compose.yml "$backup_dir/"
cp /​home/​dawiddutoit/​projects/​network/​.env "$backup_dir/​.env"
cp -r /​home/​dawiddutoit/​projects/​network/​caddy "$backup_dir/"
cp -r /​home/​dawiddutoit/​projects/​network/​config "$backup_dir/"

echo "Backup completed: $backup_dir"

What's backed up: Pi-hole data, Caddy certificates, configuration files, secrets (.env)

Restore Full Infrastructure

Restore from complete backup:

backup_dir="/​home/​dawiddutoit/​projects/​network/​backups/​full-backup-20260120"

# Stop services
cd /​home/​dawiddutoit/​projects/​network
docker compose down

# Restore volumes
docker volume rm network_pihole_data network_caddy_data
docker volume create network_pihole_data
docker volume create network_caddy_data
tar -xzf "$backup_dir/​pihole_data.tar.gz" \
  -C /​var/​lib/​docker/​volumes/​network_pihole_data/​_data
tar -xzf "$backup_dir/​caddy_data.tar.gz" \
  -C /​var/​lib/​docker/​volumes/​network_caddy_data/​_data

# Restore configuration
cp "$backup_dir/​docker-compose.yml" .
cp "$backup_dir/​.env" .
cp -r "$backup_dir/​caddy" .
cp -r "$backup_dir/​config" .

# Start services
docker compose up -d

Disaster Recovery

For complete rebuild on new hardware, see references/​backup-procedures.md section "Disaster Recovery".

Quick overview:

  1. Install Docker on new server
  2. Restore configuration files
  3. Restore Docker volumes
  4. Start services
  5. Verify connectivity and certificates

Recovery time: 15-30 minutes

Supporting Files

FilePurpose
references/​backup-procedures.mdDetailed backup/​restore procedures, disaster recovery, retention policies

Expected Outcomes

Success:

  • Full backup created with all components
  • Backup size reasonable (< 500MB typical)
  • Restoration completes without errors
  • All services running after restore
  • Configuration matches original

Partial Success:

  • Backup created but missing some components (check manifest)
  • Restore successful but services need manual restart

Failure Indicators:

  • Backup fails due to permissions (need sudo for volumes)
  • Restoration fails (volume path incorrect)
  • Services don't start after restore (check docker compose logs)

Requirements

  • Sufficient disk space for backups (recommend 2GB free)
  • Root/​sudo access for Docker volume access
  • Backup storage location with appropriate permissions
  • For disaster recovery: Same Docker version or compatible

Red Flags to Avoid

  • Do not store .env backups unencrypted (contains secrets)
  • Do not commit backups to git (contains sensitive data)
  • Do not delete original backup before verifying restore works
  • Do not restore to running services (stop first with docker compose down)
  • Do not skip verifying services after restore
  • Do not forget to backup .env file (critical for restoration)
  • Do not rely solely on certificate backups (can be re-obtained)

Notes

  • Backup Docker volumes while services are running (Docker handles consistency)
  • .env file is most critical (contains all secrets and tokens)
  • Certificates can be re-obtained if Cloudflare API token valid
  • Pi-hole data includes blocklists, custom DNS, whitelist
  • Full backup typically < 500MB (mostly Pi-hole blocklists)
  • Restoration requires docker and docker-compose installed
  • Test disaster recovery procedure periodically (quarterly recommended)
  • Consider encrypted off-site backups for true disaster recovery
  • Use backup-infrastructure script from existing skills if available

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
Imagica logo
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View