# All commands (syntax examples)

`backup`

```language-markup
vscli > backup -h
Usage:  backup

  Configure, schedule, and run backups

Options:
  -h, --help  Show this message and exit.

Commands:
  clear             Reset backup / restore configuration
  external-targets
  from-brain        Manage whether other brains can back up to this one
  run               Make a backup of the current machine state.
  schedule          Manage whether backups are run on a weekly schedule
```

`backup clear`

```language-markup
vscli > backup clear -h
Usage: backup clear

  Reset backup / restore configuration

Options:
  -h, --help  Show this message and exit.
```

`backup external-targets`

```language-markup
vscli > backup external-targets -h
Usage: backup external-targets

Options:
  -h, --help  Show this message and exit.

Commands:
  configure
  remove     Remove an external target
  rename     Rename an external target
  test       Test connection to each external target, sequentially
```

`backup external-targets configure`

```language-markup
vscli > backup external-targets configure -h
Usage: backup external-targets configure

Options:
  -h, --help  Show this message and exit.

Commands:
  s3        Configure an S3 bucket to upload backups to.
  scp       Configure an SCP server to upload backups to.
  sftp      Configure an SFTP server to upload backups to.
  to-brain  Add another brain to send backups to.
```

`backup external-targets configure s3`

```language-markup
vscli > backup external-targets configure s3 -h
Usage: backup external-targets configure s3 < --bucket-name bucket_name > [ --path path ] < --access-key-id access_key_id > [ --secret-access-key secret_access_key ] < --region region > [ --max-backups max_backups ] [ --name name ]

  Configure an S3 bucket to upload backups to.

  Ensure the target AWS account has a policy with at least the following permissions:
      Allow on s3:PutObject, s3:DeleteObject, s3:GetObject, s3:ListBucket, s3:GetBucketPolicy, iam:SimulatePrincipalPolicy

  Example:
      backup external-targets configure s3 --bucket-name test-bucket --access-key-id ACCESS_KEY --region us-east-1
      (will be prompted for secret access key)

Options:
  --bucket-name TEXT           An AWS S3 bucket to upload backups to
                               [required]
  --path TEXT                  Path to a folder which will store backup files
  --access-key-id TEXT         ID of AWS access key  [required]
  --secret-access-key TEXT     AWS secret access key
  --region TEXT                AWS region where the S3 bucket lives
                               [required]
  --max-backups INTEGER RANGE  Max backups to store on server before rotating
                               (deleting) old files. 0=unlimited (default).
                               [x>=0]
  --name TEXT                  The human-readable name for this target. If a
                               target with this name exists, it will be
                               replaced.
  -h, --help                   Show this message and exit.
```

`backup external-targets configure scp`

```language-markup
scli > backup external-targets configure scp -h
Usage: backup external-targets configure scp < --user user > < --server server > < --path path > [ --max-backups max_backups ] [ --name name ]

  Configure an SCP server to upload backups to. Uses public-key
  authentication.

  Ensure that this brain's public key is added to authorized_keys file on the target server:
      show backup public-key

  Example for ubuntu@192.168.12.34:/backups/folder:
      backup external-targets configure scp --user ubuntu --server 192.168.12.34 --path /backups/folder

Options:
  --user TEXT                  SCP server username  [required]
  --server TEXT                An SCP server hostname or IP address
                               [required]
  --path TEXT                  Path to a folder which will store backup files
                               [required]
  --max-backups INTEGER RANGE  Max backups to store on server before rotating
                               (deleting) old files. 0=unlimited (default).
                               [x>=0]
  --name TEXT                  The human-readable name for this target. If a
                               target with this name exists, it will be
                               replaced.
  -h, --help                   Show this message and exit.
```

`backup external-targets configure sftp`

```language-markup
vscli > backup external-targets configure sftp -h
Usage: backup external-targets configure sftp < --user user > < --server server > < --path path > [ --use-password ] [ --max-backups max_backups ] [ --name name ]

  Configure an SFTP server to upload backups to. Uses public key
  authentication, or password-based authentication if `--use-password` is
  provided.

  For public key authentication, ensure that this brain's key is added to the ~/.ssh/authorized_keys file on the target server:
      show backup public-key
  Additionally, ensure that ~/.ssh has 700 permissions, and ~/.ssh/authorized_keys has 600 permissions.

  Examples for ubuntu@192.168.12.34:/backups/folder:
      Public key authentication:
          backup external-targets configure sftp --user ubuntu --server 192.168.12.34 --path /backups/folder
      Password authentication:
          backup external-targets configure sftp --user ubuntu --server 192.168.12.34 --path /backups/folder --use-password
          (will be prompted for a password)

Options:
  --user TEXT                  SFTP server username  [required]
  --server TEXT                An SFTP server hostname or IP address
                               [required]
  --path TEXT                  Path to a folder which will store backup files
                               [required]
  --use-password               Use an SFTP password instead of key-based
                               authentication
  --max-backups INTEGER RANGE  Max backups to store on server before rotating
                               (deleting) old files. 0=unlimited (default).
                               [x>=0]
  --name TEXT                  The human-readable name for this target. If a
                               target with this name exists, it will be
                               replaced.
  -h, --help                   Show this message and exit.
```

`backup external-targets configure to-brain`

```language-markup
vscli > backup external-targets configure to-brain -h
Usage: backup external-targets configure to-brain < --target-brain target_brain > < --token token > [ --name name ]

  Add another brain to send backups to.

  Provide the brain's hostname / IP, as well as the token. Obtain the token by running the following from the target brain:
      show backup from-brain token

  Then, from this brain:
      backup external-targets configure to-brain --target-brain <OTHER_BRAIN_IP_OR_HOST> --token <TOKEN_HERE>

Options:
  --target-brain TEXT  Hostname / IP of brain which will receive backups
                       [required]
  --token TEXT         Target brain's token  [required]
  --name TEXT          The human-readable name for this target. If a target
                       with this name exists, it will be replaced.
  -h, --help           Show this message and exit.
```

`backup external-targets remove`

```language-markup
vscli > backup external-targets remove -h
Usage: backup external-targets remove < --name name >

  Remove an external target

Options:
  --name TEXT  Which external target to delete  [required]
  -h, --help   Show this message and exit.
```

`backup external-targets rename`

```language-markup
vscli > backup external-targets rename -h
Usage: backup external-targets rename < --from from_name > < --to to_name >

  Rename an external target

Options:
  --from TEXT  Original name  [required]
  --to TEXT    New name  [required]
  -h, --help   Show this message and exit.
```

`backup external-targets test`

```language-markup
vscli > backup external-targets test -h
Usage: backup external-targets test

  Test connection to each external target, sequentially

Options:
  -h, --help  Show this message and exit.
vscli > backup external-targets test -h
Usage: backup external-targets test

  Test connection to each external target, sequentially

Options:
  -h, --help  Show this message and exit.
```

`backup from-brain`

```language-markup
vscli > backup from-brain -h
Usage: backup from-brain

  Manage whether other brains can back up to this one

Options:
  -h, --help  Show this message and exit.

Commands:
  allow-list     Update the allow-list of brains to accept backups from
  refresh-token  Invalidate the old brain-to-brain token and generate a...
```

`backup from-brain allow-list`

```language-markup
vscli > backup from-brain allow-list -h
Usage: backup from-brain allow-list [ hosts ] [ --all-hosts ]

  Update the allow-list of brains to accept backups from

Options:
  --all-hosts  Accept backups from any host
  -h, --help   Show this message and exit.
```

`backup from-brain refresh-token`

```language-markup
vscli > backup from-brain refresh-token -h
Usage: backup from-brain refresh-token

  Invalidate the old brain-to-brain token and generate a new one

Options:
  -h, --help  Show this message and exit.
```

`backup run`

```language-markup
Usage: backup run [ --local-only ]

  Make a backup of the current machine state. Sync to all external targets
  sequentially, unless --local-only is provided.

Options:
  --local-only  Run a backup without uploading to any configured external
                targets
  -h, --help    Show this message and exit.
```

`backup schedule`

```language-markup
vscli > backup schedule -h
Usage: backup schedule

  Manage whether backups are run on a weekly schedule

Options:
  -h, --help  Show this message and exit.

Commands:
  disable  Disable scheduled backups
  enable   Run backups automatically on a weekly schedule
```

`backup schedule disable`

```language-markup
vscli > backup schedule disable -h
Usage: backup schedule disable

  Disable scheduled backups

Options:
  -h, --help  Show this message and exit.
```

`backup schedule enable`

```language-markup
vscli > backup schedule enable -h
Usage: backup schedule enable [ --weekday ( monday | tuesday | wednesday | thursday | friday | saturday | sunday ) ] [ --hour hour ] [ --enable-external-upload ]

  Run backups automatically on a weekly schedule

Options:
  --weekday [monday|tuesday|wednesday|thursday|friday|saturday|sunday]
                                  Weekday to run backups on
  --hour INTEGER RANGE            Hour to run backups (0-23)  [0<=x<=23]
  --enable-external-upload / --disable-external-upload
  -h, --help                      Show this message and exit.
```

`restore`

```language-markup
vscli > restore -h
Usage:  restore

  Restore from a backup

Options:
  -h, --help  Show this message and exit.

Commands:
  delete-version  Delete backups that were taken for software version...
  list            List backups available on the local machine, as well as...
  run
```

`restore delete-version`

```language-markup
vscli > restore delete-version -h
Usage: restore delete-version < version > [ --local-only ]

  Delete backups that were taken for software version VERSION on this machine
  and any external targets.

  For VERSION, specify major and minor version ('X.X' format), or 'all' for
  any version.

  Examples:
      Delete version 8.3 on external targets, and local machine:
          restore delete-version 8.3
      Delete version 8.3 only on the local machine
          restore delete-version 8.3 --local-only

Options:
  --local-only  Only delete backups on the local machine, not external targets
  -h, --help    Show this message and exit.
```

`restore list`

```language-markup
vscli > restore list -h
Usage: restore list

  List backups available on the local machine, as well as on any configured
  external targets

Options:
  -h, --help  Show this message and exit.
```

`restore run`

```language-markup
vscli > restore run -h
Usage: restore run

Options:
  -h, --help  Show this message and exit.

Commands:
  from-external-target  Restore all data from the most recent backup file...
  from-local            Restore all data from the most recent backup file...
  from-url              Restore all data from a backup file via a URL to...
```

`restore run from-external-target`

```language-markup
vscli > restore run from-external-target -h
Usage: restore run from-external-target < target-name target_name > [ --filename filename ] [ --replace ] [ --preserve-saml ] [ --preserve-ui-certs ]

  Restore all data from the most recent backup file on external target
  TARGET_NAME.

  Choose a custom backup with `--filename FILENAME`. See available files via
  `restore list`.

  Examples:
      Restore from most recent backup
          restore run from-external-target scp-1
      Restore from specific file
          restore run from-external-target scp-1 --filename migration-1234.tar.gz.gpg

Options:
  --filename TEXT      Optional backup filename. If not supplied, the most
                       recent backup will be used.
  --replace            This brain is replacing the brain whose backup it was
                       taken from
  --preserve-saml      Keep the SAML configuration that was present on this
                       brain prior to the restore
  --preserve-ui-certs  Keep the UI certificates that were present on this
                       brain prior to the restore
  -h, --help           Show this message and exit.
```

`restore run from-local`

```language-markup
vscli > restore run from-local -h
Usage: restore run from-local [ --filename filename ] [ --replace ] [ --preserve-saml ] [ --preserve-ui-certs ]

  Restore all data from the most recent backup file on the local machine.

  Choose a custom backup with `--filename FILENAME`. See available files via
  `restore list`.

  Examples:
      Restore from most recent backup
          restore run from-local
      Restore from specific file
          restore run from-local --filename migration-1234.tar.gz.gpg

Options:
  --filename TEXT      Optional backup filename. If not supplied, the most
                       recent backup file will be used.
  --replace            This brain is replacing the brain whose backup it was
                       taken from
  --preserve-saml      Keep the SAML configuration that was present on this
                       brain prior to the restore
  --preserve-ui-certs  Keep the UI certificates that were present on this
                       brain prior to the restore
  -h, --help           Show this message and exit.
```

`restore run from-url`

```language-markup
vscli > restore run from-url -h
Usage: restore run from-url < url > [ --no-check-https-certificate ] [ --replace ] [ --preserve-saml ] [ --preserve-ui-certs ]

  Restore all data from a backup file via a URL to the file.

  URL should point to a valid backup file. Supported protocols are HTTP,
  HTTPS, SFTP, and SCP.

  Examples:
      restore run from-url https://your-server.com/migration-1234.tar.gz.gpg
      restore run from-url https://your-server.com/migration-1234.tar.gz.gpg --no-check-https-certificate
      restore run from-url sftp://ubuntu@192.168.12.34:/path/to/backup/migration-1234.tar.gz.gpg
      restore run from-url scp://ubuntu@192.168.12.34:/path/to/backup/migration-1234.tar.gz.gpg

Options:
  --no-check-https-certificate  Don't check the https server certificate
  --replace                     This brain is replacing the brain whose backup
                                it was taken from
  --preserve-saml               Keep the SAML configuration that was present
                                on this brain prior to the restore
  --preserve-ui-certs           Keep the UI certificates that were present on
                                this brain prior to the restore
  -h, --help                    Show this message and exit.
```

`show backup`

```language-markup
vscli > show backup -h
Usage: show backup

  Show backup configuration information

Options:
  -h, --help  Show this message and exit.

Commands:
  download-link     Get the download link for an existing backup.
  events            Display any important events that have happened while...
  external-targets  Display which external targets are available to...
  from-brain        Show data relating to brain-to-brain backups...
  public-key        Display the public key for this brain, used for SCP...
  schedule          Display the schedule on which this brain will...
  summary           Display a summary of Backup / Restore configuration
```

`show backup download-link`

```language-markup
vscli > show backup download-link -h
Usage: show backup download-link [ --filename filename ]

  Get the download link for an existing backup. If `--filename` is not
  specified, the most recent local backup will be used.

Options:
  --filename TEXT  Backup filename from `restore list`
  -h, --help       Show this message and exit.
```

`show backup events`

```language-markup
vscli > show backup events -h
Usage: show backup events

  Display any important events that have happened while running backups or
  syncing to external targets

Options:
  -h, --help  Show this message and exit.
```

`show backup external-targets`

```language-markup
vscli > show backup external-targets -h
Usage: show backup external-targets

  Display which external targets are available to upload backups to

Options:
  -h, --help  Show this message and exit.
```

`show backup from-brain`

```language-markup
vscli > show backup from-brain -h
Usage: show backup from-brain

  Show data relating to brain-to-brain backups targeting this brain

Options:
  -h, --help  Show this message and exit.

Commands:
  allow-list  Display the allow-list of brains that this brain will...
  token       Show this brain's token, to use for brain-to-brain backups
```

`show backup from-brain allow-list`

```language-markup
vscli > show backup from-brain allow-list -h
Usage: show backup from-brain allow-list

  Display the allow-list of brains that this brain will accept brain-to-brain
  backups from

Options:
  -h, --help  Show this message and exit.
```

`show backup from-brain token`

```language-markup
vscli > show backup from-brain token -h
Usage: show backup from-brain token

  Show this brain's token, to use for brain-to-brain backups

Options:
  -h, --help  Show this message and exit.
```

`show backup public-key`

```language-markup
vscli > show backup public-key -h
Usage: show backup public-key

  Display the public key for this brain, used for SCP or SFTP external target
  server authentication

Options:
  -h, --help  Show this message and exit.
```

`show backup schedule`

```language-markup
vscli > show backup schedule -h
Usage: show backup schedule

  Display the schedule on which this brain will automatically run backups

Options:
  -h, --help  Show this message and exit.
```

`show backup summary`

```language-markup
vscli > show backup summary -h
Usage: show backup summary

  Display a summary of Backup / Restore configuration

Options:
  -h, --help  Show this message and exit.
```
