Alright, thanks again guys, it's all working now.

Now that I understand the code, it is perfectly clear to me that all
we did was defining a new task in a new namespace - I did not get that
when I first looked at it.
I said I am surprised that capistrano will execute in the home
directory because I would have expected it will cd to the deploy_to
directory after login (which it does in deploy:start - just not in
userdefined tasks).
When I said "I just don't understand why I need that", I meant I don't
see whats so special about my setup that the predefined deploy:start
does not work out of the box. I checked the source and found the
following code:

  task :start, :roles => :app do
    run "cd #{current_path} && #{try_runner} nohup script/spin"
  end

which looks perfectly reasonable to me. However, it does not work for
some reason. If I cd to current_path and run nohup script/spin without
sudo manually, it starts mongrel up as expected. If I do it with sudo,
it will print the same output in the nohup.out file, but not start
mongrel. The output is:

> Starting mongrel dispatchers
Checking if something is already running on 127.0.0.1:8000...NO
Starting dispatcher on port: 127.0.0.1:8000

If I have capistrano do it (with use_sudo set to false) It will not
print anything in the nohup out, will give the following console
output, and NOT start mongrel:

  * executing `deploy:start'
  * executing "cd /var/www/drklaehn/current &&  nohup script/spin"
    servers: ["h1467226.stratoserver.net"]
Password:
    [h1467226.stratoserver.net] executing command
 ** [out :: h1467226.stratoserver.net] => Starting mongrel dispatchers
 ** [out :: h1467226.stratoserver.net] Checking if something is
already running on 127.0.0.1:8000...NO
 ** [out :: h1467226.stratoserver.net] Starting dispatcher on port:
127.0.0.1:8000
    command finished

If I have capistrano do it with sudo, I get:

  * executing `deploy:start'
  * executing "cd /var/www/drklaehn/current && sudo -p 'sudo password:
' -u app nohup script/spin"
    servers: ["h1467226.stratoserver.net"]
Password:
    [h1467226.stratoserver.net] executing command
*** [err :: h1467226.stratoserver.net] sudo:
*** [err :: h1467226.stratoserver.net] no passwd entry for app!
*** [err :: h1467226.stratoserver.net]
    command finished
failed: "sh -c \"cd /var/www/drklaehn/current && sudo -p 'sudo
password: ' -u app nohup script/spin\"" on h1467226.stratoserver.net

Since it should work without sudo, I can probably care less about that
last problem.

So again: If I use the suggested scripts, it works. I would just
prefer to have my server set up in a way that it runs out of the box,
because I will likely deploy more than one rails app, and it's not
very dry to specify that mongrel:start in each deploy.rb.

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