Hello-

This note started as a bug report, but it's turning into a cautionary
tale, and maybe an enticement to rethink a sharp edge left laying
around.

I have a moderately complex recipe to deploy to multiple servers with
different roles.  Migrations were failing because the rake task was
looking for a directory that doesn't exist.

I start with one web server with (simplifying) releases/1 and releases/
2 and current -> releases/2.  Another web server I just started has
current -> releases/3.  (1, 2, and 3 are timestamps of course, and 2
and 3 are the same contents deployed at different times.)

The recipe starts out doing some housekeeping before deploying, and
made reference to current_release.  This referenced 'releases', which
went out to (on a random server) look at 'ls -x #{releases_path}'

I use deploy:migrations, and starts out happily enough deploying
releases/4 to all hosts.

Later, deploy:migrations sets :migrate_target, :latest and calls
migrate.  migrate looks at (the cached) migrations array and does 'cd
#{releases_path}/2; rake RAILS_ENV=production  db:migrate'.  It does
this on the web server that has no releases/2 directory so the command
fails.

(It's fortunate I had this web server and the command failed, or I
would've torn my hair out trying to figure out why I was one migration
behind, only the first time I deployed!)

This code works for the simple 'cap deploy:migrations' case because
the first reference made to releases_path is after the code has been
deployed.

I was able to work around it by rearranging my code to use (the more
correct) current_path rather than current_release.  But couldn't there
be situations where current_release would be the *right* answer?

Shouldn't the migrate task be informed of the just-deployed release
directly rather than having to go and ls on one of the target hosts to
find out?  (Perhaps finalize_update could append to the releases
array?)

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to