Class: DockerComposeDeploy::Actions::Backup

Inherits:
Struct
  • Object
show all
Defined in:
lib/docker_compose_deploy/actions/backup.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#shellObject

Returns the value of attribute shell

Returns:

  • (Object)

    the current value of shell



3
4
5
# File 'lib/docker_compose_deploy/actions/backup.rb', line 3

def shell
  @shell
end

Instance Method Details

#saveObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/docker_compose_deploy/actions/backup.rb', line 5

def save
  shell.notify("Backing up remote ./sites/data directory")
  shell.notify("This may take a while...")
  shell.run!("mkdir -p ./backups")

  shell.ssh!("mkdir -p ./sites/backups")
  shell.ssh!("tar -zcvf ./sites/backups/#{filename} ./sites/data")
  shell.scp!("#{connection}:./sites/backups/#{filename}", "./backups/#{filename}")
  shell.ssh!("rm ./sites/backups/#{filename}")

  shell.notify "success"
end