Right here:

  set :mongrel_conf, "#{current_path}/config/mongrel_cluster.yml"

The reference to current_path is occuring before deploy_to is set,
which causes it to reference (and remember) the default deploy_to.
What you want is to set the mongrel_conf variable to a proc:

  set(:mongrel_conf) { "#{current_path}/config/mongrel_cluster.yml" }

That will cause the value to not be evaluated until it is needed,
which is after the deploy_to has been set.

Please, this question has been answered several times, just in the
last couple of weeks. Basic mailing list etiquette states that you
should search the list before posting questions, and given that this
group is hosted at google, searching is dead-silly-simple.

Thanks,

Jamis

On 8/10/07, Paul H <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am experiencing some strange behavior when I deploy using
> multistage.
>
> The deploy_to uses the default /u/app/ path instead of the path that I
> specify in my config/deploy/testing.rb when removing and adding the
> symlink, etc.
>
> Now there is one thing that I am doing that is kind of a hack: I
> define the :application in my config/deploy.rb because if I don't cap
> will tell me that I did not specify the application name, but I set
> the :application in each of my config/deploy/*.rb files since it
> varies between environments.
>
> Any tips?
>
> Paul
>
>
> Here is my config/deploy.rb recipe:
> ------------------
> require 'palmtree/recipes/mongrel_cluster'
> set :stages, %w(staging production testing)
> set :default_stage, "testing"
> require 'capistrano/ext/multistage'
>
> set :application, "placeholder.host.com"
> set :repository,   "svn+ssh://[EMAIL PROTECTED]/code/host/trunk"
> set :mongrel_conf, "#{current_path}/config/mongrel_cluster.yml"
> ssh_options[:port] = 522
> ssh_options[:username] = "sshuser"
>
> deploy.task :after_update_code, :roles => [:web] do
>   desc "Copying the right mongrel cluster config for the environment."
>   run "cp -f #{release_path}/config/mongrel_#{stage}.yml
> #{release_path}/config/mongrel_cluster.yml"
> end
> ------------------
>
> Here is the contents of my config/deploy/testing.rb
> ------------------
> puts "*** Deploying to the \033[6;41m  TESTING  \033[0m servers!"
> set  :application, "testing.host.com"
> set  :deploy_to,   "/home/web/#{application}"
> role :app,         application
> role :web,        application
> role :db,          application, :primary => true
> ------------------
>
> Here is the output
> ------------------
>  ** [out]
>     command finished
>   * executing `deploy:finalize_update'
>   * executing "chmod -R g+w /home/web/testing.host.com/releases/
> 20070810082031"
>     servers: ["testing.host.com"]
>     [testing.host.com] executing command
>     command finished
>   * executing "rm -rf /home/web/testing.host.com/releases/
> 20070810082031/log /home/web/testing.host.com/releases/20070810082031/
> public/system /home/web/testing.host.com/releases/20070810082031/tmp/
> pids &&\n      mkdir -p /home/web/testing.host.com/releases/
> 20070810082031/public &&\n      mkdir -p /home/web/testing.host.com/
> releases/20070810082031/tmp &&\n      ln -s /home/web/testing.host.com/
> shared/log /home/web/testing.host.com/releases/20070810082031/log &&
> \n      ln -s /home/web/testing.host.com/shared/system /home/web/
> testing.host.com/releases/20070810082031/public/system &&\n      ln -
> s /home/web/testing.host.com/shared/pids /home/web/testing.host.com/
> releases/20070810082031/tmp/pids"
>     servers: ["testing.host.com"]
>     [testing.host.com] executing command
>     command finished
>   * executing "find /home/web/testing.host.com/releases/20070810082031/
> public/images /home/web/testing.host.com/releases/20070810082031/
> public/stylesheets /home/web/testing.host.com/releases/20070810082031/
> public/javascripts -exec touch -t 200708100821.24 {} ';'; true"
>     servers: ["testing.host.com"]
>     [testing.host.com] executing command
>     command finished
>   * executing `deploy:after_update_code'
>   * executing "cp -f /home/web/testing.host.com/releases/
> 20070810082031/config/mongrel_testing.yml /home/web/testing.host.com/
> releases/20070810082031/config/mongrel_cluster.yml"
>     servers: ["testing.host.com"]
>     [testing.host.com] executing command
>     command finished
>   * executing `deploy:symlink'
>   * executing "rm -f /u/apps/placeholder.host.com/current && ln -s /
> home/web/testing.host.com/releases/20070810082031 /u/apps/
> placeholder.host.com/current"
>     servers: ["testing.host.com"]
>     [testing.host.com] executing command
>  ** [out :: testing.host.com] ln: creating symbolic link `/u/apps/
> placeholder.host.com/current': No such file or directory
>     command finished
> *** [deploy:symlink] rolling back
>   * executing "ls -x /home/web/testing.host.com/releases"
>     servers: ["testing.host.com"]
>     [testing.host.com] executing command
>     command finished
>   * executing "rm -f /u/apps/placeholder.host.com/current; ln -s /home/
> web/testing.host.com/releases/20070801173243 /u/apps/
> placeholder.host.com/current; true"
>     servers: ["testing.host.com"]
>     [testing.host.com] executing command
>  ** [out :: testing.host.com] ln: creating symbolic link `/u/apps/
> placeholder.host.com/current': No such file or directory
>     command finished
> *** [deploy:update_code] rolling back
>   * executing "rm -rf /home/web/testing.host.com/releases/
> 20070810082031; true"
>     servers: ["testing.host.com"]
>     [testing.host.com] executing command
>     command finished
> command "rm -f /u/apps/placeholder.host.com/current && ln -s /home/web/
> testing.host.com/releases/20070810082031 /u/apps/placeholder.host.com/
> current" failed on testing.host.com
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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