Commit 3494328a6a697b3c671f7b50141c356eede235c1

Authored by Sergio Oliveira
2 parents 3fd1d558 5d1b6a66

Merge branch 'master' of portal.softwarepublico.gov.br:softwarepublico/softwarepublico

Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
@@ -86,8 +86,10 @@ if ['local', 'lxc'].include?($SPB_ENV) @@ -86,8 +86,10 @@ if ['local', 'lxc'].include?($SPB_ENV)
86 end 86 end
87 end 87 end
88 88
  89 +desc 'Downloads latest system backups to backups directory. WARNING: This overrides anything written in the backups directory'
89 task :backup => ssh_config_file do 90 task :backup => ssh_config_file do
90 # setup 91 # setup
  92 + sh 'rm', '-rf', 'backups'
91 sh 'mkdir', '-p', 'backups' 93 sh 'mkdir', '-p', 'backups'
92 # integration 94 # integration
93 sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'chmod a+xr /.snapshots' 95 sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'chmod a+xr /.snapshots'
@@ -97,6 +99,7 @@ task :backup => ssh_config_file do @@ -97,6 +99,7 @@ task :backup => ssh_config_file do
97 sh 'scp', '-F', ssh_config_file, 'social:/.snapshots/hourly.0/spb/*', 'backups/' 99 sh 'scp', '-F', ssh_config_file, 'social:/.snapshots/hourly.0/spb/*', 'backups/'
98 end 100 end
99 101
  102 +desc 'Restores content saved in the backups directory to the target env. WARNING: This will drop all the current databases'
100 task :restore => [ssh_config_file, config_file] do 103 task :restore => [ssh_config_file, config_file] do
101 # setup 104 # setup
102 sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'rm -rf /tmp/backups' 105 sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'rm -rf /tmp/backups'