Commit db29428a
Changed files (1)
lib
capistrano
tasks
lib/capistrano/tasks/postgresql.rake → 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