"reaper" is not picking up new changes to my application?


#1

Hi,

Can anyone shed any light on why “reaper” (whilst seemingly working re
restarting my mongrel ruby process) does not pick up changes to my
application? (e.g. changing a title in a view for example). It’s like
the
“mongrel_rails start etc…” is just restarting the current process but
ignoring the new details re where the new application directory is.
That
is with capistrano the new releases are put in different directories,
and
are referenced in the command line options to “mongrel_rails”, however
it
seems these are being picked up. I basically have to do a “reaper -a
kill” and then a “nohup script/spin” to get it to recognize the new
application directory.

Here’s an example of the scenario when I run reaper, the ruby processes
is
restarted, but it doesn’t pick up the new directory (i.e. application
changes).

– CONSOLE OUTPUT —
[root@home ~]# cd /u/apps/equity/current/
[root@home current]# ./script/process/reaper
Restarting 4453
[root@home current]#

– MONGREL LOG EXTRACT –
** USR2 signal received.
** Restarting with arguments: ruby
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails start
-d
-a 0.0.0.0 -p 3001 -P
/u/apps/equity/releases/20090209050120/tmp/pids/dispatch.3001.pid -e
production -c /u/apps/equity/releases/20090209050120 -l
/u/apps/equity/releases/20090209050120/log/mongrel.log
** Daemonized, any open files are closed. Look at
/u/apps/equity/releases/20090209050120/tmp/pids/dispatch.3001.pid and
/u/apps/equity/releases/20090209050120/log/mongrel.log for info.
** Starting Mongrel listening at 0.0.0.0:3001
** Starting Rails with production environment…
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no
restart).
** Rails signals registered. HUP => reload (without restart). It might
not
work well.
** Mongrel 1.1.5 available at 0.0.0.0:3001
** Writing PID file to
/u/apps/equity/releases/20090209050120/tmp/pids/dispatch.3001.pid

Thanks


Greg
http://blog.gregnet.org/


#2

i really don’t know about reaper (as i’m not using it), but i guess
your problem is with the symlink “current”. you are calling reaper
from that directory (in your example: /u/apps/equity/releases/
20090209050120) and it does never leave it. as it seems you need to
add some code/script to leave the current directory and reenter
“current” after the symlink is updated.

from the top of my head i’ think about solving this with a simple
rake- or capistrano-task.


#3

I think I see what you’re getting at - this is actually the result of
running the out of the box capistrano script - here’s the cap deploy
output
for example (I just wanted to make it simpler re my post)
Macintosh-2:equity greg$ cap deploy -n

  • executing `deploy’
  • executing `deploy:update’
    ** transaction: start
  • executing `deploy:update_code’
    updating the cached checkout on all servers
    executing locally: “git ls-remote /Users/greg/source/equity/.git
    HEAD”
  • executing “if [ -d /u/apps/equity/shared/cached-copy ]; then cd
    /u/apps/equity/shared/cached-copy && git fetch -q origin && git reset -q
    –hard 43f8b3df4d8f1f6358b803fbb41f38fcb1a9ddc4; else git clone -q
    greg@10.1.1.102:/Users/greg/source/equity/.git
    /u/apps/equity/shared/cached-copy && cd
    /u/apps/equity/shared/cached-copy &&
    git checkout -q -b deploy 43f8b3df4d8f1f6358b803fbb41f38fcb1a9ddc4; fi”
    copying the cached version to /u/apps/equity/releases/20090209085535
  • executing “cp -RPp /u/apps/equity/shared/cached-copy
    /u/apps/equity/releases/20090209085535 && (echo
    43f8b3df4d8f1f6358b803fbb41f38fcb1a9ddc4 >
    /u/apps/equity/releases/20090209085535/REVISION)”
  • executing `deploy:finalize_update’
  • executing “chmod -R g+w /u/apps/equity/releases/20090209085535”
  • executing “rm -rf /u/apps/equity/releases/20090209085535/log
    /u/apps/equity/releases/20090209085535/public/system
    /u/apps/equity/releases/20090209085535/tmp/pids &&\\n mkdir -p
    /u/apps/equity/releases/20090209085535/public &&\\n mkdir -p
    /u/apps/equity/releases/20090209085535/tmp &&\\n ln -s
    /u/apps/equity/shared/log /u/apps/equity/releases/20090209085535/log
    &&\\n
    ln -s /u/apps/equity/shared/system
    /u/apps/equity/releases/20090209085535/public/system &&\\n ln -s
    /u/apps/equity/shared/pids
    /u/apps/equity/releases/20090209085535/tmp/pids”
  • executing “find /u/apps/equity/releases/20090209085535/public/images
    /u/apps/equity/releases/20090209085535/public/stylesheets
    /u/apps/equity/releases/20090209085535/public/javascripts -exec touch -t
    200902090855.35 {} ‘;’; true”
  • executing `deploy:symlink’
  • executing “rm -f /u/apps/equity/current && ln -s
    /u/apps/equity/releases/20090209085535 /u/apps/equity/current”
    ** transaction: commit
  • executing `deploy:restart’
  • executing “/u/apps/equity/current/script/process/reaper”
    Macintosh-2:equity greg$

2009/2/9 MaD removed_email_address@domain.invalid


Greg
http://blog.gregnet.org/


#4

Still stuck on this. I made sure I wasn’t in the “current” directory
when I
did the call to “reaper” and I still get the same result, i.e. whilst
the
process restarts it does not restart with the latest application updates
(made available via the new application being put in a new “releases”
directory, and then capistrano change the sym link for “current” to this
new
directory).

Question - Is a “reaper” restart action supposed to update an
application?
That is, is the out-of-the box Capistrano command
“/u/apps/equity/current/script/process/reaper” really supposed to update
any
changes to an application (via a “cap deploy”)?

*** BEFORE CALLING REAPER ****
[root@home equity]# ps ax | grep -i ruby
12857 ? S 0:02 ruby
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails start
-d
-a 0.0.0.0 -p 3001 -P
/u/apps/equity/releases/20090209112325/tmp/pids/dispatch.3001.pid
-e production -c /u/apps/equity/releases/20090209112325 -l
/u/apps/equity/releases/20090209112325/log/mongrel.log
13036 pts/1 R+ 0:00 grep -i ruby
[root@home equity]# cat current/tmp/pids/dispatch.3001.pid
12857[root@home equity]# ls -l
total 2
lrwxrwxrwx 1 root root 38 Feb 10 21:10 current ->
/u/apps/equity/releases/20090210111005
drwxrwxr-x 24 root root 1024 Feb 10 21:10 releases
drwxrwxr-x 6 root root 1024 Feb 8 20:46 shared

*** CALL REAPER ***
[root@home equity]# /u/apps/equity/current/script/process/reaper
Restarting 12857

*** AFTER CALLING REAPER ***
[root@home equity]# ps ax | grep -i ruby
13043 ? S 0:02 ruby
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails start
-d
-a 0.0.0.0 -p 3001 -P
/u/apps/equity/releases/20090209112325/tmp/pids/dispatch.3001.pid
-e production -c /u/apps/equity/releases/20090209112325 -l
/u/apps/equity/releases/20090209112325/log/mongrel.log
13048 pts/1 R+ 0:00 grep -i ruby
[root@home equity]# ls -l
total 2
lrwxrwxrwx 1 root root 38 Feb 10 21:10 current ->
/u/apps/equity/releases/20090210111005
drwxrwxr-x 24 root root 1024 Feb 10 21:10 releases
drwxrwxr-x 6 root root 1024 Feb 8 20:46 shared
[root@home equity]# cat current/tmp/pids/dispatch.3001.pid
13043[root@home equity]#
[root@home equity]#

Regards
Greg

2009/2/9 Greg H. removed_email_address@domain.invalid

  • executing "if [ -d /u/apps/equity/shared/cached-copy ]; then cd
  • executing `deploy:finalize_update’
  • executing "find /u/apps/equity/releases/20090209085535/public/images

“current” after the symlink is updated.


Greg
http://blog.gregnet.org/


#5

(bump) still really keen if someone has any info on this one (see below)

2009/2/10 Greg H. removed_email_address@domain.invalid

changes to an application (via a “cap deploy”)?
[root@home equity]# cat current/tmp/pids/dispatch.3001.pid

total 2
Greg

** transaction: start

  • executing "cp -RPp /u/apps/equity/shared/cached-copy
    /u/apps/equity/shared/log /u/apps/equity/releases/20090209085535/log &&\\n
    ** transaction: commit

your problem is with the symlink “current”. you are calling reaper

http://blog.gregnet.org/


Greg
http://blog.gregnet.org/


#6

don’t restart reaper, but:
stop it,
set symlink current,
cd to current,
start it.