I won''t bore you with the details of how and why. I have my mongrels
running under the "apache" user id.
In /Library/LaunchDaemons (on the server) create files called
org.rubyforge.mongrel.8000 org.rubyforge.mongrel.8001, etc. One such
file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN"
http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.rubyforge.mongrel.8000</string>
<key>OnDemand</key>
<false/>
<key>WorkingDirectory</key>
<string>/usr/local/www/rcm.easesoftware.com/rails/current</string>
<key>StandardErrorPath</key>
<string>log/mongrel.8000.log</string>
<key>UserName</key>
<string>apache</string>
<key>GroupName</key>
<string>daemon</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/mongrel_rails</string>
<string>start</string>
<string>-e</string>
<string>production</string>
<string>-p</string>
<string>8000</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Note that you want to change the WorkingDirectory. The 8000''s change
to
8001, etc for each of the files.
To get so that the apache user can control the mongrels, add this to
/etc/sudoers (on the server):
apache ALL=(root) NOPASSWD: /bin/launchctl unload
/Library/LaunchDaemons/org.rubyforge.mongrel.*
apache ALL=(root) NOPASSWD: /bin/launchctl load
/Library/LaunchDaemons/org.rubyforge.mongrel.*
To get so that capistrano can control this remotely, my Cap file has
this in it:
namespace :deploy do
desc "The start task is used by :cold_deploy to start the application
up"
task :start, :roles => :app do
run "sudo /bin/launchctl load
/Library/LaunchDaemons/org.rubyforge.mongrel.*"
end
desc "Restart the mongrel cluster"
task :restart, :roles => :app do
run "sudo /bin/launchctl unload
/Library/LaunchDaemons/org.rubyforge.mongrel.*"
run "sudo /bin/launchctl load
/Library/LaunchDaemons/org.rubyforge.mongrel.*"
end
desc "Stop the mongrel cluster"
task :stop, :roles => :app do
run "sudo /bin/launchctl unload
/Library/LaunchDaemons/org.rubyforge.mongrel.*"
end
desc "Hook to set up database.yml"
task :after_update_code, :roles => :app do
db_config = "#{shared_path}/config/database.yml.production"
run "cp #{db_config} #{release_path}/config/database.yml"
end
end
HTH,
pedz
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---