Skip to content
Brian D. Burns edited this page Oct 28, 2013 · 4 revisions

Storage Cycling

Each Storage (except for RSync) supports the keep setting, which specifies how many backups to keep at this location.

store_with SFTP do |sftp|
  sftp.keep = 5
end

Once the keep limit has been reached, the oldest backup will be removed.

Note that if keep is set to 5, then the 6th backup will be transferred and stored, before the oldest is removed.

Storage Identifiers

Each storage supports the ability to specify a storage_id to uniquely identify a specific storage defined on a model. This allows you to use multiple storages of the same type within a single model, with each tracking it's own cycling data.

For example, to store your backup to 2 different servers using SFTP, you could do:

Model.new(:my_backup, 'My Backup') do

  archive :my_archive do |archive|
    # archive some stuff...
  end

  store_with SFTP, :server_01 do |sftp|
    sftp.username = 'my_username'
    sftp.password = 'my_password'
    sftp.ip       = 'server1.domain.com'
    sftp.port     = 22
    sftp.path     = '~/backups/'
    sftp.keep     = 10
  end

  store_with SFTP, :server_02 do |sftp|
    sftp.username = 'my_username'
    sftp.password = 'my_password'
    sftp.ip       = 'server2.domain.com'
    sftp.port     = 22
    sftp.path     = '~/backups/'
    sftp.keep     = 5
  end

end

:server_01 will keep/cycle the last 10 backups, and :server_02 the last 5. So you always have your last 5 backups stored at 2 different locations.

What this does is store 2 different YAML cycling data files.

Instead of storing this data in <data_path>/my_backup/SFTP.yml, as it would if no string identifier is used, it stores each location's data separately in <data_path>/my_backup/SFTP-server_01.yml and <data_path>/my_backup/SFTP-server_02.yml.

Clone this wiki locally