summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-09-07 09:00:29 -0600
committermo khan <mo@mokhan.ca>2014-09-07 09:00:29 -0600
commitdb29428a262612f75768cb24e02896ea7bc72a75 (patch)
tree88f64508558290a4afd6f503b5e03ca1114ddbcf
parente072dfa874397da1567ff4397e5352dd22c39c7c (diff)
update database backup task to sync to s3 as well.
-rw-r--r--lib/capistrano/tasks/db.rake (renamed from lib/capistrano/tasks/postgresql.rake)3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/capistrano/tasks/postgresql.rake b/lib/capistrano/tasks/db.rake
index 09257e28..61c80a69 100644
--- a/lib/capistrano/tasks/postgresql.rake
+++ b/lib/capistrano/tasks/db.rake
@@ -1,6 +1,6 @@
set(:postgresql_host, "localhost")
-namespace :postgresql do
+namespace :db do
desc "Backup the database and copy it locally"
task :backup do
filename = "#{fetch(:rails_env)}-#{Time.now.strftime('%Y-%m-%d-%H-%M')}.dump"
@@ -10,6 +10,7 @@ namespace :postgresql do
execute "mkdir -p #{shared_path}/backups"
execute "PGPASSWORD='#{fetch(:postgresql_password)}' pg_dump -Fc --no-acl --no-owner -h #{fetch(:postgresql_host)} -U deployer cakeside > #{backup_path}/#{filename}"
download!("#{backup_path}/#{filename}", "db/backups/", :via => :scp)
+ execute "s3cmd sync #{shared_path}/backups/*.dump s3://cakeside-logs/#{fetch(:rails_env)}/pg/"
end
end
end