Skip to main content

Backups

This repo uses a mix of centralized databases and service-specific artifacts. The backup strategy is therefore layered:

  1. Infrastructure-level backups (host + Docker volumes where appropriate)
  2. Central databases (PostgreSQL and Redis)
  3. Versioned configuration artifacts (JSON exports, templates)

Golden rule

If a piece of information must be recovered reliably, it must have exactly one canonical backup mechanism.

  • If it is configuration-as-code, keep it in Git (templates, manifests, exports).
  • If it is runtime state, back it up from the canonical datastore (usually Central PostgreSQL).

ThingsBoard

Analysis date: 2026-03-20

What to version in Git

Version functional artifacts under platform/thingsboard/exports/:

  • dashboards
  • profiles (device/asset)
  • rule chains
  • widgets / widget bundles

What to back up operationally

For a full instance clone/restore, back up the ThingsBoard database (Central PostgreSQL) plus deployment/customization files:

  • DB dump:
    docker exec postgres-central pg_dump \
    -U "${POSTGRES_SUPERUSER:-postgres}" \
    -d "${THINGSBOARD_DB_NAME:-thingsboard}" \
    -Fc > thingsboard.dump
  • Customizations and runtime files:
    • platform/thingsboard/Dockerfile
    • platform/thingsboard/custom/
    • platform/thingsboard/conf/
    • platform/thingsboard/.env (generated)

Key risks

  • JSON exports do not guarantee cross-dependencies (import order matters).
  • DB-only restores do not capture custom JARs/templates.

n8n

Analysis date: 2026-03-20

What to version in Git

  • Workflows and auxiliary artifacts under infrastructure/n8n/export/
  • Data tables under infrastructure/n8n/export/datatables/
  • Community nodes list under infrastructure/n8n/n8n_data/nodes/package.json

What to back up operationally

  • Encryption key (required to decrypt credentials): infrastructure/n8n/n8n_data/config
  • Central PostgreSQL DB dump:
    docker exec postgres-central pg_dump \
    -U "${POSTGRES_SUPERUSER:-postgres}" \
    -d "${N8N_DB_NAME:-n8n}" \
    -Fc > n8n.dump

CLI export/import

Useful commands (run in the n8n container or a compatible environment):

  • n8n export:workflow --all --backup --output=/tmp/n8n-workflows
  • n8n export:credentials --all --output=/tmp/n8n-credentials
  • n8n export:entities --outputDir=/tmp/n8n-entities
  • n8n import:workflow --separate --input=/tmp/n8n-workflows
  • n8n import:credentials --input=/tmp/n8n-credentials
  • n8n import:entities --inputDir=/tmp/n8n-entities

For cross-instance migration, ensure the encryptionKey matches, or export decrypted credentials with --decrypted.