Package: restictool
Usagerestictoolis a Python wrapper to the dockerizedresticbackup tool.The tool allows to backup docker volumes and local directories, to restore
a snapshot to a local directory, to run arbitrary restic commands and
just to check the configuration file.restictool -h|--help
restictool COMMAND [-h|--help]
restictool [TOOL_ARGS...] COMMAND [COMMAND_ARGS...] [--] [...]The rest of the arguments is passed to the restic command. In case the
such argument is a one recognized by the command as well,
use--as a separator. Any unrecognized argument starting with
the dash is also passed to the restic command, check this if you are
getting weird errors.As seen from theresticthe snapshots created with the backup commands are/volume/VOLNAMEfor docker volumes and/localdir/TAGfor locally
specified ones. This needs to be considered when specifying inclusion
or exclusion filters for both backup and restore. If for example/a/bis being backed up asmy_dir, the original
filea/b/c/dis seen as/localdir/my_dir/c/d.The container runningresticgets arestictool.localadded to the hosts
pointing to the gateway of the first config in the default bridge network. You
can use this for tunneled setups.Common arguments-h,--helpshow the help message and exit. If COMMAND is present, shows the help
for the command-cFILE,--configFILEthe configuration file (default:~/.config/restic/restictool.yml)--cacheDIRthe cache directory (default:~/.cache/restic)--imageIMAGEthe docker restic image name (default:restic/restic)--force-pullforce pulling of the docker image first--log-levellog level for the tool (critical,error,warning,info,debug, default:warning). This applies to the tool itself;
messages from the restic are written to the standard output directly
and can be silenced by-qpassed to either for this tool or
the restic command-q,--quietPass the-qoption to the restic commandCOMMANDone ofbackup,restore,snapshots,run,dockerdr,existsorcheckRestore arguments-rDIR,--restoreDIRdirectory to restore to. This argument is mandatory.SNAPSHOTsnapshot to restore fromThe snapshot to restore from is taken from the next argument; if not present
it defaults tolatest. A common way to restore is--path/localdir/my_namefinding the latest snapshot containing the specified local directory.The directory will be created if it does not exist. Note that as
the restored files are written from inside the docker container they will
be written from the context of the root user. Watch for mishaps.Docker disaster recovery argumentsThe docker disaster recovery restores all the volumes existing both on the
local system and the backup to the latest snapshot. The list of the
volumes in the configuration is ignored, as are volume-specific options.The data are restored to a directory derived from the mountpoint of the volume,
meaning that if the volume resides on/var/lib/docker/volumes/foo/_datait will be restored to/var/lib/docker/volumes/foo/_data.restored.Snapshots argumentsAny argument is passed to therestic snapshotsdirectly.--latest1is a common one.Run argumentsAny argument is passed to theresticdirectly.Configuration fileTherestictoolneeds a configuration file
(default~/.config/restic/restictool.yml) to specify the restic
repository configuration. As the file contains secrets such as
the repository password, take care to set reasonable permissions.
The file is in theYAMLformat.Repository configurationrepository:location:"s3:https://somewhere:8010/restic-backups"password:"MySecretPassword"host:myhostnetwork_from:myvpncontainerauthentication:AWS_ACCESS_KEY_ID:"S3:SomeKeyId"AWS_SECRET_ACCESS_KEY:"someSecret"extra:RESTIC_PACK_SIZE:"64"locationandpasswordare mandatory. All other fields are optional.passwordspecifies theresticrepository password. Fetching
the repository location or password from a file or command is not
supported.hostdefaults to the hostname of the machine therestictoolis
executed on. It only applies tobackup.The optionalnetwork_fromspecifies the name of the container to reuse
the network stack from. This allows using VPN tunnels or other non-standard
networking. The container has to be already started.authenticationcontainsresticenvironment variables used to
authenticate against the target repository. Typical ones areAWS_ACCESS_KEY_IDorAWS_SECRET_ACCESS_KEY.extracontains
other variables such asRESTIC_COMPRESSION. This is only an
logical division and both sets of variables will be merged.The variable names will be converted to uppercase and the values passed 1:1.
Some variables cannot be defined (for exampleRESTIC_CACHE_DIRorRESTIC_PASSWORD).Logging configurationIf the default of logging to the standard error is not suitable, the logging
configuration can be provided via theloggingkey. The content has to conform
to thePython logging facility dictionary schema.
If provided, the--log-levelcommand-line option is used to set the level
for the logger namedconsole, if there is any.The following extra arguments can be used in the formatters:operation,repoLocation,repoHost,object,elapsedmeaning the performed operation, repository location and name,
the object being backed up and the time the operation took. All are strings or None except
the elapsed time that is in seconds as float.CAUTION: TheDEBUGlevel logs sensitive information such as secret keys and passwords.logging:version:1root:handlers:-console-file-sysloglevel:INFOhandlers:console:class:logging.StreamHandlerlevel:INFOformatter:detailedstream:ext://sys.stderrfile:class:logging.handlers.RotatingFileHandlerlevel:INFOformatter:detailedfilename:/tmp/restictool.logmaxBytes:65536backupCount:3syslog:class:logging.handlers.SysLogHandlerlevel:INFOaddress:!!python/tuple["my.syslog.lan",514]facility:daemonformatter:syslogformatters:detailed:format:'%(asctime)s%(levelname)sop=%(operation)srepo=%(repoLocation)shost=%(repoHost)sobject=%(object)stime=%(elapsed).1fsmsg=%(message)s'datefmt:'%Y-%m-%d%H:%M:%S'syslog:format:'restictool[%(process)d]%(levelname)sop=%(operation)srepo=%(repoLocation)shost=%(repoHost)sobject=%(object)stime=%(elapsed).1fsmsg=%(message)s'Command-line options for resticoptions:common:-"--insecure-tls"forget:-...prune:-...volume:-...localdir:-...This section specifies the command-line options to be used when
executing therestic.commonones are used for any run,volumeones are added to common ones when backing up a docker
volume andlocaldirones when backing up a local directory.
Therunandrestorecommands get just thecommonones.Ifforgetis present arestic forgetis run after the
backup is completed with these arguments. If'DEFAULT'is specified for forget it is expanded to--keep-daily7--keep-weekly5--keep-monthly12.Ifpruneis specified, arestic pruneis run following
theforget, with the specified arguments (there can also be none).
Note that this can be costly on a cloud storage charging for API calls
and downloads.Volume backup specificationvolumes:-name:my_volumeoptions:-'--exclude="/volume/my_volume/some_dir"'-"--exclude-caches"volumesis a list of the docker volumes to backup when running
thebackupcommand. If the name is'*'', all non-anonymous
(not 48+ hex characters) volumes are backed up.optionswill be used when backing up the specified volume. If there is
both*and a specific name, the options will come from the
specific one and if not found, from the wildcard one.Local directory backup specificationlocaldirs:-name:my_tagpath:pathoptions:-'--exclude="/localdir/my_tag/some_dir"'localdirsis a list of the local directories to backup when running
thebackupcommand.namespecifies the tag that will be used
to distinguish the directories in the repository.optionswill be used when backing up the specified local directory. Tildes (~)
at the beginning ofpathwill be expanded to the contents
of theHOMEenvironment variable.