I have some database tasks which work fantastically for my standard stages 
(beta, deploy).
They're doing things like triggering a backup, downloading it and restoring.

that's great for getting the production db and copying it up to beta.

I'd like to be able to restore the backup on my local development machine 
too. Is there a sensible way I can do this?

something like?
cap development db:restore

how would I set up my development stage to say 'connect on localhost, don't 
worry about ssh'

the restore task is...



  desc 'restore backup'
  task :restore do
    on primary :web do


      raise "Cant restore to production without deleting this line\n" if (
fetch(:stage) == :production)


      backup_file = "tmp/rails_database.tar"
      backup_destination = "#{shared_path}/tmp/rails_database.tar"


      upload! backup_file, backup_destination
      execute "tar -xvf #{backup_destination} -C #{shared_path}/tmp 
--strip-components=2"
      execute :rm, backup_destination


      sql_file = "#{shared_path}/tmp/MySQL.sql.gz"
      secrets = current_secrets(fetch(:stage).to_s)


      mysql_command = mysql(secrets)
      execute "gzip -d -c #{sql_file} | #{mysql_command}"




    end
  end

thank you!


Versions:

   - Ruby 2.4.2
   - Capistrano 3.9.1
   - Rails 5.1

Platform:

   - Mac OS


-- 
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capistrano+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/capistrano/c5d48803-c211-48e1-aef0-9b701392febb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to