This gets me 80% of the way. I also want to automate the populating of my local (dev) database though. Surely, within this Capistrano recipe is inappropriate. Keep in mind that the database is one of _many_ items that I'd like to send from production to dev.
This is why my initial thought was to use Rake to invoke capistrano for the few functions that were necessary to be executed remotely. However, it seems that Rake + Capistrano is falling out of favor. What do you guys think? -John On Sep 19, 10:34 am, John Trupiano <[EMAIL PROTECTED]> wrote: > I posed the following question to Jamis directly, and his response is > beneath. I have some follow up questions that I'd like to pose to > all-- > > ==== BEGIN MY MESSAGE ===== > > My scenario is the following. In many projects, it is often desirable > to copy production data back to a development copy of an app. This > almost always consists of a database dump + filesystem content ( i.e. > uploaded images, etc.). > > Capistrano (appears to) only allow me to work on the remote (i.e. > production) machine. What I'd like to do is have tasks (either Rake > or Capistrano, unless something else is more suitable) that remote > into the production machine and back this data up (simple). I'd > furthermore like to automate the copying (scp) of this data back to my > dev machine. > > In my specific scenario, my dev machine is behind a NAT router, so > running scp from my dev box is certainly preferable. > > My plan was to write a rake task that did the following: > > 1) Exec cap:backup_content > 2) scp this content to the local machine > > Now that I'm thinking about it, I guess I'd also like to have this > backed up content deleted from the production server. In my current > execution plan (rake task that invokes cap), this would require a > second call to capistrano ( i.e. 2 separate ssh's into the production > server, which is wasteful). This could be further extended to then re- > populate my local production database, etc. > > Do you have any thoughts/suggestions? I would imagine this to be a > very common need, as it is on many of our projects. > > Thanks for any insight or help you can give! > > ==== END MY MESSAGE ===== > > ==== BEGIN JAMIS' REPLY ===== > > John, > > In general, I'd recommend that you subscribe to the capistrano mailing > list for questions like this. I can't promise I'll be able to answer > most queries in a timely fashion if they are directed at me > personally. > > That said, for your question, Capistrano has a "get" helper method for > downloading files from the remote host to the local host. so you can > do something like this (pseudocode): > > task :backup_content do > run "do_backup_thing > /tmp/backup.tar.bz2" > get "/tmp/backup.tar.bz2", "/path/on/local/host/backup.tar.bz2" > end > > - Jamis > > ==== END JAMIS' REPLY ===== --~--~---------~--~----~------------~-------~--~----~ To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/capistrano -~----------~----~----~----~------~----~------~--~---
