Capistrano restarts wrong release

I’m having some trouble where it seems that capistrano deploys just fine
(with cap deploy), however, the site is never refreshed. After some
checking it appears that capistrano in fact restarts the mongrels, but
not for the current release?

This is the relevant piece from my config/deploy.rb:

task :restart, :roles => :app do

stop mongrel clusters for previous release and start for current

run “cd #{previous_release} && mongrel_rails cluster::stop”
run “sleep 5”
run “cd #{current_release} && mongrel_rails cluster::start”
end

Also, on the server script/process/reaper seems to restart an old
release as well. Anyone seen this?

Mongrel configuration exists when do restart task? Any log?

If you didn’t wants play with previous and current release, you can use
shared path to maintain pids and configurations beetwen releases.

Regards

Christian J. escribió:

run “sleep 5”
run “cd #{current_release} && mongrel_rails cluster::start”
end

Also, on the server script/process/reaper seems to restart an old
release as well. Anyone seen this?


Rafael Garcia Ortega

Does the mongrel processes pids change?

Would you post your whole cofing/deploy.rb file?


AnibalRojas

http://anibal.rojas.com.ve

On Apr 9, 3:23 am, Christian J. <ruby-forum-incom…@andreas-

Thanks for your help. The mongrel pids do indeed change, but no change
is visible on my webapp. This is my complete config/deploy.rb:

set :application, “myapp”
set :repository, “https://svn.myserver.com/repos/myapp/trunk

If you aren’t deploying to /u/apps/#{application} on the target

servers (which is the default), you can specify the actual location

via the :deploy_to variable:

set :deploy_to, “/var/www/#{application}”

set :deploy_to, “/var/www/mysite/#{application}”

set :user, “christian”

If you aren’t using Subversion to manage your source code, specify

your SCM below:

set :scm, :subversion

role :app, “myserver.com
role :web, “myserver.com
role :db, “myserver.com”, :primary => true

task :restart, :roles => :app do

stop mongrel clusters for previous release and start for current

run “cd #{previous_release} && mongrel_rails cluster::stop”
run “sleep 5”
run “cd #{current_release} && mongrel_rails cluster::start”
end

This fixed frustrating ’sudo: no passwd entry for app’ error when cap

was trying

to run the process start command as ‘app’ for some reason

set :runner, ‘christian’

Currently not using this

#task :copy_database_yml, :roles => :app do

db_config = “#{shared_path}/config/database.yml.production”

run “cp #{db_config} #{release_path}/config/database.yml”

#end

#after “deploy:update_code”, :copy_database_yml

Aníbal Rojas wrote:

Does the mongrel processes pids change?

Would you post your whole cofing/deploy.rb file?


AnibalRojas
http://hasmanydevelopers.com
http://rubycorner.com
http://anibal.rojas.com.ve

On Apr 9, 3:23 am, Christian J. <ruby-forum-incom…@andreas-

Jamis, thank you, now my restart task is running atleast. But now I
have:

ERROR RUNNING ‘cluster::stop’: Plugin /cluster::stop does not exist in
category /commands

so, I thought maybe I could change the task, but I don’t know which
program to run to stop my three mongrels :slight_smile: I start the rascals using
script/spin which contains:

#!/bin/sh
script/process/spawner -a 127.0.0.1 -p 8000 -i 3

script/process/reaper only seems to restart, so I don’t really know what
command to use to stop the old application, move to the new release
folder and then start the servers again. Any ideas?

Jamis B. wrote:

Note that the restart task needs to be in the deploy namespace:

namespace :deploy do
task :restart, :roles => :app do
# …
end
end

Otherwise, you’re not overriding deploy:restart, as you probably are
intending.

  • Jamis

Note that the restart task needs to be in the deploy namespace:

namespace :deploy do
task :restart, :roles => :app do
# …
end
end

Otherwise, you’re not overriding deploy:restart, as you probably are
intending.

  • Jamis