Quantcast
Channel: Jay, trying to remember... » jay
Viewing all articles
Browse latest Browse all 10

Backing up your DB on a Capistrano deployment

$
0
0

Yeah, it’s simple but useful. Since I’m using sqlite at the moment, it’s just a copy but you could run any command in a similar way. I’m also tagging the backup name with a date. Here’s a snip from my Capistrano deploy file….

# ...snip...
namespace :deploy do
  task :restart do
    t=Time.now
    run "cp /path/to/db.sqlite3 /path/to/backup/#{t.year}-#{t.month}-#{t.day}_#{t.hour}:#{t.min}:#{t.sec}_db.sqlite3"
    run "touch #{current_path}/tmp/restart.txt" 
  end
end

Viewing all articles
Browse latest Browse all 10

Trending Articles