diff --git a/README.md b/README.md index 40b520fbf84d65173a1605e0cc812a98aa8c37ea..7142e3ff7370c012fe7c48d914efca2d35a278fa 100644 --- a/README.md +++ b/README.md @@ -46,59 +46,100 @@ TBD: * number of object files vs size -## Install -``` -git clone git@gitlab.flab.cesnet.cz:bodik/rwm.git /opt/rwm -cd /opt/rwm -make install -``` +## Usage + +Beside the WORM management features, `rwm` can also be used as simple wrapper to other S3 related +tools such as `aws` CLI, `rclone` and `restic`. + +It can be also used as simple backup manager for intended usecases. + -## Development +### Install ``` git clone git@gitlab.flab.cesnet.cz:bodik/rwm.git /opt/rwm cd /opt/rwm make install -make venv -. venv/bin/activate ``` -## simple copy: rclone with crypt overlay +### Simple copy: rclone with crypt overlay ``` cat > rwm.conf <<__EOF__ -RWM_S3_ENDPOINT_URL: "" -RWM_S3_ACCESS_KEY: "" -RWM_S3_SECRET_KEY: "" -RWM_RCLONE_CRYPT_BUCKET: "rwmcrypt" -RWM_RCLONE_CRYPT_PASSWORD: "" +rwm_s3_endpoint_url: "" +rwm_s3_access_key: "" +rwm_s3_secret_key: "" +rwm_rclone_crypt_bucket: "rwmcrypt" +rwm_rclone_crypt_password: "" __EOF__ + rwm rclone_crypt sync /data rwmbe:/ rwm rclone_crypt lsl rwmbe:/ ``` - -## restic: restic backup +### Restic: manual restic backup ``` cat > rwm.conf <<__EOF__ -RWM_S3_ENDPOINT_URL: "" -RWM_S3_ACCESS_KEY: "" -RWM_S3_SECRET_KEY: "" -RWM_RESTIC_BUCKET: "rwmrestic" -RWM_RESTIC_PASSWORD: "" +rwm_s3_endpoint_url: "" +rwm_s3_access_key: "" +rwm_s3_secret_key: "" +rwm_restic_bucket: "rwmrestic" +rwm_restic_password: "" __EOF__ + rwm restic init rwm restic backup /data rwm restic snapshots ``` +### RWM: simple backups + +``` +cat > rwm.conf <<__EOF__ +rwm_s3_endpoint_url: "" +rwm_s3_access_key: "" +rwm_s3_secret_key: "" + +rwm_restic_bucket: "rwmrestic" +rwm_restic_password: "" + +rwm_backups: + backup1: + filesdirs: + - /etc + - /data + excludes: + - *.cache + extras: + - --tag + - mytag1 + +rwm_retention: + keep-daily: "14" + keep-weekly: "20" +__EOF__ + +rwm backup_all +``` + + +## Notes + +#### Development +``` +git clone git@gitlab.flab.cesnet.cz:bodik/rwm.git /opt/rwm +cd /opt/rwm +make install +make venv +. venv/bin/activate +``` -### Notes ### Passing arguments Passthrough full arguments to underlyin tool with "--" (eg. `rwm rclone -- ls --help`). + ### rclone sync * https://rclone.org/commands/rclone_sync/ @@ -106,6 +147,7 @@ It is always the contents of the directory that is synced, not the directory its So when source:path is a directory, it's the contents of source:path that are copied, not the directory name and contents. See extended explanation in the copy command if unsure. + ### rclone crypt * corect, fails to download corrupted files diff --git a/rwm.conf.example b/rwm.conf.example index ea70cf93385792d5b45566b0dd5fe5159224336a..0931e9f266827932efda8fb283516873cde2c401 100644 --- a/rwm.conf.example +++ b/rwm.conf.example @@ -12,5 +12,5 @@ rwm_restic_bucket: "rwmcrypt" rwm_restic_password: "" # backup -rwm_backups: [] -rwm_retention: [] +rwm_backups: {} +rwm_retention: {} diff --git a/rwm.py b/rwm.py index 80cba591b178373760b2ee0414e685ae644ec39d..239826b1fb76ba3d65cbe8d615d1a8713a58d708 100755 --- a/rwm.py +++ b/rwm.py @@ -189,8 +189,8 @@ class RWM: excludes = [] for item in conf.get("excludes", []): excludes += ["--exclude", item] - backup_extras = conf.get("backup_extras", []) - cmd_args = ["backup"] + backup_extras + excludes + conf["filesdirs"] + extras = conf.get("extras", []) + cmd_args = ["backup"] + extras + excludes + conf["filesdirs"] return self.restic_cmd(cmd_args)