backup/backup

Too much files are produced when using multiple FTP with different keeps within the same model

cbou opened this issue · 5 comments

cbou commented

What went wrong?

I want to save the same backup in two different FTPs and each one should have different keep. Because it should be the same file I don't want to have the backup running twice so I just added two FTP blocks. One with keep = 2 and the other with keep = 6

The first FTP gets two backup, then next run only one backup, then next run again two backups and so on.
The second FTP does not delete any backup.

What steps did you follow?

Change the steps below to match the commands that you ran

  1. gem install backup --version 4.4.0
  2. backup check
  3. backup perform model
  4. Check the file that is produced by backup

How is your copy of backup configured?

Model.new(:model_daily_backup, '') do
	
	archive :model_archive do |archive|
		archive.add "/var/www/html"
	end

	compress_with Gzip

	store_with FTP do |server|
		server.ip = "ftp1.example.com"
		server.username = "username"
		server.password = "password"
		server.path = ""    
		server.keep = 2
	end

	store_with FTP do |server|
		server.ip = "ftp2.example.com"
		server.username = "username"
		server.password = "password"
		server.path = ""    
		server.keep = 6
	end

	store_with Local do |local|
		local.path = "/path/to/local"
		local.keep = 1
	end

end

Tell us about the computer that runs the backup gem

Change the information below to match the details of your computer

  • Operating system: Debian 9.1
  • Ruby version: 2.3.3

Hello @cbou - To be clear, does the "keep" feature work correctly if the second server is in a separate model?

@cbou - I am going to close this ticket. Please re-open it if you still have an issue.

cbou commented

Sorry for the late reply!

The issue is still there and is not reproducible with two separate models.
I guess this is because the yml files .data/model/FTP.yml does not care that the two ftp are different. It puts everything together. There should be two yml files actually.

Content of the yml file after the model runs once:

$ cat ../.data/model/FTP.yml 
---
- !ruby/object:Backup::Package
  trigger: model
  extension: tar
  chunk_suffixes: []
  no_cycle: false
  version: 5.0.0.beta.2
  time: 2018.07.12.16.49.32
- !ruby/object:Backup::Package
  trigger: model
  extension: tar
  chunk_suffixes: []
  no_cycle: false
  version: 5.0.0.beta.2
  time: 2018.07.12.16.49.32
cbou commented

Please @stuartellis reopen the issue.

cbou commented

There should be two yml files actually.

That's exactly how it works when you add a name to the store.
I should just read the doc more carefully.
http://backup.github.io/backup/v4/storages/ => Storage Identifiers

Model.new(:model_daily_backup, '') do
	
	archive :model_archive do |archive|
		archive.add "/var/www/html"
	end

	compress_with Gzip

	store_with FTP, :ftp2 do |server|
		server.ip = "ftp1.example.com"
		server.username = "username"
		server.password = "password"
		server.path = ""    
		server.keep = 2
	end

	store_with FTP, :ftp2 do |server|
		server.ip = "ftp2.example.com"
		server.username = "username"
		server.password = "password"
		server.path = ""    
		server.keep = 6
	end

	store_with Local do |local|
		local.path = "/path/to/local"
		local.keep = 1
	end

end