Commit bfef631c6287be13211d6b32572c3d6c4be55747
1 parent
d6d3634a
Exists in
master
and in
66 other branches
Drop noosfero database before its restore task
Showing
2 changed files
with
7 additions
and
1 deletions
Show diff stats
Rakefile
| ... | ... | @@ -93,6 +93,12 @@ task :backup => ssh_config_file do |
| 93 | 93 | end |
| 94 | 94 | |
| 95 | 95 | task :restore => ssh_config_file do |
| 96 | + # setup | |
| 97 | + sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'rm -rf /tmp/backups' | |
| 98 | + sh 'ssh', '-F', ssh_config_file, 'social', 'sudo', 'rm -rf /tmp/backups' | |
| 99 | + sh 'ssh', '-F', ssh_config_file, 'social', 'sudo', 'systemctl stop noosfero' | |
| 100 | + sh 'ssh', '-F', ssh_config_file, 'database', 'sudo', 'sudo -u postgres dropdb noosfero 2> /dev/null' | |
| 101 | + sh 'ssh', '-F', ssh_config_file, 'database', 'sudo', 'sudo -u postgres createdb noosfero --owner noosfero 2> /dev/null' | |
| 96 | 102 | #integration |
| 97 | 103 | sh 'scp', '-r', '-F', ssh_config_file, 'backups', 'integration:/tmp' |
| 98 | 104 | sh 'scp', '-F', ssh_config_file, 'utils/migration/restore_integration.sh', 'integration:/tmp' |
| ... | ... | @@ -101,6 +107,7 @@ task :restore => ssh_config_file do |
| 101 | 107 | sh 'scp', '-r', '-F', ssh_config_file, 'backups', 'social:/tmp' |
| 102 | 108 | sh 'scp', '-F', ssh_config_file, 'utils/migration/restore_social.sh', 'social:/tmp' |
| 103 | 109 | sh 'ssh', '-F', ssh_config_file, 'social', 'sudo', '/tmp/restore_social.sh' |
| 110 | + sh 'ssh', '-F', ssh_config_file, 'social', 'sudo', 'systemctl start noosfero' | |
| 104 | 111 | end |
| 105 | 112 | |
| 106 | 113 | task :bootstrap_common => 'config/local/ssh_config' | ... | ... |
utils/migration/restore_social.sh
| ... | ... | @@ -4,6 +4,5 @@ echo 'Starting restore on social...' |
| 4 | 4 | #Noosfero restore |
| 5 | 5 | echo 'restoring Noosfero...' |
| 6 | 6 | cd /usr/lib/noosfero |
| 7 | -#TODO: drop and create noosfero database | |
| 8 | 7 | yes y | RAILS_ENV=production sudo -u noosfero bundle exec rake restore BACKUP=/tmp/backups/noosfero_backup.tar.gz 1> /dev/null 2>/dev/null |
| 9 | 8 | echo 'done.' | ... | ... |