bradley taylor
2006-May-01 12:46 UTC
[Rails] [ANN] mongrel_cluster-0.1.1: the bird dog (capistrano support!)
Hey y''all: mongrel_cluster provides management tools for running Mongrel behind a reverse-proxy/load balancer. It is an extraction from Rails Machine, a deployment service and Ruby library that simplifies Rails application deployment. This release fixes bugs and adds a Capistrano task library. Changes: -changed pid file format to include port -only write configuration options that are explicitly specified or required. -removed some validation rules and delegate to mongrel_rails. -added Capistrano task library. Please rerun mongrel_rails cluster::configure to ensure smooth operation. ***Capistrano Recipe*** Add to config/deploy.rb: require ''mongrel_cluster/recipes'' Example usage: cap -a configure_mongrel_cluster Variables mongrel_servers: Number of Mongrel servers to start. mongrel_port: Starting port to bind to. mongrel_address: Address to bind to. mongrel_environment: Rails environment to run as. mongrel_config: Path to config file. use_sudo: Whether or not tasks that can use sudo, ought to use sudo. Capistrano defaults to true. Tasks (performed on :app role) configure_mongrel_cluster: Configure the cluster with variables. Uses sudo if use_sudo is true. start_mongrel_cluster: Start Mongrel processes on the app server. Uses sudo if use_sudo is true. stop_mongrel_cluster: Stop the Mongrel processes on the app server. Uses sudo if use_sudo is true. restart_mongrel_cluster: Restart the Mongrel processes on the app server. Uses sudo if use_sudo is true. restart: Calls restart_mongrel_cluster to allow Mongrel to be used with the standard Capistrano deploy task. spinner: Calls start_mongrel_cluster to allow Mongrel to be used with the standard Capistrano cold_deploy task. Good luck and let me know how it works for ya! Thanks, Bradley Taylor ------ Rails Machine Simplified web application deployment http://railsmachine.com
Roberto Saccon
2006-May-04 14:55 UTC
[Rails] [ANN] mongrel_cluster-0.1.1: the bird dog (capistrano support!)
Uff, I got lost. I had mongrel_cluster 0.1working fine, even with capistrano (my own hack). Then came mongrel_cluster 0.1.1 and I tried to set it up, but somehow I messed up things and nothing worked anymore. So here what I did: on production machine: (debian linux, rails 1.1) ------------------------------------------------------------- - installing mongrel_cluster 0.1.1 on development machine**: (windows XP, raills 1.1) ----------------------------------------------------------------------- - inststalling mongrel_cluster 0.1.1 - recreating config file: mongrel_rails cluster::configure - modifying configfile manually to make it look like this: (will be more the one server later) --- num-procs: 1024 docroot: public timeout: 120 cwd: /home/me/sites/myapp/current log_file: log/mongrel.log port: 3000 config_script: debug: false environment: production servers: 1 pid_file: log/mongrel.pid address: 0.0.0.0 mime_map: - deploy.rb: commented out my old restart and spinner tasks and added: require ''mongrel_cluster/recipes'' - deployment: rake deploy (fails because config file is at: /home/me/sites/myapp/current/config/mongrel_cluster.yml) ... executing "mongrel_rails cluster::restart -C /home/me/sites/myapp/config/mongrel_cluster.yml" ... then I thought I could give "cap -a configure_mongrel_cluster" a try, hoping it would put things into the right order, but I got this: ** [out :: xx.xx.xx.xx] !!! Path to log file not valid: log/mongrel.log ** [out :: xx.xx.xx.xx] cluster::configure reported an error. Use -h to get help. So what is wrong with the way I approached capistrano mongrel_cluster ? regards Roberto On 5/1/06, bradley taylor <bradley@railsmachine.com > wrote:> > Hey y''all: > > mongrel_cluster provides management tools for running Mongrel behind > a reverse-proxy/load balancer. It is an extraction from Rails > Machine, a deployment service and Ruby library that simplifies Rails > application deployment. This release fixes bugs and adds a Capistrano > task library. > > Changes: > -changed pid file format to include port > -only write configuration options that are explicitly specified or > required. > -removed some validation rules and delegate to mongrel_rails. > -added Capistrano task library. > > Please rerun mongrel_rails cluster::configure to ensure smooth > operation. > > ***Capistrano Recipe*** > > Add to config/deploy.rb: > require ''mongrel_cluster/recipes'' > > Example usage: > cap -a configure_mongrel_cluster > > Variables > mongrel_servers: Number of Mongrel servers to start. > mongrel_port: Starting port to bind to. > mongrel_address: Address to bind to. > mongrel_environment: Rails environment to run as. > mongrel_config: Path to config file. > use_sudo: Whether or not tasks that can use sudo, ought to use sudo. > Capistrano defaults to true. > > Tasks (performed on :app role) > configure_mongrel_cluster: Configure the cluster with variables. Uses > sudo if use_sudo is true. > start_mongrel_cluster: Start Mongrel processes on the app server. > Uses sudo if use_sudo is true. > stop_mongrel_cluster: Stop the Mongrel processes on the app server. > Uses sudo if use_sudo is true. > restart_mongrel_cluster: Restart the Mongrel processes on the app > server. Uses sudo if use_sudo is true. > restart: Calls restart_mongrel_cluster to allow Mongrel to be used > with the standard Capistrano deploy task. > spinner: Calls start_mongrel_cluster to allow Mongrel to be used with > the standard Capistrano cold_deploy task. > > Good luck and let me know how it works for ya! > > Thanks, > Bradley Taylor > ------ > Rails Machine > Simplified web application deployment > http://railsmachine.com > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060504/ce91a7a7/attachment-0001.html
Michael A. Schoen
2006-May-08 07:52 UTC
[Rails] Re: [Mongrel] [ANN] mongrel_cluster-0.1.1: the bird dog (capistrano support!)
bradley taylor wrote:> Hey y''all: > mongrel_cluster provides management tools for running Mongrel behind > a reverse-proxy/load balancer. It is an extraction from Rails > Machine, a deployment service and Ruby library that simplifies Rails > application deployment. This release fixes bugs and adds a Capistrano > task library.>> Good luck and let me know how it works for ya!This has been VERY helpful, thanks! Two things have come to mind that might be helpful to include in a future release: 1. Parse the mongrel_cluster.yml file through ERB, like Rails does for the fixtures and database.yml file. Would allow for things like setting the CWD to ENV[''HOME''], etc. Rails uses: YAML::load(ERB.new(IO.read(database_configuration_file)).result) 2. Provide a cluster command for starting up "missing" Mongrel servers. The issue is that "restart" only restarts processes that are actually running. And just running "start" will do _bad_ things if you just run it; it appears to put a new pid into the .pid file, but then fail to start up (since a process is running already on that port) -- the net effect is that the process is now orphaned, since you don''t know the pid anymore. I guess I''m looking for something like the fcgi spinner, that can start up Mongrel processes if they die. And allow restarts to turn into a plain old start, if the target process isn''t found.
bradley taylor
2006-May-08 15:10 UTC
[Mongrel] [ANN] mongrel_cluster-0.1.1: the bird dog (capistrano support!)
Hi Michael, Thanks for the feedback. Comments below.> > 1. Parse the mongrel_cluster.yml file through ERB, like Rails does for > the fixtures and database.yml file. Would allow for things like > setting > the CWD to ENV[''HOME''], etc. Rails uses: >I''m not sure I understand your motivation. What problem are you trying to solve? The cluster::configure command allows you to specify the working directory with the "-c" option. For example: mongrel_rails cluster::configure -c $HOME/animal_shelter> > 2. Provide a cluster command for starting up "missing" Mongrel > servers. > The issue is that "restart" only restarts processes that are actually > running. And just running "start" will do _bad_ things if you just run > it; it appears to put a new pid into the .pid file, but then fail to > start up (since a process is running already on that port) -- the net > effect is that the process is now orphaned, since you don''t know > the pid > anymore.I think you''ve stumbled on to a few interesting issues: 1. mongrel_rails overwrites the PID file before verifying that the port is available. I''m working on a patch and will send it to Zed and see what he thinks. 2. In addition, should cluster::start validate the availability of ports before calling mongrel_rails start? It probably should ensure the "integrity" of the cluster and fail to start if all ports aren''t available. 3. Should cluster::restart have a "lost dog" option that starts missing members of the pack? This might be handy, but I need to think about its real world usage in the context of processing monitoring. With Monit, I use stop/start instead of restart. I suppose if you didn''t have monitoring or if it only alerted you, cluster::restart would be the fastest way to get the cluster back in shape. I''ll see if I can work this stuff into the next release.> I guess I''m looking for something like the fcgi spinner, that can > start > up Mongrel processes if they die. And allow restarts to turn into a > plain old start, if the target process isn''t found. >The Rails script/process/spawner (spinner in 1.0) strategy is a pretty heavy-handed approach to the problem. It is not an appropriate solution for resource limited deployments like a small VPS. Proper process monitoring packages such as Monit and Supervise are the way to go, because they provide notification and detection of an array of potential problems (not just process death) with less overhead. Support for Monit and init.d scripts for mongrel_cluster will be available in the upcoming release of the Rails Machine deployment Gem. Thanks, Bradley ------ Rails Machine Simplified Ruby on Rails application deployment http://railsmachine.com