Skip to main content

CLI command reference

Complete reference for Infrahub Backup commands, flags, and options.

infrahub-backup

Command structure

infrahub-backup [global-flags] <command> [flags] [arguments]

Global flags

These flags apply to all infrahub-backup commands:

FlagDescriptionDefaultEnvironment Variable
--project <name>Target specific Docker Compose projectAuto-detectINFRAHUB_PROJECT
--backup-dir <path>Directory for backup files./infrahub_backupsINFRAHUB_BACKUP_DIR
--log-format <text|json>Output format for logstextINFRAHUB_LOG_FORMAT
--help, -hShow help for any command--

Backup commands

create

Creates a comprehensive backup of the Infrahub instance.

Syntax:

infrahub-backup create [flags]

Flags:

FlagDescriptionDefault
--forceForce backup even if tasks are runningfalse
--neo4jmetadata <type>Neo4j metadata to includeall
--exclude-taskmanagerExclude the task manager (Prefect) database from the backup archivefalse

Neo4j metadata options:

  • all - Include all user and role metadata
  • users - Include only user accounts
  • roles - Include only role definitions
  • none - Exclude all metadata

Examples:

# Basic backup
infrahub-backup create

# Force backup with running tasks
infrahub-backup create --force

# Backup without user metadata
infrahub-backup create --neo4jmetadata=none

restore

Restores Infrahub from a backup file.

Syntax:

infrahub-backup restore <backup-file>

Arguments:

  • <backup-file> - Path to backup archive (required)

Flags:

FlagDescriptionDefault
--exclude-taskmanagerSkip restoring the task manager database even if the dump is presentfalse

Examples:

# Basic restore
infrahub-backup restore infrahub_backup_20250929_143022.tar.gz

# Restore when the task manager database was excluded from the backup
infrahub-backup restore infrahub_backup_20251022_120000.tar.gz --exclude-taskmanager-db

Environment commands

environment detect

Detects and displays the current deployment environment.

Syntax:

infrahub-backup environment detect

Example output:

INFO[0000] Detecting deployment environment...
INFO[0000] Docker environment detected
INFO[0000] Found Docker Compose project: infrahub-demo

environment list

Lists all available Infrahub Docker Compose projects.

Syntax:

infrahub-backup environment list

Example output:

infrahub-production  Running   7/7
infrahub-staging Running 7/7
infrahub-dev Stopped 0/7

Utility commands

version

Displays version information.

Syntax:

infrahub-backup version

Example output:

Version: 1.0.0

Configuration precedence

Configuration values are resolved in this order:

  1. Command-line flags (highest priority)
  2. Environment variables
  3. Default values (lowest priority)