Dockerized Ruby Backup Gem
If you are coming from Ruby, backup is a popular ruby gem which can be used to backup the database. Unfortunately it is maintenance only but it works flawlessly with current features. Since, it is not compatible with latest ruby, it makes sense to make a docker image of it.
I am assuming that you have configured the models inside models folder where you are right now. Then you can perform a trigger like this. Config can be an empty ruby file if you have everything mentioned in your model.
docker run --rm -v $(pwd):/usr/src/app --user $(id -u):$(id -g) varunbatrait/backup:latest perform -t database_name --config-file config.rb --root-path .
As usual, you can use alias and invoke it with just backup by using following:
alias backup='docker run --rm -it -v $(pwd):/usr/src/app --user $(id -u):$(id -g) varunbatrait/backup:latest'
Provided you have added above alias to your .zshrc or .bashrc, You can generate a model – you can generate using:
backup generate:model --trigger=demo --config-file config.rb
This will generate model file demo.rb under models/demo.rb
# encoding: utf-8 ## # Backup Generated: demo # Once configured, you can run the backup with the following command: # # $ backup perform -t demo [-c <path_to_configuration_file>] # # For more information about Backup's components, see the documentation at: # http://backup.github.io/backup # Model.new(:demo, 'Description for demo') do end
For information related to usage of backup. Please visit official documentation