For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create payloads (fylr backup)

This page describes the process of creating a local backup of JSON payloads from a source instance

The fylr backup command performs GET requests to the API of the source instance, until all relevant base types and records are retrieved and stored in local files.

A basic backup command looks like this:

fylr backup \
  --server '<source-url>/api/v1/' \
  --login 'root' \
  --password '<cleartext>' \
  --dir '<instance folder>/' \
  --compression 9 \
  --purge

--server, --login and --password refer to the source server.

Parameters

This is a complete overview of the command line parameters (run fylr backup -h):

--dir

Target folder for the backup files. If it does not exist, it will be created. If it exists, and --purge is used, an existing folder is deleted and created new.

  • this parameter is mandatory!

  • type: string

--server

API Url of the source instance. The Url must include the API base endpoint, for fylr this is <source url>/api/v1.

  • this parameter is mandatory!

  • type: string

--login

Username of the user in the source instance. It should be a user with root rights or sufficient read rights.

  • this parameter is mandatory!

  • type: string

--password

Password of the user in the source instance.

  • this parameter is mandatory!

  • type: string

--purge

Defines the mode of the backup (purge or continue).

If this is true, the complete backup starts from the beginning, and an existing backup folder with the same name is purged.

  • type: bool

  • default: false

--continue

Defines the mode of the backup (purge or continue).

If this is true, the backup continues from the last point in the manifest.json file, if a previous backup run was interrupted.

  • type: bool

  • default: false

--chunk-size

The requested size for objects from the source instance. Can be used to control the size of the responses. It can be lowered if the requests cause timeouts or network problems.

  • type: int

  • minimum: 1

  • maximum: 1000

  • default: 100

--max-count

Set this to a number bigger than 0 to limit the number of objects of each objecttype. This can be used to test or debug, and can be combined with --include to only backup a small sample of the source instance.

  • type: int

  • minimum: 0

  • default: 0

--max-parallel

Maximum numbers of parallel workers.

0 uses the number of available CPUs.

Defaults to 1 (only one parallel process).

  • type: int

  • minimum: 0

  • default: 1

--compression

GZIP compression level.

If 0 is selected, there is no compression and the payloads are stored as .json files. If a value bigger than 0 is selected, the payloads are stored as compressed .json.gz files.

  • type: int

  • minimum: 0

  • maximum: 9

  • default: 0

--all-versions

Set to true so that all history versions of the records are requested.

  • type: bool

  • default: false

--include

If this is a valid non empty regex string, only objecttypes are backupped where the internal objecttype name matches the regex.

  • type: string

--include-deleted

This parameter is available in fylr from version 6.33.0.

By default, linked objects that are soft-deleted (their latest version carries _latest_version_deleted_at) are skipped from the backup. Set this parameter to true to include them as top-level entries in the payload, in their soft-deleted state.

Links pointing at a soft-deleted target are always written to the backup as a lookup:_id wrapper carrying _latest_version_deleted_at next to _system_object_id and _allow_defer.

For a faithful round-trip (soft-deleted targets restored as they are, with their incoming links intact) use this together with fylr restore --include-deleted-linked. If the backup was done without --include-deleted and restored with --include-deleted-linked, the wrappers are kept but their lookups defer, so the links are stored as _purged_or_deferred.

Use this paired with the fylr restore parameter --include-deleted-linked

  • type: bool

  • default: false

--include-files

This parameter is available in fylr from version 6.34.0.

By default a backup only stores the file URLs, and the restore fetches the bytes from the source instance (which therefore has to stay reachable until the restore finishes). Set --include-files to pack the file bytes into the backup itself, under a files/ directory, so the restore uploads them from the local backup and no longer depends on the source instance. It takes a mode:

  • empty (default): store only the file URLs (the behaviour described above).

  • original: pack each file's original bytes, but not its renditions (preview versions). On restore the target regenerates the renditions itself, so an --include-files=original backup cannot be restored with --upload-versions — that option uploads the source's renditions, but they are not in the backup and the source may be gone, so the restore rejects the combination.

  • with-versions: pack the originals and their renditions, so that a restore with --upload-versions uploads the renditions from the backup byte-identical instead of regenerating them. Without --upload-versions the target still regenerates them (exactly as for a URL-only backup) — the flag stays explicit. This is the basis for a fully self-contained, byte-for-byte backup.

Files stored leave on remote are never packed: the backup keeps their real upstream URL (it requests files_real_url=1 on the /db list, which needs the root system right), and the restore re-creates them as references to that upstream. Their renditions are ordinary local files, so with with-versions a leave original's renditions are packed and uploaded from the backup too.

The backup form under /inspect/migration offers this as an Include Files selector, and its backup viewer browses the nested files/ directories.

  • type: string (one of "", original, with-versions)

  • default: ""

--include-events

Comma separated list of event types.

Use --include-events=- to skip backup of events.

If this parameter is unset, all events are backupped

  • type: string

  • default: ""

--retry-max-count

If a request fails with one of the following HTTP status codes that indicate network problems, the request is repeated for a maximum number of times: 502: Bad Gateway, 503: Service Unavailable, 504: Gateway Timeout

  • type: int

  • default: 10

--retry-sleep-between

Defines the waiting time in seconds between repeated failed requests.

  • type: int

  • default: 30

--client-id

If the source instance uses OAuth2 for user authentication, this is the configured Client ID.

  • type: string

--client-secret

If the source instance uses OAuth2 for user authentication, this is the configured Client Secret. Can be kept empty if the instance is public.

  • type: string

--client-token-url

If the source instance uses OAuth2 for user authentication, this is the OAuth2 callback endpoint of the instance. For fylr this is <source url>/api/oauth2/token.

  • type: string

--insecure

Set to true to skip the certificate check for the connection to the source instance.

  • type: bool

  • default: false

--verbose

Set to true to log debugging info.

  • type: bool

  • default: false

--log-network

Set to true to log the requests and responses.

  • type: bool

  • default: false

--log

If this is a valid file path, the log output is written to this file. If this is empty (default), the log output is written to stdout instead.

  • type: string

--pretty

Set to true to save the data in a prettified JSON.

  • type: bool

  • default: false

Last updated