Rcloner
README in progress. Project is on the early stage, use it at your own risk.
Simple wrapper for Duplicity (with optional Rclone backend) which allows to sync/restore your application files/database from a remote storage. All files stored on a remote storage are encrypted and backups are incremental, thanks to Duplicity.
Example config (rcloner.yml)
origin: /home/deploy/myapp
destination: webdavs://login:pass@webdav.yandex.ru/myapp_backup
include:
- 'public/images'
- 'config/master.key'
- '.env'
- 'tmp/db.dump'
on_backup:
before: 'postgressor dumpdb tmp/db.dump'
after: 'rm tmp/db.dump'Where:
-
originis the root folder path if your application. If not provided - current directory will be taken. Can be also provided asRCLONER_ORIGINenv variable. -
destination- remote path in dyplicity format. Can be also provided as env variableRCLONER_DESTINATION. -
includeif provided - only this paths will be taken for backup, not the wholeorigin. Urls should be provided in relative paths tooriginfolder. -
on_backup(before/after) custom optional commands/scripts to execute before/after backup. Commands will be executed intoorigindirectory.
Note that rcloner by default loads env variables from .env file (if exists) in current category.
Installation
1) Install rclone:
$ curl https://rclone.org/install.sh | sudo bash2) Install duplicity, minimal supported version is 0.8.09. If you're using Ubuntu, the most simple way to install latest version is via snap:
$ sudo snap install duplicity --classic3) Install gem rcloner:
$ gem install rclonerOr you can install gem directly from github using specific_install:
$ gem install specific_install
$ gem specific_install https://github.com/vifreefly/rclonerAnother option is to add gem to your application Gemfile:
gem 'rcloner', git: 'https://github.com/vifreefly/rcloner', require: falseUsage
Readme in progress...
backup
To sync all items from local to remote rclone storage use backup command:
deploy@server:~/my_app$ rcloner backup --config rcloner.yml
restore
To sync all items from remote rclone storage to local server use restore command:
deploy@server:~/my_app$ rcloner restore --config rcloner.yml
How to run backup with a cron
Use Whenewer gem.
Notes
- Rclone/duplicity integration https://github.com/GilGalaad/duplicity-rclone
License
The gem is available as open source under the terms of the MIT License.