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.
--purge deletes a backup in --dir in case there is already one. All existing files in this directory are deleted!
By default the backup over the API only stores the data in local files; the files themselves are only referenced by URL and are loaded from the source instance during the restore, so until the restore is finished the source instance still needs to be reachable.
Use --include-files to pack the file bytes into the backup instead, making it self-contained.
Not all events will be migrated from easydb5 to fylr, because they have no purpose in fylr. Also, some events need to be changed.
For a complete overview, see below
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.
The parameters --purge and --continue are mutually exclusive. Not both can be true.
If the target folder already exists, this parameter (or --continue) must be set, otherwise the backup will fail.
type:
booldefault:
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.
The parameters --purge and --continue are mutually exclusive. Not both can be true.
If the target folder already exists, this parameter (or --purge) must be set, otherwise the backup will fail.
type:
booldefault:
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:
intminimum:
1maximum:
1000default:
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:
intminimum:
0default:
0
--max-parallel
Maximum numbers of parallel workers.
This creates more load on the source system.
type:
intminimum:
0default:
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:
intminimum:
0maximum:
9default:
0
--all-versions
Set to true so that all history versions of the records are requested.
Not to be confused with asset versions (see parameters for fylr restore)!
type:
booldefault:
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
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.
type:
booldefault:
false
--include-files
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=originalbackup 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-versionsuploads the renditions from the backup byte-identical instead of regenerating them. Without--upload-versionsthe 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.
Specific event types, which are irrelevant for the migration, are never in the backup, even if they are specifically requested.
For now, this includes OBJECT_INDEX, SESSION_INVALID, FRONTEND_ERROR and COLLECTION_OWNER_RIGHTS_ERROR, but this might be extended in the future.
type:
stringdefault:
""
--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:
intdefault:
10
--retry-sleep-between
Defines the waiting time in seconds between repeated failed requests.
type:
intdefault:
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.
Only use this option if you can trust the remote server!
type:
booldefault:
false
--verbose
Set to true to log debugging info.
type:
booldefault:
false
--log-network
Set to true to log the requests and responses.
type:
booldefault:
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:
booldefault:
false
Last updated