File backup configuration

Customize the files backup and restore to and from a backend storage.

Properties

To control all aspects of the file backup behavior.

PropertyTypeDefaultDescription
featureIdstringBackupAndRestoreFeature unique identifier in the scope of the edge digital twin
typestringfileType of the files that are backed up by this feature
contextstringedgeContext of the files backed up by this feature, unique in the scope of the type
dirstringDirectory to be backed up
modestringstrictRestriction on directories that can be dynamically selected for a backup, the supported modes are: strict, lax and scoped
backupCmdstringCommand to be executed before the backup is done
restoreCmdstringCommand to be executed after the restore
singleUploadboolfalseForbid triggering of new backups when there is a backup in progress
checksumboolfalseSend MD5 checksum for backed up files to ensure data integrity
stopTimeoutstring30sTime to wait for running backups to finish as a sequence of decimal numbers, each with optional fraction and a unit suffix, such as: 300ms, 1.5h, 10m30s, etc., time units are: ns, us (or µs), ms, s, m, h
keepUploadedboolfalseKeep successfully uploaded backups locally
storagestring./storageDirectory where backups and downloads will be stored
Upload/Download - TLS
serverCertstringPEM encoded certificate file for secure uploads and downloads
Auto backup
activeboolfalseActivate periodic backups
activeFromstringTime from which periodic backups should be active, in RFC 3339 format, if omitted (and active flag is set) current time will be used as start of the periodic backups
activeTillstringTime till which periodic backups should be active, in RFC 3339 format, if omitted (and active flag is set) periodic backups will be active indefinitely
periodstring10hBackup period as a sequence of decimal numbers, each with optional fraction and a unit suffix, such as: 300ms, 1.5h, 10m30s, etc., time units are: ns, us (or µs), ms, s, m, h
Local connectivity
brokerstringtcp://localhost:1883Address of the MQTT server/broker that the file backup will connect for the local communication, the format is: scheme://host:port
usernamestringUsername that is a part of the credentials
passwordstringPassword that is a part of the credentials
Local connectivity - TLS
caCertstringPEM encoded CA certificates file
certstringPEM encoded certificate file to authenticate to the MQTT server/broker
keystringPEM encoded unencrypted private key file to authenticate to the MQTT server/broker
Logging
logFilestringlog/file-backup.logPath to the file where log messages are written
logLevelstringINFOAll log messages at this or a higher level will be logged, the log levels in descending order are: ERROR, WARN, INFO, DEBUG and TRACE
logFileCountint5Log file maximum rotations count
logFileMaxAgeint28Log file rotations maximum age in days, use 0 to not remove old log files
logFileSizeint2Log file size in MB before it gets rotated

Example

The minimal required configuration that enables backing up a directory and sets the file type to config.

{
    "type": "config",
    "dir": "/var/tmp/file-backup",
    "mode": "scoped",
    "storage": "/var/lib/file-backup",
    "logFile": "/var/log/file-backup/file-backup.log"
}

Template

The configuration can be further adjusted according to the use case. The following template illustrates all possible properties with their default values.

{
  "featureId": "BackupAndRestore",
  "type": "file",
  "context": "edge",
  "dir": "",
  "mode": "strict",
  "backupCmd": "",
  "restoreCmd": "",
  "singleUpload": false,
  "checksum": false,
  "stopTimeout": "30s",
  "keepUploaded": false,
  "storage": "./storage",
  "serverCert": "",
  "active": false,
  "activeFrom": "",
  "activeTill": "",
  "period": "10h",
  "broker": "tcp://localhost:1883",
  "username": "",
  "password": "",
  "caCert": "",
  "cert": "",
  "key": "",
  "logFile": "log/file-backup.log",
  "logLevel": "INFO",
  "logFileCount": 5,
  "logFileMaxAge": 28,
  "logFileSize": 2
}
Last modified September 27, 2022