From bradley at railsmachine.com Mon May 1 08:46:09 2006 From: bradley at railsmachine.com (bradley taylor) Date: Mon, 1 May 2006 08:46:09 -0400 Subject: [Mongrel] [ANN] mongrel_cluster-0.1.1: the bird dog (capistrano support!) Message-ID: <5C7DCE19-999A-4711-829C-1095F652B9CF@railsmachine.com> 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 From why at ruby-lang.org Mon May 1 13:08:53 2006 From: why at ruby-lang.org (why the lucky stiff) Date: Mon, 01 May 2006 11:08:53 -0600 Subject: [Mongrel] Nightly mongrel issues... In-Reply-To: <026C046A-50E5-4446-B739-CEFE22032DD2@joyent.com> References: <026C046A-50E5-4446-B739-CEFE22032DD2@joyent.com> Message-ID: <445640A5.4070702@ruby-lang.org> Jason Hoffman wrote: >>It seems like the mysql tcp connection is dying during the night. >>I'd be >> >> > >interactive_timeout in mysql defaults to 28800 seconds (480 minutes >or 8 hours). > > Just raising the interactive_timeout doesn't really solve the problem (while it may appear to.) I would suggest setting the verification_timeout for ActiveRecord. Set it lower than the interactive_timeout in MySQL. ActiveRecord::Base.verification_timeout = 14400 This will force Rails to reconnect to the database before MySQL can get a chance to timeout. _why From maurizio at gmail.com Mon May 1 13:12:44 2006 From: maurizio at gmail.com (Maurizio Balestrieri) Date: Mon, 1 May 2006 19:12:44 +0200 Subject: [Mongrel] Mongrel, Ubuntu (Dapper) and Park Place Message-ID: <1c7fecb90605011012s4b2b2876i942c44521e7c068a@mail.gmail.com> Hello. (This message is a followup of a previous request for help sent to the rails mailing list on the same subject.) I managed to compile [the native extensions for] mongrel on ubuntu based on some feedback I got from Zed on the rails mailing list, but still no joy in running parkplace ? The system seems working but I get no CSS rendered, and it seems I cannot send a file with a permission different form 'private', even when I select 'public read', etc. Have you any suggestion on how to proceed? Thank you. * Please login in with `admin' and password `pass at word1' * You should change the default password or delete the admin at soonest chance! * You have sendfile installed, will use that to serve files. * Running 0.0.0.0:3002 listener. * ParkPlace example is running at http://localhost:3002/ ERROR : No such file or directory ? /usr/local/lib/site_ruby/static/js/prototype.js /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel/camping.rb:51:in `size' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel/camping.rb:51:in `process' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel.rb:470:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel.rb:469:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel.rb:540:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel.rb:539:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel.rb:528:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel.rb:819:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel.rb:817:in `run' /usr/local/lib/site_ruby/1.8/parkplace.rb:48:in `cloaker_' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel.rb:703:in `listener' /usr/local/lib/site_ruby/1.8/parkplace.rb:44:in `cloaker_' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel.rb:661:in `initialize' /usr/local/lib/site_ruby/1.8/parkplace.rb:43:in `serve' ./bin/parkplace:28 From why at ruby-lang.org Mon May 1 13:20:52 2006 From: why at ruby-lang.org (why the lucky stiff) Date: Mon, 01 May 2006 11:20:52 -0600 Subject: [Mongrel] Mongrel, Ubuntu (Dapper) and Park Place In-Reply-To: <1c7fecb90605011012s4b2b2876i942c44521e7c068a@mail.gmail.com> References: <1c7fecb90605011012s4b2b2876i942c44521e7c068a@mail.gmail.com> Message-ID: <44564374.7010903@ruby-lang.org> Maurizio Balestrieri wrote: >I managed to compile [the native extensions for] mongrel on ubuntu >based on some feedback I got from Zed on the rails mailing list, but >still no joy in running parkplace ? The system seems working but I get >no CSS rendered, and it seems I cannot send a file with a permission >different form 'private', even when I select 'public read', etc. Have >you any suggestion on how to proceed? Thank you. > > It appears that you have installed ParkPlace (using setup.rb or something.) I'd recommend just running ParkPlace from its own directory for now. svn co http://code.whytheluckystiff.net/svn/parkplace/trunk parkplace cd parkplace bin/parkplace I have some patches to remedy this situation, but I'm not done thinking about... if they solve the problem... in the manner I'd like them to. _why From maurizio at gmail.com Mon May 1 15:25:31 2006 From: maurizio at gmail.com (Maurizio Balestrieri) Date: Mon, 1 May 2006 21:25:31 +0200 Subject: [Mongrel] Mongrel, Ubuntu (Dapper) and Park Place In-Reply-To: <44564374.7010903@ruby-lang.org> References: <1c7fecb90605011012s4b2b2876i942c44521e7c068a@mail.gmail.com> <44564374.7010903@ruby-lang.org> Message-ID: <1c7fecb90605011225g53b590b2u23ac0b21c9c6783f@mail.gmail.com> Thank you for your advise. I removed the "installed" files and launched as suggested. It works now! I'd like to study the code and the database structure now. When you'll have some spare time, would you like to share more words about your philosophy to parkplace/S3, the aims of parkplace, and the database structure (how it reflects your approach)? Regards, --M On 5/1/06, why the lucky stiff wrote: > svn co http://code.whytheluckystiff.net/svn/parkplace/trunk parkplace > cd parkplace > bin/parkplace From lists at kikobu.com Mon May 1 15:55:43 2006 From: lists at kikobu.com (Morten) Date: Mon, 01 May 2006 21:55:43 +0200 Subject: [Mongrel] Capistrano restart task Message-ID: <445667BF.2000808@kikobu.com> Hi. Have anyone figured out a simple restart task for mongrel using Capistrano? Br. Morten From rsaccon at gmail.com Mon May 1 15:59:00 2006 From: rsaccon at gmail.com (Roberto Saccon) Date: Mon, 1 May 2006 16:59:00 -0300 Subject: [Mongrel] Capistrano restart task In-Reply-To: <445667BF.2000808@kikobu.com> References: <445667BF.2000808@kikobu.com> Message-ID: use the mongrel_cluster gem, that is the simplest way to achieve that On 5/1/06, Morten wrote: > > > Hi. Have anyone figured out a simple restart task for mongrel using > Capistrano? > > Br. > > Morten > > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > -- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060501/e1465714/attachment-0001.htm From lists at kikobu.com Mon May 1 17:03:49 2006 From: lists at kikobu.com (Morten) Date: Mon, 01 May 2006 23:03:49 +0200 Subject: [Mongrel] Capistrano restart task In-Reply-To: References: <445667BF.2000808@kikobu.com> Message-ID: <445677B5.9090308@kikobu.com> Roberto Saccon wrote: > use the mongrel_cluster gem, that is the simplest way to achieve that Thanks for the tip. It appears to work, but doesn't reload changes consistently - it looks promising though. Morten > > On 5/1/06, *Morten* > wrote: > > > Hi. Have anyone figured out a simple restart task for mongrel using > Capistrano? > > Br. > > Morten > > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > > > > > -- > Roberto Saccon > > > ------------------------------------------------------------------------ > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users From why at ruby-lang.org Tue May 2 03:39:56 2006 From: why at ruby-lang.org (why the lucky stiff) Date: Tue, 02 May 2006 01:39:56 -0600 Subject: [Mongrel] Mongrel, Ubuntu (Dapper) and Park Place In-Reply-To: <1c7fecb90605011225g53b590b2u23ac0b21c9c6783f@mail.gmail.com> References: <1c7fecb90605011012s4b2b2876i942c44521e7c068a@mail.gmail.com> <44564374.7010903@ruby-lang.org> <1c7fecb90605011225g53b590b2u23ac0b21c9c6783f@mail.gmail.com> Message-ID: <44570CCC.3070208@ruby-lang.org> Maurizio Balestrieri wrote: > When you'll have some spare time, would you like to share more words > about your philosophy to parkplace/S3, the aims of parkplace, and the > database structure (how it reflects your approach)? > Great, glad it's working. I would encourage you to post your questions as tickets on the Park Place trac site: http://code.whytheluckystiff.net/parkplace/newticket I have no aims or philosophy. _why From jeremy at jthopple.com Tue May 2 10:03:26 2006 From: jeremy at jthopple.com (Jeremy Hopple) Date: Tue, 2 May 2006 08:03:26 -0600 Subject: [Mongrel] Nightly mongrel issues... In-Reply-To: <445640A5.4070702@ruby-lang.org> References: <026C046A-50E5-4446-B739-CEFE22032DD2@joyent.com> <445640A5.4070702@ruby-lang.org> Message-ID: Thanks for the help! Everything has been stable for a couple nights now. I think a combination of getting the native ruby-mysql drivers compiled and setting the verification_timeout for ActiveRecord did the trick. On 5/1/06, why the lucky stiff wrote: > > Jason Hoffman wrote: > > >>It seems like the mysql tcp connection is dying during the night. > >>I'd be > >> > >> > > > >interactive_timeout in mysql defaults to 28800 seconds (480 minutes > >or 8 hours). > > > > > Just raising the interactive_timeout doesn't really solve the problem > (while it may appear to.) I would suggest setting the > verification_timeout for ActiveRecord. Set it lower than the > interactive_timeout in MySQL. > > ActiveRecord::Base.verification_timeout = 14400 > > This will force Rails to reconnect to the database before MySQL can get > a chance to timeout. > > _why > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060502/60b38160/attachment.htm From rsaccon at gmail.com Thu May 4 15:49:37 2006 From: rsaccon at gmail.com (Roberto Saccon) Date: Thu, 4 May 2006 16:49:37 -0300 Subject: [Mongrel] problem setting up mongrel_cluster 0.1.1 Message-ID: I posted this to the rails list before by mistake, and only later realized that there is a specific mongrel list. 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 is 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 Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060504/b8cdbcb6/attachment.htm From bradley at railsmachine.com Thu May 4 16:16:27 2006 From: bradley at railsmachine.com (bradley taylor) Date: Thu, 4 May 2006 16:16:27 -0400 Subject: [Mongrel] problem setting up mongrel_cluster 0.1.1 In-Reply-To: References: Message-ID: <22013A76-5917-41D5-AD48-8AB3C9B0E2F7@railsmachine.com> Hi Robert: > > 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. This was a problem with 0.1, but should be resolved in 0.1.1. I changed cluster::configure to not validate log paths. Double check the version with " gem list mongrel_cluster" please. Thanks, Bradley ------ Rails Machine Simplified Ruby on Rails application deployment http://railsmachine.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060504/05b27404/attachment.htm From rsaccon at gmail.com Fri May 5 01:09:17 2006 From: rsaccon at gmail.com (Roberto Saccon) Date: Fri, 5 May 2006 02:09:17 -0300 Subject: [Mongrel] problem setting up mongrel_cluster 0.1.1 In-Reply-To: <22013A76-5917-41D5-AD48-8AB3C9B0E2F7@railsmachine.com> References: <22013A76-5917-41D5-AD48-8AB3C9B0E2F7@railsmachine.com> Message-ID: ok, I uninstalled 0.1 to make absolutely sure that 0.1.1 is running and did all configuration steps again and now it even got worse: after deploying the "current" symlink points to a nonexistent "config". Bradley, can you show a simple, but working example of what needs to be configured at the develpment machine and what needs to be done at the production machine (if anything at all) ? Then I hopefullyI can figure out what I am doing wrong. On 5/4/06, bradley taylor wrote: > > Hi Robert: > > > 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. > > > This was a problem with 0.1, but should be resolved in 0.1.1. > > I changed cluster::configure to not validate log paths. Double check the > version with " gem list mongrel_cluster" please. > > Thanks, > Bradley > > ------ > Rails Machine > Simplified Ruby on Rails application deployment > http://railsmachine.com > > > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > > -- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060505/cc66630e/attachment.htm From bradley at railsmachine.com Fri May 5 08:41:07 2006 From: bradley at railsmachine.com (bradley taylor) Date: Fri, 5 May 2006 08:41:07 -0400 Subject: [Mongrel] problem setting up mongrel_cluster 0.1.1 In-Reply-To: References: <22013A76-5917-41D5-AD48-8AB3C9B0E2F7@railsmachine.com> Message-ID: <3D45E95F-F810-4B9B-97E4-1262D6D020BD@railsmachine.com> Hi Roberto: > > Bradley, can you show a simple, but working example of what needs > to be configured at the develpment machine and what needs to be > done at the production machine (if anything at all) ? Then I > hopefullyI can figure out what I am doing wrong. ***deploy.rb*** require 'mongrel_cluster/recipes' role :web, "10.0.1.5" role :app, "10.0.1.5" role :db, "10.0.1.5", :primary => true set :application, "animal_shelter" set :deploy_to, "/var/apps/#{application}" # /var/apps/ is owned by deploy set :user, "deploy" set :repository, "your_repository_here" set :use_sudo, false *** server *** No configuration needed. *** dev machine *** First deployment: cap -a setup cap -a configure_mongrel_cluster cap -a cold_deploy Subsequent deployments: svn commit -m "more software" cap -a deploy > ok, I uninstalled 0.1 to make absolutely sure that 0.1.1 is running > and did all configuration steps again and now it even got worse: > after deploying the "current" symlink points to a nonexistent > "config". > By default the config file is written to deploy_to/config. It looks like your deploy_to variable contains "current" as configure_mongrel_cluster writes to deploy_to/config/ mongrel_cluster.yml. deploy_to should be the root directory of your deployment. Feel free to send me a censored version of your deploy.rb and I'll talk a look for anything unusual. Thanks, Bradley ------ Rails Machine Simplified Ruby on Rails application deployment http://railsmachine.com From rsaccon at gmail.com Fri May 5 09:45:00 2006 From: rsaccon at gmail.com (Roberto Saccon) Date: Fri, 5 May 2006 10:45:00 -0300 Subject: [Mongrel] problem setting up mongrel_cluster 0.1.1 In-Reply-To: <3D45E95F-F810-4B9B-97E4-1262D6D020BD@railsmachine.com> References: <22013A76-5917-41D5-AD48-8AB3C9B0E2F7@railsmachine.com> <3D45E95F-F810-4B9B-97E4-1262D6D020BD@railsmachine.com> Message-ID: Bradley, thanks for the example. A new day and a new look at my code relvealed that I was using deploy_to before setting it... works like a charm now .. On 5/5/06, bradley taylor wrote: > > Hi Roberto: > > > > > Bradley, can you show a simple, but working example of what needs > > to be configured at the develpment machine and what needs to be > > done at the production machine (if anything at all) ? Then I > > hopefullyI can figure out what I am doing wrong. > > ***deploy.rb*** > > require 'mongrel_cluster/recipes' > > role :web, "10.0.1.5" > role :app, "10.0.1.5" > role :db, "10.0.1.5", :primary => true > > set :application, "animal_shelter" > > set :deploy_to, "/var/apps/#{application}" # /var/apps/ is owned by > deploy > set :user, "deploy" > set :repository, "your_repository_here" > set :use_sudo, false > > *** server *** > No configuration needed. > > *** dev machine *** > First deployment: > cap -a setup > cap -a configure_mongrel_cluster > cap -a cold_deploy > > Subsequent deployments: > svn commit -m "more software" > cap -a deploy > > > > ok, I uninstalled 0.1 to make absolutely sure that 0.1.1 is running > > and did all configuration steps again and now it even got worse: > > after deploying the "current" symlink points to a nonexistent > > "config". > > > > By default the config file is written to deploy_to/config. It looks > like your deploy_to variable contains "current" as > configure_mongrel_cluster writes to deploy_to/config/ > mongrel_cluster.yml. deploy_to should be the root directory of your > deployment. > > Feel free to send me a censored version of your deploy.rb and I'll > talk a look for anything unusual. > > Thanks, > Bradley > > ------ > Rails Machine > Simplified Ruby on Rails application deployment > http://railsmachine.com > > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > -- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060505/fb2311ed/attachment.htm From hutch at recursive.ca Sun May 7 10:18:19 2006 From: hutch at recursive.ca (Bob Hutchison) Date: Sun, 7 May 2006 10:18:19 -0400 Subject: [Mongrel] Installing on OS X Message-ID: <77AF3B7B-3B48-43D1-87BF-2ED87C6E9CFF@recursive.ca> Hi, I've just installed Mongrel 3.12.4 on OS X, and had one little difficulty: I kept getting an error message saying that HTTPHandler didn't exist, maybe it was Mongrel, I don't remember. Turns out that there was a lot more missing than that, so it doesn't really matter. What was happening is that http11 was not installing and the "require 'http11'" failed silently, and so the loading of mongrel.rb didn't load completely (it stopped at that require). Http11 was not loading because there is no 'ginstall' on my machine, it is called 'install', and it is in a different place than expected. Anyway, fixing that up in the Makefile, running 'make clean', then 'make', then 'make install' and the http11.bundle was installed properly. Another little detail, there is a problem in Ruby compiling with any optimisation level other than -O0 or -O1 on OS X it is a gcc4 issue I believe. I have no idea if this makes any difference for Mongrel, but it might. Cheers, Bob ---- Bob Hutchison -- blogs at Recursive Design Inc. -- Raconteur -- xampl for Ruby -- From hutch at recursive.ca Sun May 7 11:51:42 2006 From: hutch at recursive.ca (Bob Hutchison) Date: Sun, 7 May 2006 11:51:42 -0400 Subject: [Mongrel] Character Encoding Message-ID: <46BA404A-D4B2-4444-8CBE-0A00D158522A@recursive.ca> Hi, I'm sure I'm doing something dumb, but... I have an application that dynamically produces UTF8 encoded html exclusively. This application works using webrick without a problem. When using Mongrel 3.12.4 it looks as though the encoding is lost and garbage appears on the string. I suppose this could also be a double encoding, but personally, I can't tell the difference by looking :-) Is there something I have to do that's different when producing UTF8 html in Mongrel? Cheers, Bob ---- Bob Hutchison -- blogs at Recursive Design Inc. -- Raconteur -- xampl for Ruby -- From straightflush at gmail.com Sun May 7 20:38:05 2006 From: straightflush at gmail.com (Adam Denenberg) Date: Sun, 7 May 2006 20:38:05 -0400 Subject: [Mongrel] how many mongrel daemons to launch Message-ID: What is the best way to determine how many mongrel daemons to launch ? right now i started with 2 under apache 2.2 with mod_proxy_balancer, but not sure how to best determine the appropriate number. adam -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060507/1640bbf8/attachment.htm From zedshaw at zedshaw.com Mon May 8 01:29:53 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Mon, 08 May 2006 01:29:53 -0400 Subject: [Mongrel] Character Encoding In-Reply-To: <46BA404A-D4B2-4444-8CBE-0A00D158522A@recursive.ca> References: <46BA404A-D4B2-4444-8CBE-0A00D158522A@recursive.ca> Message-ID: <445ED751.2010105@zedshaw.com> Hey Bob, Trying out thunderbird so let me know how this message turns out. It claims to have generated my pgp key but looks like that it's not quite the right one. Anyway, the main problem might be the default encoding setting for default content. Try forcing the response Content-type header to have the proper content type setting. Otherwise I'm not quite sure how you'd even turn on utf8 in ruby? If you can help me get a test case up and running then i'll try and put that into the mongrel test suite and figure out why it's not returning the right stuff. Zed Bob Hutchison wrote: > Hi, > > I'm sure I'm doing something dumb, but... > > I have an application that dynamically produces UTF8 encoded html > exclusively. This application works using webrick without a problem. > When using Mongrel 3.12.4 it looks as though the encoding is lost and > garbage appears on the string. I suppose this could also be a double > encoding, but personally, I can't tell the difference by looking :-) > > Is there something I have to do that's different when producing UTF8 > html in Mongrel? > > Cheers, > Bob > > ---- > Bob Hutchison -- blogs at hutch/> > Recursive Design Inc. -- > Raconteur -- > xampl for Ruby -- > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > > From schoenm at earthlink.net Mon May 8 03:51:58 2006 From: schoenm at earthlink.net (Michael A. Schoen) Date: Mon, 08 May 2006 00:51:58 -0700 Subject: [Mongrel] [ANN] mongrel_cluster-0.1.1: the bird dog (capistrano support!) In-Reply-To: <5C7DCE19-999A-4711-829C-1095F652B9CF@railsmachine.com> References: <5C7DCE19-999A-4711-829C-1095F652B9CF@railsmachine.com> Message-ID: <445EF89E.1050407@earthlink.net> 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. From hutch at recursive.ca Mon May 8 07:57:52 2006 From: hutch at recursive.ca (Bob Hutchison) Date: Mon, 8 May 2006 07:57:52 -0400 Subject: [Mongrel] Character Encoding In-Reply-To: <445ED751.2010105@zedshaw.com> References: <46BA404A-D4B2-4444-8CBE-0A00D158522A@recursive.ca> <445ED751.2010105@zedshaw.com> Message-ID: <2CDEE5B1-E782-4AF6-88D1-439BA49E6BDB@recursive.ca> Hi Zed, Your message seems to have come through just fine, and it looks as I imagine you intended it to look. I've bee playing around with this a bit and tried something this morning, if I add the following: meta tag to the page it works. Simple. For whatever reason, just setting the header content type didn't work. A couple of comments on this. First, I knew this was necessary from working over the years. I didn't realise I wasn't doing it. For some reason, when webrick serves the page without the tag it works, when mongrel serves the page it doesn't. I've found not thinking too hard about unicode the best strategy :-) To use UTF8 all you have to do is set $KCODE to 'u' and require jcode. See: I've had no problems (fewer than in, say, Java -- there is something seriously wrong with the combo of unicode, Java 1.4, and linux) as long as I don't think about it too much (like I said above). The only oddity is that character count is no longer synonymous with byte count, so sometimes the size method isn't what you want -- this isn't too surprising. BTW, Mongrel is working beautifully for me. Nice speedup, and I like the stuff you did w.r.t. administration. It is also kind of cool how you can switch between Mongrel and Webrick with a Control-C and a restart :-) Cheers, Bob On May 8, 2006, at 1:29 AM, Zed Shaw wrote: > Hey Bob, > > Trying out thunderbird so let me know how this message turns out. It > claims to have generated my pgp key but looks like that it's not quite > the right one. > > Anyway, the main problem might be the default encoding setting for > default content. Try forcing the response Content-type header to have > the proper content type setting. > > Otherwise I'm not quite sure how you'd even turn on utf8 in ruby? If > you can help me get a test case up and running then i'll try and put > that into the mongrel test suite and figure out why it's not returning > the right stuff. > > Zed > > Bob Hutchison wrote: >> Hi, >> >> I'm sure I'm doing something dumb, but... >> >> I have an application that dynamically produces UTF8 encoded html >> exclusively. This application works using webrick without a problem. >> When using Mongrel 3.12.4 it looks as though the encoding is lost and >> garbage appears on the string. I suppose this could also be a double >> encoding, but personally, I can't tell the difference by looking :-) >> >> Is there something I have to do that's different when producing UTF8 >> html in Mongrel? >> >> Cheers, >> Bob >> >> ---- >> Bob Hutchison -- blogs at > hutch/> >> Recursive Design Inc. -- >> Raconteur -- >> xampl for Ruby -- > xampl/> >> >> >> >> _______________________________________________ >> Mongrel-users mailing list >> Mongrel-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/mongrel-users >> >> > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users ---- Bob Hutchison -- blogs at Recursive Design Inc. -- Raconteur -- xampl for Ruby -- From wrighty at gmail.com Mon May 8 10:58:27 2006 From: wrighty at gmail.com (Paul Wright) Date: Mon, 8 May 2006 15:58:27 +0100 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS Message-ID: <282e72050605080758q614192d4ga312c54f513b9a59@mail.gmail.com> Hi all, I'm currently trying to get Mongrel running my app whilst fronted by apache 2.2 in a sub-directory via https. A bit convoluted I'll grant you but necessitated by existing systems. The pertinent parts of my httpd.conf: #historic choice of random port number DocumentRoot /var/www/admin ServerName admin.example.com:12345 ProxyPass /rails balancer://proxy_group ProxyPassReverse /rails balancer://proxy_group BalancerMember http://127.0.0.1:3000 BalancerMember http://127.0.0.1:3001 SSLEngine on ... ssl config continues ... I've seen in a few places [1][2] that the trailing slash is important on the ProxyPass directive but if I include that then I get a BAD CLIENT error in mongrel due to too many slashes: BAD CLIENT (127.0.0.1): Invalid HTTP format, parsing fails. REQUEST DATA: GET //admin/list_returns HTTP/1.1 The two main problems I have now is that all rendered links are missing the sub-directory and if any redirects are issued then they are for http://admin.example.com:12345/ instead of the ssl version https://admin.example.com:12345/ - is this because mongrel/rails is only seeing a http request? And if so is it possible to let the app know that it's actually https and in a subdirectory? Paul. Mongrel version: 0.3.12.4 Server version: Apache/2.2.2 [1] - http://textsnippets.com/posts/show/400 [2] - http://blog.innerewut.de/articles/2006/04/21/scaling-rails-with-apache-2-2-mod_proxy_balancer-and-mongrel From bradley at railsmachine.com Mon May 8 11:10:06 2006 From: bradley at railsmachine.com (bradley taylor) Date: Mon, 8 May 2006 11:10:06 -0400 Subject: [Mongrel] [ANN] mongrel_cluster-0.1.1: the bird dog (capistrano support!) In-Reply-To: <445EF89E.1050407@earthlink.net> References: <5C7DCE19-999A-4711-829C-1095F652B9CF@railsmachine.com> <445EF89E.1050407@earthlink.net> Message-ID: <998D821A-9E1C-4619-B480-3A0990C09E51@railsmachine.com> 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 From zedshaw at zedshaw.com Mon May 8 13:57:12 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Mon, 08 May 2006 13:57:12 -0400 Subject: [Mongrel] Installing on OS X In-Reply-To: <77AF3B7B-3B48-43D1-87BF-2ED87C6E9CFF@recursive.ca> References: <77AF3B7B-3B48-43D1-87BF-2ED87C6E9CFF@recursive.ca> Message-ID: <1147111033.20000.5.camel@localhost.localdomain> Hi Bob, On Sun, 2006-05-07 at 10:18 -0400, Bob Hutchison wrote: > Hi, > > I've just installed Mongrel 3.12.4 on OS X, and had one little > difficulty: I kept getting an error message saying that HTTPHandler > didn't exist, maybe it was Mongrel, I don't remember. Turns out that > there was a lot more missing than that, so it doesn't really matter. > Yes, this is a really common problem with how rubygems compiles extensions. It should fail when it can't compile http11, but instead just keeps going. > What was happening is that http11 was not installing and the "require > 'http11'" failed silently, and so the loading of mongrel.rb didn't > load completely (it stopped at that require). > > Http11 was not loading because there is no 'ginstall' on my machine, > it is called 'install', and it is in a different place than expected. > Anyway, fixing that up in the Makefile, running 'make clean', then > 'make', then 'make install' and the http11.bundle was installed > properly. > Ah, I wonder if it's distributing the Makefile from my system. I'll check that out. > Another little detail, there is a problem in Ruby compiling with any > optimisation level other than -O0 or -O1 on OS X it is a gcc4 issue I > believe. I have no idea if this makes any difference for Mongrel, but > it might. > Yes, and actually it's mostly a problem on the PPC platform. I solved it by switching to the gcc 3.3 version and haven't had any issues since. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Mon May 8 14:00:34 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Mon, 08 May 2006 14:00:34 -0400 Subject: [Mongrel] Character Encoding In-Reply-To: <2CDEE5B1-E782-4AF6-88D1-439BA49E6BDB@recursive.ca> References: <46BA404A-D4B2-4444-8CBE-0A00D158522A@recursive.ca> <445ED751.2010105@zedshaw.com> <2CDEE5B1-E782-4AF6-88D1-439BA49E6BDB@recursive.ca> Message-ID: <1147111234.20000.10.camel@localhost.localdomain> On Mon, 2006-05-08 at 07:57 -0400, Bob Hutchison wrote: > Hi Zed, > > I've bee playing around with this a bit and tried something this > morning, if I add the following: > > > > meta tag to the page it works. Simple. For whatever reason, just > setting the header content type didn't work. > Ah, by default I think Rails returns just a "text/html" content type. Mongrel doesn't have anything to do with the content type of the returned stuff unless it doesn't know the type of a file. Two things you can do: 1) Create a mime.yaml and put an alternative content type in it for text/html. Then tell mongrel to use this configuration file. You could probably steal lots of mime types from apache. 2) Make sure that rails is setting the ; utf-8 ending on all the content you need to be utf-8. I think the first one will actually solve your problem,especially if you have page caching on. > BTW, Mongrel is working beautifully for me. Nice speedup, and I like > the stuff you did w.r.t. administration. It is also kind of cool how > you can switch between Mongrel and Webrick with a Control-C and a > restart :-) Very nice. Let me know if you run into any more weirdness. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From francois.beausoleil at gmail.com Tue May 9 09:34:33 2006 From: francois.beausoleil at gmail.com (Francois Beausoleil) Date: Tue, 9 May 2006 09:34:33 -0400 Subject: [Mongrel] Warnings during compilation Message-ID: <41d5fadf0605090634p107fa8aiab1d574b3216e06c@mail.gmail.com> Hello everyone ! Just wondering if it's only me or if everyone gets these: Building native extensions. This could take a while...http11.c: In function `header_done':http11.c:125: warning: unused variable `host'http11.c:126: warning: unused variable `port'http11.c: At top level:http11.c:26: warning: `global_interface_value' defined but not used This is installing 0.3.12.4. Bye !--Fran?ois Beausoleilhttp://blog.teksol.info/ From zedshaw at zedshaw.com Tue May 9 15:12:57 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Tue, 09 May 2006 15:12:57 -0400 Subject: [Mongrel] Warnings during compilation In-Reply-To: <41d5fadf0605090634p107fa8aiab1d574b3216e06c@mail.gmail.com> References: <41d5fadf0605090634p107fa8aiab1d574b3216e06c@mail.gmail.com> Message-ID: <1147201977.1938.1.camel@localhost.localdomain> On Tue, 2006-05-09 at 09:34 -0400, Francois Beausoleil wrote: > Hello everyone ! > Just wondering if it's only me or if everyone gets these: > Building native extensions. This could take a while...http11.c: In function `header_done':http11.c:125: warning: unused variable `host'http11.c:126: warning: unused variable `port'http11.c: At top level:http11.c:26: warning: `global_interface_value' defined but not used > This is installing 0.3.12.4. > Bye !--Fran?ois Beausoleilhttp://blog.teksol.info/ > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users On the list now: http://rubyforge.org/tracker/index.php?func=detail&aid=4407&group_id=1306&atid=5148 Anyone else with requests, please send them to the list or put them in the tracker. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Tue May 9 16:19:09 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Tue, 09 May 2006 16:19:09 -0400 Subject: [Mongrel] Mongrel 0.4 Coming Soon! Get Your Requests In By Friday! Message-ID: <1147205949.1938.7.camel@localhost.localdomain> Hello folks, I've been kind of away working for the last few weeks, and now I'm back to try and push out the big 0.4 release. I've collected all the problems and requests people have come up with and talked with Luis about some enhancements. We're planning to revamp the win32 setup so that it cleans up the scripts to be just one mongrel_rails script. We've also got lots of tickets created for all the niggling little problems people encounter: http://rubyforge.org/tracker/?group_id=1306 I'd really like everyone to hit that page and put in anything you have problems with or anything you want. Especially important is documentation you think is needed. I want to get this all collected by Friday so I can prioritize them and then start working on it for the big release. Thanks for your help. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Tue May 9 16:23:07 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Tue, 09 May 2006 16:23:07 -0400 Subject: [Mongrel] Mongrel Pre-Release Bravery Message-ID: <1147206188.1938.13.camel@localhost.localdomain> Hi Everyone, Another note that there's a pre-release available for non-win32 platforms that I'd like people to test out. As usual you can install it with: gem install daemons (if you don't have this) gem install mongrel --source=http://mongrel.rubyforge.org/releases/ This release adds some fantastic file management gear from why the lucky stiff and Dan Kubb. Why has added nice sendfile support and implemented streaming uploaded files to a tmp file rather than into memory. If you're doing a site with uploads and downloads this release will really help. Dan Kubb implemented conditional responses for files. What this does is properly implement the if-modified-since semantics. This makes Mongrel much much faster for mostly static sites. Luis and I will be testing this stuff out on windows very soon and should be getting this released this weekend. The release after this will have a revamped win32 setup and will be the official 0.4 "Enterprisey Edition". -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From straightflush at gmail.com Tue May 9 19:53:43 2006 From: straightflush at gmail.com (Adam Denenberg) Date: Tue, 9 May 2006 19:53:43 -0400 Subject: [Mongrel] slow first connect Message-ID: I was hoping to remove this issue that I had with FCGI, but it seems to happen with mongrel as well. the first connection appears to be really really slow. is this normal behavior, and is there a way to avoid it? thanks adam -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060509/7f06d6c3/attachment.htm From thorin at gmail.com Tue May 9 20:58:50 2006 From: thorin at gmail.com (Curtis Spencer) Date: Tue, 9 May 2006 17:58:50 -0700 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS References: <282e72050605080758q614192d4ga312c54f513b9a59@mail.gmail.com> Message-ID: I would actually like to see an answer to this as well. Any redirect sent from behind ssl results in going to the http url. Any ideas? Thanks, Curtis On 2006-05-08 07:58:27 -0700, "Paul Wright" said: > Hi all, > > I'm currently trying to get Mongrel running my app whilst fronted by > apache 2.2 in a sub-directory via https. A bit convoluted I'll grant > you but necessitated by existing systems. > > The pertinent parts of my httpd.conf: > > #historic choice of random port number > > DocumentRoot /var/www/admin > ServerName admin.example.com:12345 > > ProxyPass /rails balancer://proxy_group > ProxyPassReverse /rails balancer://proxy_group > > > BalancerMember http://127.0.0.1:3000 > BalancerMember http://127.0.0.1:3001 > > > SSLEngine on > ... > ssl config continues > ... > > > I've seen in a few places [1][2] that the trailing slash is important > on the ProxyPass directive but if I include that then I get a BAD > CLIENT error in mongrel due to too many slashes: > > BAD CLIENT (127.0.0.1): Invalid HTTP format, parsing fails. > REQUEST DATA: GET //admin/list_returns HTTP/1.1 > > The two main problems I have now is that all rendered links are > missing the sub-directory and if any redirects are issued then they > are for http://admin.example.com:12345/ instead of the ssl version > https://admin.example.com:12345/ - is this because mongrel/rails is > only seeing a http request? And if so is it possible to let the app > know that it's actually https and in a subdirectory? > > Paul. > > Mongrel version: 0.3.12.4 > Server version: Apache/2.2.2 > > [1] - http://textsnippets.com/posts/show/400 > [2] - > http://blog.innerewut.de/articles/2006/04/21/scaling-rails-with-apache-2-2-mod_proxy_balancer-and-mongrel > From zedshaw at zedshaw.com Tue May 9 22:01:42 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Tue, 09 May 2006 22:01:42 -0400 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS In-Reply-To: <282e72050605080758q614192d4ga312c54f513b9a59@mail.gmail.com> References: <282e72050605080758q614192d4ga312c54f513b9a59@mail.gmail.com> Message-ID: <1147226502.5626.12.camel@localhost.localdomain> On Mon, 2006-05-08 at 15:58 +0100, Paul Wright wrote: > Hi all, > > I've seen in a few places [1][2] that the trailing slash is important > on the ProxyPass directive but if I include that then I get a BAD > CLIENT error in mongrel due to too many slashes: > This is really weird that you have to add the //. That type of URL is rejected because it violates the actual URI grammar (from what I understand of it). If balancer needs this, then I'm curious why it's bleeding that // to the backend. I'll check it out to find out why this is the accepted wisdom. > The two main problems I have now is that all rendered links are > missing the sub-directory and if any redirects are issued then they > are for http://admin.example.com:12345/ instead of the ssl version > https://admin.example.com:12345/ - is this because mongrel/rails is > only seeing a http request? And if so is it possible to let the app > know that it's actually https and in a subdirectory? I'll have to look at this. It might be that mongrel will have to detect that the request was secured and add the https, but I really think Rails should do this since this is where the redirect is generated. Take a look at the headers that Mongrel receives and see if you are getting the header that indicates the request was secured. If you are then Rails must not be honoring it. If not then you need to tell your web server to start sending it. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From gabriel.falkenberg at fek.uu.se Wed May 10 04:30:41 2006 From: gabriel.falkenberg at fek.uu.se (Gabriel Falkenberg) Date: Wed, 10 May 2006 10:30:41 +0200 Subject: [Mongrel] Problems starting mongrel running a rails app as a service Message-ID: <000001c6740c$05c11f90$bfafee82@ekonomikum.uu.local> Hi there I have a rails app that I want to run on a Win 2k server running Mongrel. I've downloaded the latest version and the win32-service gem and can run it with the mongrel_rails start -d command When I try to start the same app installed as a service I get the following error: "There was a problem starting the service: The service did not respond to the start or control request in a timely fashion." The debug.log isn't even created. These are the commands I have issued: $ mongrel_rails_service install -n intrarails -d "New intranet" -r c:\rails\intra -e production -p 3000 $ mongrel_rails_service start -n intrarails When I go into the Services-application I can see that the service is trying to start the app with this command: "c:/ruby/bin/ruby.exe" "c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4-mswin32/bin/mongrel_rails_s vc" service -r "c:/rails/intra" -e production -p 3000 I've checked the paths and they are all correct. Does anyone have any idea of what's wrong? Is there a verbose mode I can activate to get more debug output? Gabriel Falkenberg From luislavena at gmail.com Wed May 10 09:51:34 2006 From: luislavena at gmail.com (Luis Lavena) Date: Wed, 10 May 2006 10:51:34 -0300 Subject: [Mongrel] Problems starting mongrel running a rails app as a service In-Reply-To: <000001c6740c$05c11f90$bfafee82@ekonomikum.uu.local> References: <000001c6740c$05c11f90$bfafee82@ekonomikum.uu.local> Message-ID: <71166b3b0605100651m79dad655ted7a27df4dc6c99b@mail.gmail.com> Hello Gabriel, have you tried first running plain mongrel_rails without the -d option? That will lock your console to the output generate by the running rails, but is very useful for debug purposes. Try that and if it works, something is wrong in the service stuff. Currently the -d (daemonize) is not available on win32. Later, Luis On 5/10/06, Gabriel Falkenberg wrote: > Hi there > > I have a rails app that I want to run on a Win 2k server running Mongrel. > I've downloaded the latest version and the win32-service gem and can run it > with the mongrel_rails start -d command > > When I try to start the same app installed as a service I get the following > error: > > "There was a problem starting the service: > The service did not respond to the start or control request in a timely > fashion." > > The debug.log isn't even created. These are the commands I have issued: > > $ mongrel_rails_service install -n intrarails -d "New intranet" -r > c:\rails\intra -e production -p 3000 > $ mongrel_rails_service start -n intrarails > > When I go into the Services-application I can see that the service is trying > to start the app with this command: > > "c:/ruby/bin/ruby.exe" > "c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4-mswin32/bin/mongrel_rails_s > vc" service -r "c:/rails/intra" -e production -p 3000 > > I've checked the paths and they are all correct. > > Does anyone have any idea of what's wrong? Is there a verbose mode I can > activate to get more debug output? > > Gabriel Falkenberg > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > From wrighty at gmail.com Wed May 10 10:01:33 2006 From: wrighty at gmail.com (Paul Wright) Date: Wed, 10 May 2006 15:01:33 +0100 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS In-Reply-To: <1147226502.5626.12.camel@localhost.localdomain> References: <282e72050605080758q614192d4ga312c54f513b9a59@mail.gmail.com> <1147226502.5626.12.camel@localhost.localdomain> Message-ID: <282e72050605100701m3bb8dfao5cd9dc0fd05b8c60@mail.gmail.com> On 10/05/06, Zed Shaw wrote: > On Mon, 2006-05-08 at 15:58 +0100, Paul Wright wrote: > > Hi all, > > > > > > I've seen in a few places [1][2] that the trailing slash is important > > on the ProxyPass directive but if I include that then I get a BAD > > CLIENT error in mongrel due to too many slashes: > > > This is really weird that you have to add the //. That type of URL is > rejected because it violates the actual URI grammar (from what I > understand of it). If balancer needs this, then I'm curious why it's > bleeding that // to the backend. > > I'll check it out to find out why this is the accepted wisdom. I personally don't have to add the trailing slash to the setup and, after going back over the places I saw it mentioned only one of them claimed it needed to be there. The other was warning against it. So just discard the above. I think. > > The two main problems I have now is that all rendered links are > > missing the sub-directory and if any redirects are issued then they > > are for http://admin.example.com:12345/ instead of the ssl version > > https://admin.example.com:12345/ - is this because mongrel/rails is > > only seeing a http request? And if so is it possible to let the app > > know that it's actually https and in a subdirectory? > > I'll have to look at this. It might be that mongrel will have to detect > that the request was secured and add the https, but I really think Rails > should do this since this is where the redirect is generated. > > Take a look at the headers that Mongrel receives and see if you are > getting the header that indicates the request was secured. If you are > then Rails must not be honoring it. If not then you need to tell your > web server to start sending it. Having run mongrel in debug mode I've looked at the headers and there's nothing there to suggest that Apache has proxied a https connection. Looking through the Rails source[1] I see that there are two situations where Rails will generate https links 153 def ssl? 154 @env['HTTPS'] == 'on' || @env['HTTP_X_FORWARDED_PROTO'] == 'https' 155 end I had thought that I could used the [E=VAR:VAL] flag on a Rewrite rule but then I remembered that we're proxying to an independant http server (mongrel) so it wouldn't make it across. I've got it working by adding RequestHeader directive to my Rewrite rules: RewriteEngine On # Punt any pontential 404s to the proxy RewriteCond %{REQUEST_FILENAME} ^/rails/.* RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RequestHeader set X_FORWARDED_PROTO 'https' RewriteRule ^/rails/(.*)$ balancer://proxy_group/$1 [proxy] (I don't know apache well enough to know whether the RequestHeader will fire only apply when the RewriteCond or for every request to this VirtualHost but I'm confident it won't hurt non-rails requests.) All that's left now is working out how to set the environment variable RAILS_RELATIVE_URL_ROOT... Any clues? Paul. [1] - http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_controller/request.rb From joshmh at gmail.com Wed May 10 10:28:51 2006 From: joshmh at gmail.com (Joshua Harvey) Date: Wed, 10 May 2006 16:28:51 +0200 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS In-Reply-To: <282e72050605100701m3bb8dfao5cd9dc0fd05b8c60@mail.gmail.com> References: <282e72050605080758q614192d4ga312c54f513b9a59@mail.gmail.com> <1147226502.5626.12.camel@localhost.localdomain> <282e72050605100701m3bb8dfao5cd9dc0fd05b8c60@mail.gmail.com> Message-ID: <3527dd260605100728l5a9743b2nc1ac3eac30392e58@mail.gmail.com> Paul wrote: Looking through the Rails source[1] I see that there are > two situations where Rails will generate https links > > 153 def ssl? > 154 @env['HTTPS'] == 'on' || @env['HTTP_X_FORWARDED_PROTO'] == > 'https' > 155 end > > I had thought that I could used the [E=VAR:VAL] flag on a Rewrite rule > but then I remembered that we're proxying to an independant http > server (mongrel) so it wouldn't make it across. I've got it working > by adding RequestHeader directive to my Rewrite rules: > Does anybody know under what conditions Apache sets these environment variables? Should Mongrel set one of these variables if the protocol is https, or is it too late to make that call by the time it gets to Mongrel, since Mongrel can't guarantee that the request was sent over SSL? Josh http://shnoo.gr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060510/fe7e1c54/attachment.htm From jeremy at jthopple.com Wed May 10 10:38:54 2006 From: jeremy at jthopple.com (Jeremy Hopple) Date: Wed, 10 May 2006 08:38:54 -0600 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS In-Reply-To: <282e72050605100701m3bb8dfao5cd9dc0fd05b8c60@mail.gmail.com> References: <282e72050605080758q614192d4ga312c54f513b9a59@mail.gmail.com> <1147226502.5626.12.camel@localhost.localdomain> <282e72050605100701m3bb8dfao5cd9dc0fd05b8c60@mail.gmail.com> Message-ID: Just out of curiosity, have you tried proxying your requests from Apache to Mongrel without using the Proxy Balancer? In other words, taking the balancer out of the equation by just: ProxyPass /rails http://localhost:3000/ Granted I'm not using SSL, but I am in the process of setting up Apache/mod_proxy/Mongrel and everything works great if I just do a direct ProxyPass. When I try to use the balancer things go haywire... I don't have any answers, I just read your post and noticed that you were using the balancer and having problems. Removing the balancer from the setup might be an interesting troubleshooting exercise... Jeremy On 5/10/06, Paul Wright wrote: > > On 10/05/06, Zed Shaw wrote: > > On Mon, 2006-05-08 at 15:58 +0100, Paul Wright wrote: > > > Hi all, > > > > > > > > > > I've seen in a few places [1][2] that the trailing slash is important > > > on the ProxyPass directive but if I include that then I get a BAD > > > CLIENT error in mongrel due to too many slashes: > > > > > This is really weird that you have to add the //. That type of URL is > > rejected because it violates the actual URI grammar (from what I > > understand of it). If balancer needs this, then I'm curious why it's > > bleeding that // to the backend. > > > > I'll check it out to find out why this is the accepted wisdom. > > I personally don't have to add the trailing slash to the setup and, > after going back over the places I saw it mentioned only one of them > claimed it needed to be there. The other was warning against it. So > just discard the above. I think. > > > > The two main problems I have now is that all rendered links are > > > missing the sub-directory and if any redirects are issued then they > > > are for http://admin.example.com:12345/ instead of the ssl version > > > https://admin.example.com:12345/ - is this because mongrel/rails is > > > only seeing a http request? And if so is it possible to let the app > > > know that it's actually https and in a subdirectory? > > > > I'll have to look at this. It might be that mongrel will have to detect > > that the request was secured and add the https, but I really think Rails > > should do this since this is where the redirect is generated. > > > > Take a look at the headers that Mongrel receives and see if you are > > getting the header that indicates the request was secured. If you are > > then Rails must not be honoring it. If not then you need to tell your > > web server to start sending it. > > Having run mongrel in debug mode I've looked at the headers and > there's nothing there to suggest that Apache has proxied a https > connection. Looking through the Rails source[1] I see that there are > two situations where Rails will generate https links > > 153 def ssl? > 154 @env['HTTPS'] == 'on' || @env['HTTP_X_FORWARDED_PROTO'] == > 'https' > 155 end > > I had thought that I could used the [E=VAR:VAL] flag on a Rewrite rule > but then I remembered that we're proxying to an independant http > server (mongrel) so it wouldn't make it across. I've got it working > by adding RequestHeader directive to my Rewrite rules: > > RewriteEngine On > # Punt any pontential 404s to the proxy > RewriteCond %{REQUEST_FILENAME} ^/rails/.* > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RequestHeader set X_FORWARDED_PROTO 'https' > RewriteRule ^/rails/(.*)$ balancer://proxy_group/$1 [proxy] > > (I don't know apache well enough to know whether the RequestHeader > will fire only apply when the RewriteCond or for every request to this > VirtualHost but I'm confident it won't hurt non-rails requests.) > > All that's left now is working out how to set the environment variable > RAILS_RELATIVE_URL_ROOT... Any clues? > > Paul. > > [1] - > http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_controller/request.rb > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060510/da1cdaa0/attachment.htm From kevwil at gmail.com Wed May 10 10:52:16 2006 From: kevwil at gmail.com (Kevin Williams) Date: Wed, 10 May 2006 08:52:16 -0600 Subject: [Mongrel] mongrel vs. scgi Message-ID: <683a886f0605100752n3caec69dia02383261b15ab56@mail.gmail.com> I've liked the scgi runner ever since it came out. I like the way it'scontrolled, the way it's clusterable, and the fact that it runs onwin32 platforms so easily. Now it's May 2006, and the scgi runner hasn't changed since October,and now we have mongrel. I keep seeing hints of clustering in mongrel,as well. I just downloaded the win32 installer for Apache 2.2.2 also,so I should be able to use the new proxy stuff as well. OK, now we'retalkin'. So, which is better? Which is more stable? Which is more scalable?Will mongrel be as cross-platform stable as scgi has proven to be?Which platform is more likely to handle 20+ million dynamic pages perday - mod_scgi + clustered scgi runners, or apache 2.2 proxy and afarm (pack?) of mongrels? --Cheers, Kevin From gabriel.falkenberg at fek.uu.se Wed May 10 11:02:44 2006 From: gabriel.falkenberg at fek.uu.se (Gabriel Falkenberg) Date: Wed, 10 May 2006 17:02:44 +0200 Subject: [Mongrel] Problems starting mongrel running a rails app as aservice In-Reply-To: <71166b3b0605100651m79dad655ted7a27df4dc6c99b@mail.gmail.com> Message-ID: <000d01c67442$cacddb30$bfafee82@ekonomikum.uu.local> > Hello Gabriel, > > have you tried first running plain mongrel_rails without the -d option? Yes, they both work with the difference that with -d it prints a message stating that -d isn't supported on Windows which I guess the service-stuff is supposed to make up for. I'm gonna try to make a minimal daemon that I can install as a service on my client-machine to see if I can also get it to work on the server. If I can make that work then maybe I can make mongrel work on the server too. /Gabriel Falkenberg From wrighty at gmail.com Wed May 10 11:24:14 2006 From: wrighty at gmail.com (Paul Wright) Date: Wed, 10 May 2006 16:24:14 +0100 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS In-Reply-To: <282e72050605100701m3bb8dfao5cd9dc0fd05b8c60@mail.gmail.com> References: <282e72050605080758q614192d4ga312c54f513b9a59@mail.gmail.com> <1147226502.5626.12.camel@localhost.localdomain> <282e72050605100701m3bb8dfao5cd9dc0fd05b8c60@mail.gmail.com> Message-ID: <282e72050605100824t71421484qb6ff246f757cf079@mail.gmail.com> On 10/05/06, Paul Wright wrote: > All that's left now is working out how to set the environment variable > RAILS_RELATIVE_URL_ROOT... Any clues? Just in case anyone else is following along, I found the solution to be to add the following line to the top of my config/routes.rb above everything else: ActionController::AbstractRequest.relative_url_root = "/rails" And then alter my apache config to look like this: RewriteEngine On # Punt any pontential 404s to the proxy RewriteCond %{REQUEST_FILENAME} ^/rails/.* RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RequestHeader set X_FORWARDED_PROTO 'https' RewriteRule ^/(.*)$ balancer://proxy_group/$1 [proxy] Thus the full request_filename is given to mongrel (including the preceeding /rails/) and it knows what to do with it because of the additional line in routes.rb. Cheers for the suggestions, Paul. From luislavena at gmail.com Wed May 10 11:58:21 2006 From: luislavena at gmail.com (Luis Lavena) Date: Wed, 10 May 2006 12:58:21 -0300 Subject: [Mongrel] Problems starting mongrel running a rails app as aservice In-Reply-To: <000d01c67442$cacddb30$bfafee82@ekonomikum.uu.local> References: <71166b3b0605100651m79dad655ted7a27df4dc6c99b@mail.gmail.com> <000d01c67442$cacddb30$bfafee82@ekonomikum.uu.local> Message-ID: <71166b3b0605100858i49127e8fqce57ba798ca10611@mail.gmail.com> Gabriel, If the service timeout during startup is because your application needs more time to initialize, something that found quite common with rails. To pinpoint if the problem is related to mongrel services or rails, please: Create a emtpy rails application. start mongrel for it, and check the webpage (the rails properties one). Then install the service and run it. If everything start and run ok, thre is something during the load of the controllers and models that hang or halt and raises that error. Thank you and regards, Luis On 5/10/06, Gabriel Falkenberg wrote: > > Hello Gabriel, > > > > have you tried first running plain mongrel_rails without the -d option? > > Yes, they both work with the difference that with -d it prints a message > stating that -d isn't supported on Windows which I guess the service-stuff > is supposed to make up for. > > I'm gonna try to make a minimal daemon that I can install as a service on my > client-machine to see if I can also get it to work on the server. If I can > make that work then maybe I can make mongrel work on the server too. > > /Gabriel Falkenberg > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > From Will_Green at URSCorp.com Wed May 10 12:59:07 2006 From: Will_Green at URSCorp.com (Will_Green at URSCorp.com) Date: Wed, 10 May 2006 12:59:07 -0400 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS In-Reply-To: Message-ID: So, Paul, do you have Apache do the asset (CSS,JS,image) serving? I'm trying your recipe, and the rails app works fine, but I get 404 errors for the assets. Here's my setup: httpd.conf BalancerMember http://127.0.0.1:8100 BalancerMember http://127.0.0.1:8101 BalancerMember http://127.0.0.1:8102 BalancerMember http://127.0.0.1:8103 BalancerMember http://127.0.0.1:8104 RewriteEngine On # Punt any pontential 404s to the proxy RewriteCond %{REQUEST_FILENAME} ^/timesheets/.* RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f # for HTTPS #RequestHeader set X_FORWARDED_PROTO 'https' RewriteRule ^/(.*)$ balancer://cyapm/$1 [proxy] And in /var/www/rails/cyapm/current/config/environments.rb (appended at the end): ActionController::AbstractRequest.relative_url_root = "/timesheets" If I connect directly to a mongrel, say http://ciwebdev:8100/, the Rails app lives at /timesheets, but the assets live in /stylesheets, /javascripts, /images. The links Rails generates now expects them to be in /timesheets/stylesheets, /timesheets/javascripts, /timesheets/images. Do you have any Rewrite magic for that? == Will Green Web Developer & IT Coordinator, URS Creative Imaging http://www.urscreativeimaging.com/ This e-mail and any attachments are confidential. If you receive this message in error or are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy the e-mail and any attachments or copies. From zedshaw at zedshaw.com Wed May 10 13:08:07 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Wed, 10 May 2006 13:08:07 -0400 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS In-Reply-To: <282e72050605100824t71421484qb6ff246f757cf079@mail.gmail.com> References: <282e72050605080758q614192d4ga312c54f513b9a59@mail.gmail.com> <1147226502.5626.12.camel@localhost.localdomain> <282e72050605100701m3bb8dfao5cd9dc0fd05b8c60@mail.gmail.com> <282e72050605100824t71421484qb6ff246f757cf079@mail.gmail.com> Message-ID: <1147280887.5688.1.camel@localhost.localdomain> On Wed, 2006-05-10 at 16:24 +0100, Paul Wright wrote: > On 10/05/06, Paul Wright wrote: > > All that's left now is working out how to set the environment variable > > RAILS_RELATIVE_URL_ROOT... Any clues? > > Just in case anyone else is following along, I found the solution to > be to add the following line to the top of my config/routes.rb above > everything else: > > ActionController::AbstractRequest.relative_url_root = "/rails" > > And then alter my apache config to look like this: > > RewriteEngine On > # Punt any pontential 404s to the proxy > RewriteCond %{REQUEST_FILENAME} ^/rails/.* > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RequestHeader set X_FORWARDED_PROTO 'https' > RewriteRule ^/(.*)$ balancer://proxy_group/$1 [proxy] > > Thus the full request_filename is given to mongrel (including the > preceeding /rails/) and it knows what to do with it because of the > additional line in routes.rb. Thanks Paul, this is great stuff. I'll be sure to include it in the deploying to apache documentation. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From wrighty at gmail.com Wed May 10 13:09:32 2006 From: wrighty at gmail.com (Paul Wright) Date: Wed, 10 May 2006 18:09:32 +0100 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS In-Reply-To: References: Message-ID: <282e72050605101009xd143095t60ca89fd83affcb9@mail.gmail.com> On 10/05/06, Will_Green at urscorp.com wrote: > So, Paul, do you have Apache do the asset (CSS,JS,image) serving? I'm > trying your recipe, and the rails app works fine, but I get 404 errors for > the assets. > > Here's my setup: > > httpd.conf > > > BalancerMember http://127.0.0.1:8100 > BalancerMember http://127.0.0.1:8101 > BalancerMember http://127.0.0.1:8102 > BalancerMember http://127.0.0.1:8103 > BalancerMember http://127.0.0.1:8104 > > > RewriteEngine On > # Punt any pontential 404s to the proxy > RewriteCond %{REQUEST_FILENAME} ^/timesheets/.* > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > # for HTTPS > #RequestHeader set X_FORWARDED_PROTO 'https' > RewriteRule ^/(.*)$ balancer://cyapm/$1 [proxy] > > And in /var/www/rails/cyapm/current/config/environments.rb (appended at the > end): > > ActionController::AbstractRequest.relative_url_root = "/timesheets" > > If I connect directly to a mongrel, say http://ciwebdev:8100/, the Rails > app lives at /timesheets, but the assets live in /stylesheets, > /javascripts, /images. The links Rails generates now expects them to be in > /timesheets/stylesheets, /timesheets/javascripts, /timesheets/images. > > Do you have any Rewrite magic for that? What I failed to mention is that for the setup we have here instead of having /public/ be the document root we instead have /rails/ be a symlink to the app's /public/ directory, thus the normal javascript files live in /rails/javascript/ for us and the generated URLs are right. We've got this setup so that rails stuff lives in it's own directory without touching any of the other parts of the web root. For an example of doing this without having the subdirectory issue check out this set of instructions - it's what I started out with and then butchered into the above config: http://blog.innerewut.de/articles/2006/04/21/scaling-rails-with-apache-2-2-mod_proxy_balancer-and-mongrel Paul. From zedshaw at zedshaw.com Wed May 10 13:37:37 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Wed, 10 May 2006 13:37:37 -0400 Subject: [Mongrel] mongrel vs. scgi In-Reply-To: <683a886f0605100752n3caec69dia02383261b15ab56@mail.gmail.com> References: <683a886f0605100752n3caec69dia02383261b15ab56@mail.gmail.com> Message-ID: <1147282658.5688.25.camel@localhost.localdomain> Hey Kevin, In general I try to steer people toward Mongrel for three reasons: 1) Mongrel is extensible. You can add your own handlers which is a major advancement over fastcgi and scgi. This lets you speed up actions which are too slow under rails by moving them out to Mongrel handlers, but it is more difficult. 2) SCGI hasn't been worked on (by me) in a while, and will most likely get a big clean-up soon. I've got limited bandwidth for projects, and Mongrel is getting real attention (and _cash_ :-) so that's where most of the innovation is going. I am going to keep SCGI alive since it's pure Ruby and there might be folks who just can't run Mongrel. 3) Mongrel is easier to deploy in most other environments. See, SCGI is great and all, but there's like 3 web servers that support that protocol and there's no decent load balancers, firewalls, proxies, etc. Mongrel is HTTP so it can be deployed on a cheese sandwich in the back of a truck (meaning anywhere). More answers below... On Wed, 2006-05-10 at 08:52 -0600, Kevin Williams wrote: > So, which is better? Right now I'd say Mongrel simply because it has better win32 support, is extensible with plugins and handlers, and it gets more attention from me. > Which is more stable? I'd say Mongrel is more stable because I do this "Iron Mongrel" thing where I give it regular code audits, attack it with attack tools and protocol fuzzing, and just generally try to destroy it. Here's more on that: http://mongrel.rubyforge.org/security.html > Which is more scalable? First, let's make sure we are clear: when I say "scalable" I mean "Which one can I expand easily to meet new demand." Hopefully you don't mean "performance". Because that'd be really annoying. :-) Mongrel is more scalable because of just one word: HTTP. You can put it behind many professional load balancers, reverse proxies, web servers, and even run it standalone. There isn't a performance difference, and with the proper conditional responses and native page caching support it's actually faster than SCGI in many requests. > Will mongrel be as cross-platform stable as scgi has proven to be? No, this is why I'm still keep SCGI around. Since SCGI is pure Ruby it will be the last bastion for people who can't compile extensions *or* can't use an LGPL project (of course of those folks are thieves who take the work and don't contribute back, but oh well). Mongrel has built on every platform except maybe AIX. And it runs the same on all of them, with win32 needing extra stuff because it doesn't support daemon processes. > Which platform is more likely to handle 20+ million dynamic pages perday - mod_scgi + clustered scgi runners, That comes down to and estimated 231 requests/second and I've done that on Mongrel with a bit of hardware. What you'll have to do with *any* Rails application is use httperf to measure different pages people will access. Then create a single machine that replicates your proposed deployment. Once you have this you need to use httperf to test that this proposed deployment is as fast as you had in your initial tests. Now that you've got thing worked out on the proposed deployment, you need to work to tune it to as fast as you can get it. This will take doing page caching, fragment caching, database query tuning, database object caching, and finally moving what you can out of Rails and into Mongrel. Once you've got the box as fast as you can get it, and you've played with the number of Mongrels that gives you the sweet spot, you then just need to buy the right amount of hardware and a good load balancer to meet your needs. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From Will_Green at URSCorp.com Wed May 10 13:38:13 2006 From: Will_Green at URSCorp.com (Will_Green at URSCorp.com) Date: Wed, 10 May 2006 13:38:13 -0400 Subject: [Mongrel] Apache 2.2, ProxyPass and HTTPS In-Reply-To: Message-ID: OK, got it working now! Here's the relevant part from httpd.conf (app resides in /timesheets) # Timesheets BalancerMember http://127.0.0.1:8100 BalancerMember http://127.0.0.1:8101 BalancerMember http://127.0.0.1:8102 BalancerMember http://127.0.0.1:8103 BalancerMember http://127.0.0.1:8104 RewriteEngine On RewriteRule ^/timesheets$ balancer://cyapm/timesheets/ [proxy] RewriteCond %{REQUEST_FILENAME} (engine_files|images|javascripts|stylesheets)/(.*)$ RewriteRule ^/timesheets/(.*)$ balancer://cyapm/$1 [proxy] # Punt any pontential 404s to the proxy RewriteCond %{REQUEST_FILENAME} ^/timesheets/.* RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f # for HTTPS #RequestHeader set X_FORWARDED_PROTO 'https' RewriteRule ^/(.*)$ balancer://cyapm/$1 [proxy] == Will Green Web Developer & IT Coordinator, URS Creative Imaging http://www.urscreativeimaging.com/ This e-mail and any attachments are confidential. If you receive this message in error or are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy the e-mail and any attachments or copies. From kevwil at gmail.com Wed May 10 14:09:05 2006 From: kevwil at gmail.com (Kevin Williams) Date: Wed, 10 May 2006 12:09:05 -0600 Subject: [Mongrel] mongrel vs. scgi In-Reply-To: <1147282658.5688.25.camel@localhost.localdomain> References: <683a886f0605100752n3caec69dia02383261b15ab56@mail.gmail.com> <1147282658.5688.25.camel@localhost.localdomain> Message-ID: <683a886f0605101109l657c7373hab4a2c14ebc21c79@mail.gmail.com> Zed, Thanks for the detailed answer! My only remaining concern in the claimthat Mongrel has better win32 support. Right now, today, I can't usethe 1.8.4 Ruby installer due to issues with a native extension. Thisleaves me without Mongrel on win32. A pedantic technicality, for sure,but that's my current state of affairs. It will be fixed shortly, sothis is only temporary anyway. Keep up the great work! If it weren't for Mongrel and SCGI, I wouldn'thave much ammunition when evangelizing Rails to my ".NET Architect"friends - yes, they use words like "scale" and "enterprise", butthey're my friends anyway. ;) Thanks again. Cheers, Kevin On 5/10/06, Zed Shaw wrote:> Hey Kevin,>> In general I try to steer people toward Mongrel for three reasons:>> 1) Mongrel is extensible. You can add your own handlers which is a> major advancement over fastcgi and scgi. This lets you speed up actions> which are too slow under rails by moving them out to Mongrel handlers,> but it is more difficult.>> 2) SCGI hasn't been worked on (by me) in a while, and will most likely> get a big clean-up soon. I've got limited bandwidth for projects, and> Mongrel is getting real attention (and _cash_ :-) so that's where most> of the innovation is going. I am going to keep SCGI alive since it's> pure Ruby and there might be folks who just can't run Mongrel.>> 3) Mongrel is easier to deploy in most other environments. See, SCGI is> great and all, but there's like 3 web servers that support that protocol> and there's no decent load balancers, firewalls, proxies, etc. Mongrel> is HTTP so it can be deployed on a cheese sandwich in the back of a> truck (meaning anywhere).>> More answers below...>> On Wed, 2006-05-10 at 08:52 -0600, Kevin Williams wrote:>> > So, which is better?>> Right now I'd say Mongrel simply because it has better win32 support, is> extensible with plugins and handlers, and it gets more attention from> me.>> > Which is more stable?>> I'd say Mongrel is more stable because I do this "Iron Mongrel" thing> where I give it regular code audits, attack it with attack tools and> protocol fuzzing, and just generally try to destroy it. Here's more on> that:>> http://mongrel.rubyforge.org/security.html>> > Which is more scalable?>> First, let's make sure we are clear: when I say "scalable" I mean> "Which one can I expand easily to meet new demand." Hopefully you don't> mean "performance". Because that'd be really annoying. :-)>> Mongrel is more scalable because of just one word: HTTP. You can put> it behind many professional load balancers, reverse proxies, web> servers, and even run it standalone. There isn't a performance> difference, and with the proper conditional responses and native page> caching support it's actually faster than SCGI in many requests.>> > Will mongrel be as cross-platform stable as scgi has proven to be?>> No, this is why I'm still keep SCGI around. Since SCGI is pure Ruby it> will be the last bastion for people who can't compile extensions *or*> can't use an LGPL project (of course of those folks are thieves who take> the work and don't contribute back, but oh well).>> Mongrel has built on every platform except maybe AIX. And it runs the> same on all of them, with win32 needing extra stuff because it doesn't> support daemon processes.>> > Which platform is more likely to handle 20+ million dynamic pages perday - mod_scgi + clustered scgi runners,>> That comes down to and estimated 231 requests/second and I've done that> on Mongrel with a bit of hardware.>> What you'll have to do with *any* Rails application is use httperf to> measure different pages people will access. Then create a single> machine that replicates your proposed deployment. Once you have this> you need to use httperf to test that this proposed deployment is as fast> as you had in your initial tests.>> Now that you've got thing worked out on the proposed deployment, you> need to work to tune it to as fast as you can get it. This will take> doing page caching, fragment caching, database query tuning, database> object caching, and finally moving what you can out of Rails and into> Mongrel.>> Once you've got the box as fast as you can get it, and you've played> with the number of Mongrels that gives you the sweet spot, you then just> need to buy the right amount of hardware and a good load balancer to> meet your needs.>>> --> Zed A. Shaw> http://www.zedshaw.com/> http://mongrel.rubyforge.org/>>> _______________________________________________> Mongrel-users mailing list> Mongrel-users at rubyforge.org> http://rubyforge.org/mailman/listinfo/mongrel-users> From straightflush at gmail.com Wed May 10 16:15:30 2006 From: straightflush at gmail.com (Adam Denenberg) Date: Wed, 10 May 2006 16:15:30 -0400 Subject: [Mongrel] how many mongrels to start Message-ID: is there a way to determine how best to determine the number of mongrel processes to start? Right now i am running 2 in production but I see some people run about 8 or so. What is the cutoff and determening factor for this ? thanks adam -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060510/37ca4fd9/attachment.htm From luislavena at gmail.com Wed May 10 16:19:37 2006 From: luislavena at gmail.com (Luis Lavena) Date: Wed, 10 May 2006 17:19:37 -0300 Subject: [Mongrel] mongrel vs. scgi In-Reply-To: <683a886f0605101109l657c7373hab4a2c14ebc21c79@mail.gmail.com> References: <683a886f0605100752n3caec69dia02383261b15ab56@mail.gmail.com> <1147282658.5688.25.camel@localhost.localdomain> <683a886f0605101109l657c7373hab4a2c14ebc21c79@mail.gmail.com> Message-ID: <71166b3b0605101319w26d22273s1cb3e9c981d1dfeb@mail.gmail.com> On 5/10/06, Kevin Williams wrote: > Zed, > Thanks for the detailed answer! My only remaining concern in the claimthat Mongrel has better win32 support. Right now, today, I can't usethe 1.8.4 Ruby installer due to issues with a native extension. Thisleaves me without Mongrel on win32. A pedantic technicality, for sure,but that's my current state of affairs. It will be fixed shortly, sothis is only temporary anyway. Hello Kevin, Maybe I'm out the loop, but could you tell me (info or links) with details about the native extensions problems with 1.8.4? (my guess you're talking about Curt Hibbs One-Click-Installer). So far, the mongrel win32 gem was compiled with VC 7.1, which proven to be compatible with the VC6 ruby-win32 builds made officially. As I don't use the installer from Curt, couldn't talk about it. Your feedback is very welcome, more in this rewrite state of the win32 side. Later, Luis From kevwil at gmail.com Wed May 10 17:20:29 2006 From: kevwil at gmail.com (Kevin Williams) Date: Wed, 10 May 2006 15:20:29 -0600 Subject: [Mongrel] mongrel vs. scgi In-Reply-To: <71166b3b0605101319w26d22273s1cb3e9c981d1dfeb@mail.gmail.com> References: <683a886f0605100752n3caec69dia02383261b15ab56@mail.gmail.com> <1147282658.5688.25.camel@localhost.localdomain> <683a886f0605101109l657c7373hab4a2c14ebc21c79@mail.gmail.com> <71166b3b0605101319w26d22273s1cb3e9c981d1dfeb@mail.gmail.com> Message-ID: <683a886f0605101420j4347d12vaa4394d834de817e@mail.gmail.com> The extension problem is the mysql extension doesn't build on thecurrent 1.8.4 One Click Installer when using the same process from the1.8.2 gem build (http://rubyforge.org/projects/mysql-win). I'm workingwith Curt and a few others to figure out why. I wasn't referring tothe Mongrel extension. On 5/10/06, Luis Lavena wrote:> On 5/10/06, Kevin Williams wrote:> > Zed,> > Thanks for the detailed answer! My only remaining concern in the claimthat Mongrel has better win32 support. Right now, today, I can't usethe 1.8.4 Ruby installer due to issues with a native extension. Thisleaves me without Mongrel on win32. A pedantic technicality, for sure,but that's my current state of affairs. It will be fixed shortly, sothis is only temporary anyway.>> Hello Kevin,>> Maybe I'm out the loop, but could you tell me (info or links) with> details about the native extensions problems with 1.8.4? (my guess> you're talking about Curt Hibbs One-Click-Installer).>> So far, the mongrel win32 gem was compiled with VC 7.1, which proven> to be compatible with the VC6 ruby-win32 builds made officially.>> As I don't use the installer from Curt, couldn't talk about it.>> Your feedback is very welcome, more in this rewrite state of the win32 side.>> Later,>> Luis>> _______________________________________________> Mongrel-users mailing list> Mongrel-users at rubyforge.org> http://rubyforge.org/mailman/listinfo/mongrel-users> --Cheers, Kevin "Picking fights with people smarter than youis great - you always end up learning something."- jcooney.net From Will_Green at URSCorp.com Wed May 10 17:52:44 2006 From: Will_Green at URSCorp.com (Will_Green at URSCorp.com) Date: Wed, 10 May 2006 17:52:44 -0400 Subject: [Mongrel] Output Compression in Mongrel? In-Reply-To: Message-ID: I'd like to implement output compression in Mongrel (ala Apache's mod_deflate). I have found a Rails plugin that, with minor modification, works. Is there even an advantage to moving the output compression from the Rails app to a Mongrel handler? Unless, of course, someone knows how to configure mod_proxy_balancer with mod_deflate... == Will Green Web Developer & IT Coordinator, URS Creative Imaging http://www.urscreativeimaging.com/ From jason at joyent.com Wed May 10 18:11:11 2006 From: jason at joyent.com (Jason Hoffman) Date: Wed, 10 May 2006 15:11:11 -0700 Subject: [Mongrel] Output Compression in Mongrel? In-Reply-To: References: Message-ID: On May 10, 2006, at 2:52 PM, Will_Green at URSCorp.com wrote: > I'd like to implement output compression in Mongrel (ala Apache's > mod_deflate). I have found a Rails plugin that, with minor > modification, > works. > > Is there even an advantage to moving the output compression from > the Rails > app to a Mongrel handler? > > Unless, of course, someone knows how to configure > mod_proxy_balancer with > mod_deflate... I don't know of an issue with mod_deflate and mod_proxy_balancer. http://pipeboost.com/getreport.asp?URL=https://jason.strongspace.com/ login/ How are you configuring it now? Regards, J ?????????????????????????????? Jason A. Hoffman, PhD Founder, CTO, Joyent Inc. Email: jason at joyent.com Email: jason at textdrive.com Mobile: (858)342-2179 AIM: jxh at mac.com ?????????????????????????????? From luislavena at gmail.com Wed May 10 18:12:46 2006 From: luislavena at gmail.com (Luis Lavena) Date: Wed, 10 May 2006 19:12:46 -0300 Subject: [Mongrel] mongrel vs. scgi In-Reply-To: <683a886f0605101420j4347d12vaa4394d834de817e@mail.gmail.com> References: <683a886f0605100752n3caec69dia02383261b15ab56@mail.gmail.com> <1147282658.5688.25.camel@localhost.localdomain> <683a886f0605101109l657c7373hab4a2c14ebc21c79@mail.gmail.com> <71166b3b0605101319w26d22273s1cb3e9c981d1dfeb@mail.gmail.com> <683a886f0605101420j4347d12vaa4394d834de817e@mail.gmail.com> Message-ID: <71166b3b0605101512j6a05bfa8v3d5998fd04da6973@mail.gmail.com> On 5/10/06, Kevin Williams wrote: > The extension problem is the mysql extension doesn't build on thecurrent 1.8.4 One Click Installer when using the same process from the1.8.2 gem build (http://rubyforge.org/projects/mysql-win). I'm workingwith Curt and a few others to figure out why. I wasn't referring tothe Mongrel extension. Kevin, I used the plain ruby-mswin32, even the new stable snapshot. Based on your problems, I do the following: * checkout out mysql-win trunk (guess is where the code you and Curt are working on). * added to includes mysql-5.0.21-win32\include * added to lib mysql-5.0.21-win32\lib\opt (Because I don't use mysql, download the 39MB no installer available on their site). * next I do was go to the ext/ folder of mysql-win (rake compile rejected generate the makefile) Anyway, inside ext/, run: >ruby extconf.rb checking for mysql.h... yes checking for mysql_query() in libmysql.lib... yes checking for mysql_ssl_set()... no creating Makefile >nmake Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. C:\Ruby\bin\ruby -e "puts 'EXPORTS', 'Init_mysql'" > mysql-i386-mswin32.def cl -nologo -MD -Zi -O2b2xg- -G6 -I. -IC:/Ruby/lib/ruby/1.8/i386-mswin32 -IC:/Ruby/lib/ruby/1.8/i386-mswin32 -I. -DHAVE_MYSQL_H -c -Tcmysql.c mysql.c d:\programming\sources\ruby\extensions\mysql-win\ext\mysql.c(1703) : warning C4716: 'time_initialize' : must return a value cl -nologo -LD -Femysql.so mysql.obj msvcrt-ruby18.lib libmysql.lib oldnames.lib user32.lib advapi32.lib wsock32.lib -link -incremental:no -debug -opt:ref -opt:icf -dll -libpath:"C:/Ruby/lib" -def:mysql-i386-mswin32.def -implib:mysql-i386-mswin32.lib -pdb:mysql-i386-mswin32.pdb Creating library mysql-i386-mswin32.lib and object mysql-i386-mswin32.exp ===== * Next I needed to modify the require line in the test file. from: require "./mysql.o" to: require "./mysql.so" That typo is important, there is not .o file in win32, and in linux are object files, not shared objects (or dll as win32). * Run the test.rb agains my local MySQL - 5.0.20-community Attached are the failures reported against empty test database. My build environment is: cl: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. lib: Microsoft (R) Library Manager Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. nmake: Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. Platform SDK: Windows Server 2003 SP1 SDK Release Hope this information is helpful. Any hel I could provide, just mail me. Regards, Luis -------------- next part -------------- Loaded suite test Started ..................F......................................FFF......F.................F...............F......... Finished in 1.993 seconds. 1) Failure: test_sqlstate(TC_Mysql2) [test.rb:154]: <"00000"> expected but was <"HY000">. 2) Failure: test_fetch_bigint(TC_MysqlStmt2) [test.rb:799]: <[-1]> expected but was <[9223372036854775807]>. 3) Failure: test_fetch_bigint_unsigned(TC_MysqlStmt2) [test.rb:812]: <[-1]> expected but was <[0]>. 4) Failure: test_fetch_binary(TC_MysqlStmt2) [test.rb:1009]: <["abc"]> expected but was <["abc\000\000\000\000\000\000\000"]>. 5) Failure: test_fetch_double(TC_MysqlStmt2) [test.rb:860]: <-1.79769313486232e+308> expected but was <-1.79769313486232e+308>. 6) Failure: test_fetch_timestamp(TC_MysqlStmt2) [test.rb:950]: <[#]> expected but was <[#]>. 7) Failure: test_sqlstate(TC_MysqlStmt2) [test.rb:1280]: <""> expected but was <"00000">. 110 tests, 340 assertions, 7 failures, 0 errors From luislavena at gmail.com Wed May 10 18:26:29 2006 From: luislavena at gmail.com (Luis Lavena) Date: Wed, 10 May 2006 19:26:29 -0300 Subject: [Mongrel] mongrel vs. scgi In-Reply-To: <71166b3b0605101512j6a05bfa8v3d5998fd04da6973@mail.gmail.com> References: <683a886f0605100752n3caec69dia02383261b15ab56@mail.gmail.com> <1147282658.5688.25.camel@localhost.localdomain> <683a886f0605101109l657c7373hab4a2c14ebc21c79@mail.gmail.com> <71166b3b0605101319w26d22273s1cb3e9c981d1dfeb@mail.gmail.com> <683a886f0605101420j4347d12vaa4394d834de817e@mail.gmail.com> <71166b3b0605101512j6a05bfa8v3d5998fd04da6973@mail.gmail.com> Message-ID: <71166b3b0605101526y598e2503g9046ed2067d50e37@mail.gmail.com> As a note, I'll like to add: Using Dependency Walker, both MSVCRT-RUBY18.dll and the built mysql.so links against MSVCRT.DLL, which is default version 7.0.2600.2180 on XP. For the failures reported, as I don't use mysql, couldn't test further. Later, Luis PS: I know is not the right list, but as the discussion was started here, I must add the comments. Besides, I don't know where else I could post it ;-) From zedshaw at zedshaw.com Wed May 10 19:34:33 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Wed, 10 May 2006 19:34:33 -0400 Subject: [Mongrel] how many mongrels to start In-Reply-To: References: Message-ID: <1147304073.19629.25.camel@localhost.localdomain> On Wed, 2006-05-10 at 16:15 -0400, Adam Denenberg wrote: > is there a way to determine how best to determine the number of > mongrel processes to start? Right now i am running 2 in production > but I see some people run about 8 or so. What is the cutoff and > determening factor for this ? There is no set number that is "best" since that depends on factors like the type of application, hardware you run on, how dynamic the appication is, etc. I've found that 8-12 mongrel processes per CPU does right, but I determined this by starting with 1 and then doing the following: 1) You'll need a URL to a small file that is running on your apache server and is not served by Mongrel at all. This URL will be your "best possible baseline". 2) Build your baseline measurement first. Using httperf, measure the speed of your URL from #1 above so that you know how fast you could possibly get if you served everything static in ideal situations. a) ***** Make sure you do this on a different machine over an ideal network. Not your damn wifi over a phone line through sixteen poorly configured routers. Right next to the box your testing with a fast switch and only one hop is the best test situation. This removes network latency from your test as a confounding factor.***** 3) Pick a page that's a good representative page for your application. Make sure you disable logins to make this test easier to run. Hit this Rails page and compare it to your baseline page. a) If your *rails* measurement is FASTER than your baseline measurement then you screwed up. Rails shouldn't be faster than a file off your static server. Check your config. b) If your rails measurement is horribly slow compared to baseline then you've got some config to do before you even start tuning the number of process. Repeat this test until one mongrel is as fast as possible. 4) Once you've got a Rails page going at a reasonable speed, then you'll want to increase the --rate setting to make sure that it can handle the reported rate. 5) Finally, you alternate between adding a mongrel process and running test #4 with the next highest rate you'd get. You basically stop when adding one more server doesn't improve your rate. a) Make sure you run one round of test #4 to get the server "warmed up", and then run the real one. Hell, run like 5 or 6 just to make sure you're not getting a possibly bad reading. b) Example, you run #4 and find out the --rate one mongrel can support is 120 req/second. You add another mongrel and run the test again with --rate 240. It handles this just find so you add another and get --rate 360. Ok, try another one and you get it dies. Giving --rate 480 gets you only a rate of 100. Your server has hit it's max and broke. Try tuning the --rate down at this and see if it's totally busted (like, 4 mongrels only gets you --rate 380) or if it's pretty close to 480. That should do it. A good practice is to also look at the CPUs on the server with top and see what kind of thrashing you give the server. HTTPERF Here's the commands I use for each test, but read the man page for httperf so that you learn to use it. It's an important tool and just cut-pasting what I have here is not going to do it for you. #2 && #3) httperf --server www.theserver.com --port 80 --uri /tested --num-conns <10 second count> #4) httperf --server www.theserver.com --port 80 --uri /tested --num-conns <10 second count> --rate Where <10 second count> is you put enough connections to make the test run for 10 seconds. Start off with like 100 and keep raising it until it goes for 10 seconds. Where is you put in whatever httperf said the estimated requests/second were from #3. What you're doing here is seeing if it really can handle that much concurrency. Try raising it up and dropping it down to see the impact of performance on higher loads. Have fun. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From straightflush at gmail.com Wed May 10 20:27:02 2006 From: straightflush at gmail.com (Adam Denenberg) Date: Wed, 10 May 2006 20:27:02 -0400 Subject: [Mongrel] how many mongrels to start In-Reply-To: <1147304073.19629.25.camel@localhost.localdomain> References: <1147304073.19629.25.camel@localhost.localdomain> Message-ID: thank for all the info I will try it out. Is there a way to easily start 8-10 mongrel processes without running mongrel_rails start 10 times ? thanks again for all the help. adam On 5/10/06, Zed Shaw wrote: > > On Wed, 2006-05-10 at 16:15 -0400, Adam Denenberg wrote: > > is there a way to determine how best to determine the number of > > mongrel processes to start? Right now i am running 2 in production > > but I see some people run about 8 or so. What is the cutoff and > > determening factor for this ? > > There is no set number that is "best" since that depends on factors like > the type of application, hardware you run on, how dynamic the appication > is, etc. > > I've found that 8-12 mongrel processes per CPU does right, but I > determined this by starting with 1 and then doing the following: > > 1) You'll need a URL to a small file that is running on your apache > server and is not served by Mongrel at all. This URL will be your "best > possible baseline". > > 2) Build your baseline measurement first. Using httperf, measure the > speed of your URL from #1 above so that you know how fast you could > possibly get if you served everything static in ideal situations. > > a) ***** Make sure you do this on a different machine over an ideal > network. Not your damn wifi over a phone line through sixteen poorly > configured routers. Right next to the box your testing with a fast > switch and only one hop is the best test situation. This removes > network latency from your test as a confounding factor.***** > > 3) Pick a page that's a good representative page for your application. > Make sure you disable logins to make this test easier to run. Hit this > Rails page and compare it to your baseline page. > > a) If your *rails* measurement is FASTER than your baseline > measurement then you screwed up. Rails shouldn't be faster than a file > off your static server. Check your config. > > b) If your rails measurement is horribly slow compared to baseline > then you've got some config to do before you even start tuning the > number of process. Repeat this test until one mongrel is as fast as > possible. > > 4) Once you've got a Rails page going at a reasonable speed, then you'll > want to increase the --rate setting to make sure that it can handle the > reported rate. > > 5) Finally, you alternate between adding a mongrel process and running > test #4 with the next highest rate you'd get. You basically stop when > adding one more server doesn't improve your rate. > > a) Make sure you run one round of test #4 to get the server "warmed > up", and then run the real one. Hell, run like 5 or 6 just to make sure > you're not getting a possibly bad reading. > > b) Example, you run #4 and find out the --rate one mongrel can support > is 120 req/second. You add another mongrel and run the test again with > --rate 240. It handles this just find so you add another and get --rate > 360. Ok, try another one and you get it dies. Giving --rate 480 gets > you only a rate of 100. Your server has hit it's max and broke. Try > tuning the --rate down at this and see if it's totally busted (like, 4 > mongrels only gets you --rate 380) or if it's pretty close to 480. > > > That should do it. A good practice is to also look at the CPUs on the > server with top and see what kind of thrashing you give the server. > > HTTPERF > > Here's the commands I use for each test, but read the man page for > httperf so that you learn to use it. It's an important tool and just > cut-pasting what I have here is not going to do it for you. > > #2 && #3) httperf --server www.theserver.com --port 80 --uri /tested > --num-conns <10 second count> > > #4) httperf --server www.theserver.com --port 80 --uri /tested > --num-conns <10 second count> --rate > > Where <10 second count> is you put enough connections to make the test > run for 10 seconds. Start off with like 100 and keep raising it until > it goes for 10 seconds. > > Where is you put in whatever httperf said the > estimated requests/second were from #3. What you're doing here is > seeing if it really can handle that much concurrency. Try raising it up > and dropping it down to see the impact of performance on higher loads. > > Have fun. > > > > -- > Zed A. Shaw > http://www.zedshaw.com/ > http://mongrel.rubyforge.org/ > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060510/b58c9a5b/attachment-0001.htm From zedshaw at zedshaw.com Wed May 10 21:04:21 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Wed, 10 May 2006 21:04:21 -0400 Subject: [Mongrel] how many mongrels to start In-Reply-To: References: <1147304073.19629.25.camel@localhost.localdomain> Message-ID: <1147309461.15499.0.camel@localhost.localdomain> On Wed, 2006-05-10 at 20:27 -0400, Adam Denenberg wrote: > thank for all the info I will try it out. > > Is there a way to easily start 8-10 mongrel processes without running > mongrel_rails start 10 times ? > > thanks again for all the help. > > adam Try out mongrel_cluster from Bradley Taylor at railsmachine. It's turning out to be the best way to manage a cluster of mongrel servers and get it to work with capistrano. Only thing is it doesn't work with win32. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From rsaccon at gmail.com Wed May 10 23:25:40 2006 From: rsaccon at gmail.com (Roberto Saccon) Date: Thu, 11 May 2006 00:25:40 -0300 Subject: [Mongrel] how many mongrels to start In-Reply-To: <1147304073.19629.25.camel@localhost.localdomain> References: <1147304073.19629.25.camel@localhost.localdomain> Message-ID: Zed, thanks very much for this detailed description. One question to 2.a) if no real server just one hop away from the entry-web-server (or loadbalancer) is available (e.g.: just having rented one dedicated server) , what is the best alternative: 1) run httperf on the same machine as the webserver 2) run httperf on the same machine as the webserver but on its own XEN virtual machine. 3) run httperf from development machine over DSL connection regards Roberto On 5/10/06, Zed Shaw wrote: > > On Wed, 2006-05-10 at 16:15 -0400, Adam Denenberg wrote: > > is there a way to determine how best to determine the number of > > mongrel processes to start? Right now i am running 2 in production > > but I see some people run about 8 or so. What is the cutoff and > > determening factor for this ? > > There is no set number that is "best" since that depends on factors like > the type of application, hardware you run on, how dynamic the appication > is, etc. > > I've found that 8-12 mongrel processes per CPU does right, but I > determined this by starting with 1 and then doing the following: > > 1) You'll need a URL to a small file that is running on your apache > server and is not served by Mongrel at all. This URL will be your "best > possible baseline". > > 2) Build your baseline measurement first. Using httperf, measure the > speed of your URL from #1 above so that you know how fast you could > possibly get if you served everything static in ideal situations. > > a) ***** Make sure you do this on a different machine over an ideal > network. Not your damn wifi over a phone line through sixteen poorly > configured routers. Right next to the box your testing with a fast > switch and only one hop is the best test situation. This removes > network latency from your test as a confounding factor.***** > > 3) Pick a page that's a good representative page for your application. > Make sure you disable logins to make this test easier to run. Hit this > Rails page and compare it to your baseline page. > > a) If your *rails* measurement is FASTER than your baseline > measurement then you screwed up. Rails shouldn't be faster than a file > off your static server. Check your config. > > b) If your rails measurement is horribly slow compared to baseline > then you've got some config to do before you even start tuning the > number of process. Repeat this test until one mongrel is as fast as > possible. > > 4) Once you've got a Rails page going at a reasonable speed, then you'll > want to increase the --rate setting to make sure that it can handle the > reported rate. > > 5) Finally, you alternate between adding a mongrel process and running > test #4 with the next highest rate you'd get. You basically stop when > adding one more server doesn't improve your rate. > > a) Make sure you run one round of test #4 to get the server "warmed > up", and then run the real one. Hell, run like 5 or 6 just to make sure > you're not getting a possibly bad reading. > > b) Example, you run #4 and find out the --rate one mongrel can support > is 120 req/second. You add another mongrel and run the test again with > --rate 240. It handles this just find so you add another and get --rate > 360. Ok, try another one and you get it dies. Giving --rate 480 gets > you only a rate of 100. Your server has hit it's max and broke. Try > tuning the --rate down at this and see if it's totally busted (like, 4 > mongrels only gets you --rate 380) or if it's pretty close to 480. > > > That should do it. A good practice is to also look at the CPUs on the > server with top and see what kind of thrashing you give the server. > > HTTPERF > > Here's the commands I use for each test, but read the man page for > httperf so that you learn to use it. It's an important tool and just > cut-pasting what I have here is not going to do it for you. > > #2 && #3) httperf --server www.theserver.com --port 80 --uri /tested > --num-conns <10 second count> > > #4) httperf --server www.theserver.com --port 80 --uri /tested > --num-conns <10 second count> --rate > > Where <10 second count> is you put enough connections to make the test > run for 10 seconds. Start off with like 100 and keep raising it until > it goes for 10 seconds. > > Where is you put in whatever httperf said the > estimated requests/second were from #3. What you're doing here is > seeing if it really can handle that much concurrency. Try raising it up > and dropping it down to see the impact of performance on higher loads. > > Have fun. > > > > -- > Zed A. Shaw > http://www.zedshaw.com/ > http://mongrel.rubyforge.org/ > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > -- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060511/dd221f6e/attachment.htm From rsaccon at gmail.com Wed May 10 23:36:26 2006 From: rsaccon at gmail.com (Roberto Saccon) Date: Thu, 11 May 2006 00:36:26 -0300 Subject: [Mongrel] another software load-balancer Message-ID: There was recently talk about the different options to distribute requests to a mongrel cluster. I found another one: http://w.ods.org/haproxy/ Anybody tried it and can tell how it compares to the others (pen, pound, balance) ? regards -- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060511/7ff5e951/attachment.htm From kevwil at gmail.com Thu May 11 02:06:43 2006 From: kevwil at gmail.com (Kevin Williams) Date: Thu, 11 May 2006 00:06:43 -0600 Subject: [Mongrel] mongrel vs. scgi In-Reply-To: <71166b3b0605101526y598e2503g9046ed2067d50e37@mail.gmail.com> References: <683a886f0605100752n3caec69dia02383261b15ab56@mail.gmail.com> <1147282658.5688.25.camel@localhost.localdomain> <683a886f0605101109l657c7373hab4a2c14ebc21c79@mail.gmail.com> <71166b3b0605101319w26d22273s1cb3e9c981d1dfeb@mail.gmail.com> <683a886f0605101420j4347d12vaa4394d834de817e@mail.gmail.com> <71166b3b0605101512j6a05bfa8v3d5998fd04da6973@mail.gmail.com> <71166b3b0605101526y598e2503g9046ed2067d50e37@mail.gmail.com> Message-ID: <683a886f0605102306r63dff27ev1abc20d5b3ddef21@mail.gmail.com> OK, I got it build on 1.8.4 finally. Turns out it was the spaces in args for the mkmf dir_config command. Iconverted the paths to the old 8.3 format and it built just fine. Ialso got the mysql_ssl_set check to pass. I tried the change to test.rb, but it wouldn't work for me. I don'tunderstand why './mysql.o' would work when no file by that nameexists, but whatever, I guess. So now I can use Mongrel on win32 - hooray! Thanks for all the pointers guys. On 5/10/06, Luis Lavena wrote:> As a note, I'll like to add:>> Using Dependency Walker, both MSVCRT-RUBY18.dll and the built mysql.so> links against MSVCRT.DLL, which is default version 7.0.2600.2180 on> XP.>> For the failures reported, as I don't use mysql, couldn't test further.>> Later,>> Luis>> PS: I know is not the right list, but as the discussion was started> here, I must add the comments. Besides, I don't know where else I> could post it ;-)>> _______________________________________________> Mongrel-users mailing list> Mongrel-users at rubyforge.org> http://rubyforge.org/mailman/listinfo/mongrel-users> -- Cheers, Kevin From gabriel.falkenberg at fek.uu.se Thu May 11 03:34:43 2006 From: gabriel.falkenberg at fek.uu.se (Gabriel Falkenberg) Date: Thu, 11 May 2006 09:34:43 +0200 Subject: [Mongrel] Problems starting mongrel running a rails app as a service (win 2k) In-Reply-To: <71166b3b0605100858i49127e8fqce57ba798ca10611@mail.gmail.com> Message-ID: <000001c674cd$5f292ed0$bfafee82@ekonomikum.uu.local> > To pinpoint if the problem is related to mongrel services or rails, > please: > > Create a emtpy rails application. > start mongrel for it, and check the webpage (the rails properties one). > Then install the service and run it. > If everything start and run ok, thre is something during the load of > the controllers and models that hang or halt and raises that error. Nice suggestion Luis, I hadn't thought about that. It seems like there is something wrong with the services part cause even a fresh rails app which runs perfectly using just "mongrel_rails start" fails to start as a service with the same error message: There was a problem starting the service: The service did not respond to the start or control request in a timely fashion. I guess my question is, has anyone succeeded in running mongrel as a service (or any service using win32/service) using windows 2000? Thanks, Gabriel Falkenberg From straightflush at gmail.com Thu May 11 07:55:45 2006 From: straightflush at gmail.com (Adam Denenberg) Date: Thu, 11 May 2006 07:55:45 -0400 Subject: [Mongrel] how many mongrels to start In-Reply-To: References: <1147304073.19629.25.camel@localhost.localdomain> Message-ID: i wouldnt run it on the same server b/c the load of httperf will interfere with the results of teh output. So if all you have is your desktop at home I think thats still a better alternative then local machine. HTTPERF just generates too much load to get clear results of http performance. adam On 5/10/06, Roberto Saccon wrote: > > Zed, thanks very much for this detailed description. One question to 2.a) > if no real server just one hop away from the entry-web-server (or > loadbalancer) is available (e.g.: just having rented one dedicated server) > , what is the best alternative: > > 1) run httperf on the same machine as the webserver > 2) run httperf on the same machine as the webserver but on its own XEN > virtual machine. > 3) run httperf from development machine over DSL connection > > regards > Roberto > > On 5/10/06, Zed Shaw wrote: > > > On Wed, 2006-05-10 at 16:15 -0400, Adam Denenberg wrote: > > > is there a way to determine how best to determine the number of > > > mongrel processes to start? Right now i am running 2 in production > > > but I see some people run about 8 or so. What is the cutoff and > > > determening factor for this ? > > > > There is no set number that is "best" since that depends on factors like > > the type of application, hardware you run on, how dynamic the appication > > is, etc. > > > > I've found that 8-12 mongrel processes per CPU does right, but I > > determined this by starting with 1 and then doing the following: > > > > 1) You'll need a URL to a small file that is running on your apache > > server and is not served by Mongrel at all. This URL will be your "best > > > > possible baseline". > > > > 2) Build your baseline measurement first. Using httperf, measure the > > speed of your URL from #1 above so that you know how fast you could > > possibly get if you served everything static in ideal situations. > > > > a) ***** Make sure you do this on a different machine over an ideal > > network. Not your damn wifi over a phone line through sixteen poorly > > configured routers. Right next to the box your testing with a fast > > switch and only one hop is the best test situation. This removes > > network latency from your test as a confounding factor.***** > > > > 3) Pick a page that's a good representative page for your application. > > Make sure you disable logins to make this test easier to run. Hit this > > Rails page and compare it to your baseline page. > > > > a) If your *rails* measurement is FASTER than your baseline > > measurement then you screwed up. Rails shouldn't be faster than a file > > off your static server. Check your config. > > > > b) If your rails measurement is horribly slow compared to baseline > > then you've got some config to do before you even start tuning the > > number of process. Repeat this test until one mongrel is as fast as > > possible. > > > > 4) Once you've got a Rails page going at a reasonable speed, then you'll > > want to increase the --rate setting to make sure that it can handle the > > reported rate. > > > > 5) Finally, you alternate between adding a mongrel process and running > > test #4 with the next highest rate you'd get. You basically stop when > > adding one more server doesn't improve your rate. > > > > a) Make sure you run one round of test #4 to get the server "warmed > > up", and then run the real one. Hell, run like 5 or 6 just to make sure > > > > you're not getting a possibly bad reading. > > > > b) Example, you run #4 and find out the --rate one mongrel can support > > is 120 req/second. You add another mongrel and run the test again with > > --rate 240. It handles this just find so you add another and get --rate > > > > 360. Ok, try another one and you get it dies. Giving --rate 480 gets > > you only a rate of 100. Your server has hit it's max and broke. Try > > tuning the --rate down at this and see if it's totally busted (like, 4 > > mongrels only gets you --rate 380) or if it's pretty close to 480. > > > > > > That should do it. A good practice is to also look at the CPUs on the > > server with top and see what kind of thrashing you give the server. > > > > HTTPERF > > > > Here's the commands I use for each test, but read the man page for > > httperf so that you learn to use it. It's an important tool and just > > cut-pasting what I have here is not going to do it for you. > > > > #2 && #3) httperf --server www.theserver.com --port 80 --uri /tested > > --num-conns <10 second count> > > > > #4) httperf --server www.theserver.com --port 80 --uri /tested > > --num-conns <10 second count> --rate > > > > Where <10 second count> is you put enough connections to make the test > > run for 10 seconds. Start off with like 100 and keep raising it until > > it goes for 10 seconds. > > > > Where is you put in whatever httperf said the > > estimated requests/second were from #3. What you're doing here is > > seeing if it really can handle that much concurrency. Try raising it up > > > > and dropping it down to see the impact of performance on higher loads. > > > > Have fun. > > > > > > > > -- > > Zed A. Shaw > > http://www.zedshaw.com/ > > http://mongrel.rubyforge.org/ > > > > > > _______________________________________________ > > Mongrel-users mailing list > > Mongrel-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/mongrel-users > > > > > > -- > Roberto Saccon > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060511/0000654a/attachment-0001.htm From Will_Green at URSCorp.com Thu May 11 08:26:29 2006 From: Will_Green at URSCorp.com (Will_Green at URSCorp.com) Date: Thu, 11 May 2006 08:26:29 -0400 Subject: [Mongrel] Output Compression in Mongrel? In-Reply-To: Message-ID: > I don't know of an issue with mod_deflate and mod_proxy_balancer. > http://pipeboost.com/getreport.asp?URL=https://jason.strongspace.com/ > login/ > How are you configuring it now? I have mod_deflate loaded for the entire server. I then have the following: BalancerMember http://127.0.0.1:8100 BalancerMember http://127.0.0.1:8101 BalancerMember http://127.0.0.1:8102 BalancerMember http://127.0.0.1:8103 BalancerMember http://127.0.0.1:8104 RewriteEngine On RewriteLog "logs/rewrite_log" RewriteRule ^/timesheets$ balancer://cyapm/timesheets/ [proxy] RewriteCond %{REQUEST_FILENAME} (engine_files|images|javascripts|stylesheets)/(.*)$ RewriteRule ^/timesheets/(.*)$ balancer://cyapm/$1 [proxy] # Punt any pontential 404s to the proxy RewriteCond %{REQUEST_FILENAME} ^/timesheets/.* RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://cyapm/$1 [proxy] If I access one of the mongrels directly, I get compressed output (4k), with the "Content-Encoding: gzip" and "Vary: Accept-Encoding" headers set . Accessing the app through Apache gets me zero compression (40k), with no "Content-Encoding" header, and "Vary: Accept-Encoding,User-Agent" . I use LiveHTTPHeaders in Firefox to see this. I suspect that Apache is not passing the "Accept-Encoding: gzip,deflate" headers through the balancer to the mongrels, thus the compression is not kicking in. Any thoughts? == Will Green Web Developer & IT Coordinator, URS Creative Imaging http://www.urscreativeimaging.com/ 7650 West Courtney Campbell Causeway Suite 700 Tampa, FL 33607 813.675.6849 (direct) 813.286.1711 (main) This e-mail and any attachments are confidential. If you receive this message in error or are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy the e-mail and any attachments or copies. From gabriel.falkenberg at fek.uu.se Thu May 11 08:38:25 2006 From: gabriel.falkenberg at fek.uu.se (Gabriel Falkenberg) Date: Thu, 11 May 2006 14:38:25 +0200 Subject: [Mongrel] Problems starting mongrel running a rails app as aservice (solved!) In-Reply-To: <000001c674cd$5f292ed0$bfafee82@ekonomikum.uu.local> Message-ID: <000e01c674f7$cc4e3760$bfafee82@ekonomikum.uu.local> Ok, I have solved the problem... That the log-files weren't even created should have made me realize that the problem had to do with file-access permissions. When I started the app as a service it got other privileges than when I started it at the prompt and that was why the app didn't start, because it couldn't create the log files... Maybe a troubleshooting section should be added to the Win32 Howto describing this problem? Something like: Troubleshooting When running Mongrel as a service you have to think about what permissions the service is going to get. If the service doesn't have write-access to the log-files in the gem's bin-directory (something like: C:\ruby\lib\ruby\gems\1.8\gems\mongrel-0.3.12.4-mswin32\bin) it won't be able to start and you won't get any log files that tells you why. If this is the case, trying to start the service will give you the following error message: > There was a problem starting the service: > The service did not respond to the start or control request in a timely > fashion. Also remember that rails needs to be able to write to certain directories like the log-directory (railsapp/log) and the directories beneath railsapp/tmp/ What do you think? /Gabriel Falkenberg > -----Ursprungligt meddelande----- > Fr?n: mongrel-users-bounces at rubyforge.org [mailto:mongrel-users- > bounces at rubyforge.org] F?r Gabriel Falkenberg > Skickat: den 11 maj 2006 09:35 > Till: mongrel-users at rubyforge.org > ?mne: Re: [Mongrel] Problems starting mongrel running a rails app as > aservice (win 2k) > > > To pinpoint if the problem is related to mongrel services or rails, > > please: > > > > Create a emtpy rails application. > > start mongrel for it, and check the webpage (the rails properties one). > > Then install the service and run it. > > If everything start and run ok, thre is something during the load of > > the controllers and models that hang or halt and raises that error. > > Nice suggestion Luis, I hadn't thought about that. It seems like there is > something wrong with the services part cause even a fresh rails app which > runs perfectly using just "mongrel_rails start" fails to start as a > service > with the same error message: > > There was a problem starting the service: > The service did not respond to the start or control request in a timely > fashion. > > I guess my question is, has anyone succeeded in running mongrel as a > service > (or any service using win32/service) using windows 2000? > > Thanks, > Gabriel Falkenberg > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users From luislavena at gmail.com Thu May 11 09:02:37 2006 From: luislavena at gmail.com (Luis Lavena) Date: Thu, 11 May 2006 10:02:37 -0300 Subject: [Mongrel] Problems starting mongrel running a rails app as a service (win 2k) In-Reply-To: <000001c674cd$5f292ed0$bfafee82@ekonomikum.uu.local> References: <71166b3b0605100858i49127e8fqce57ba798ca10611@mail.gmail.com> <000001c674cd$5f292ed0$bfafee82@ekonomikum.uu.local> Message-ID: <71166b3b0605110602x559d2fffk2f7e6dff291251ad@mail.gmail.com> On 5/11/06, Gabriel Falkenberg wrote: [snip] > Nice suggestion Luis, I hadn't thought about that. It seems like there is > something wrong with the services part cause even a fresh rails app which > runs perfectly using just "mongrel_rails start" fails to start as a service > with the same error message: > > There was a problem starting the service: > The service did not respond to the start or control request in a timely > fashion. > > I guess my question is, has anyone succeeded in running mongrel as a service > (or any service using win32/service) using windows 2000? > Excelent question Gabriel!, we just need to figure this out ;-) win2k you're talking about, is Pro or Server? Also, inside the win32-service gem (C:\Ruby\lib\ruby\gems\1.8\gems\win32-service-0.5.0-mswin32) there is a file called daemon_test.rb in examples folder. We will use that to trace the root of the problem: In a console, chdir to that folder and do: >ruby daemon_test.rb install That is supposed to install a AbbaSvc test service (later you could remove it). Now, try starting it using the ruby command (ruby daemon_test.rb start) and also "net start abbasvc" If it fails, something is wrong (or different) in how services work under win2k. If not fails, that means something is wrong with my brain and need to fix it ;-) In that case, I'll doing a rewrite of the win32 service stuff for mongrel to solve other issues too, targeting 0.4 release (as Zed annouced this monday). I'll like have you as test user if you could/want so we also could mark win2k as compatible/tested platform. Later, From luislavena at gmail.com Thu May 11 09:22:07 2006 From: luislavena at gmail.com (Luis Lavena) Date: Thu, 11 May 2006 10:22:07 -0300 Subject: [Mongrel] Problems starting mongrel running a rails app as aservice (solved!) In-Reply-To: <000e01c674f7$cc4e3760$bfafee82@ekonomikum.uu.local> References: <000001c674cd$5f292ed0$bfafee82@ekonomikum.uu.local> <000e01c674f7$cc4e3760$bfafee82@ekonomikum.uu.local> Message-ID: <71166b3b0605110622i1853c4fbocc41edfa283f1fb4@mail.gmail.com> Oh, on personal ramblings: I hate the way gmail sort my inbox! See my comments below. On 5/11/06, Gabriel Falkenberg wrote: > Ok, I have solved the problem... That the log-files weren't even created > should have made me realize that the problem had to do with file-access > permissions. When I started the app as a service it got other privileges > than when I started it at the prompt and that was why the app didn't start, > because it couldn't create the log files... > I guess I will need to check for win2k, but for XP the context where each service gets created and runs under SYSTEM account, which often have wide privileges around files. You could change that behavior from the Services applet in administrative tools. > > When running Mongrel as a service you have to think about what permissions > the service is going to get. If the service doesn't have write-access to the > log-files in the gem's bin-directory (something like: > C:\ruby\lib\ruby\gems\1.8\gems\mongrel-0.3.12.4-mswin32\bin) it won't be > able to start and you won't get any log files that tells you why. > [snip] > Also remember that rails needs to be able to write to certain directories > like the log-directory (railsapp/log) and the directories beneath > railsapp/tmp/ > The logs file aren't created inside the gem, instead they will get created in the log folder of the rails application. Please check the permissions of these folders too. > > What do you think? > As my previous email, I'll suggest test the daemon_test.rb shiped with win32-service. That writes information to c:\test.log, which require privileges. Please check that and let me know on which account the service start (you could check with task manager). Anyway, glad to hear that it worked ;-) Later, Luis Lavena From zedshaw at zedshaw.com Thu May 11 10:31:56 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Thu, 11 May 2006 10:31:56 -0400 Subject: [Mongrel] how many mongrels to start In-Reply-To: References: <1147304073.19629.25.camel@localhost.localdomain> Message-ID: <1147357916.6462.5.camel@localhost.localdomain> On Thu, 2006-05-11 at 00:25 -0300, Roberto Saccon wrote: > Zed, thanks very much for this detailed description. One question to > 2.a) if no real server just one hop away from the entry-web-server (or > loadbalancer) is available (e.g.: just having rented one dedicated > server) , what is the best alternative: > > 1) run httperf on the same machine as the webserver > 2) run httperf on the same machine as the webserver but on its own XEN > virtual machine. > 3) run httperf from development machine over DSL connection > > regards > Roberto I'd say none of them. If this is all you have then a DSL would be your only reasonable option. The only problem is your DSL might not have enough juice to put Mongrel through it's paces. Make sure you really get a good baseline so you know what you're dealing with. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From why at ruby-lang.org Thu May 11 13:56:14 2006 From: why at ruby-lang.org (why the lucky stiff) Date: Thu, 11 May 2006 11:56:14 -0600 Subject: [Mongrel] Upload progress "plugin" Message-ID: <44637ABE.9040309@ruby-lang.org> mongreleers, This is a hack for adding basic upload progress support to Mongrel. Currently, you can monitor the upload of any POST. I'm sure some work needs to be done to get it functioning with Rails. Save as lib/mongrel/progress. Anyway, here's how to start Mongrel with it: require 'mongrel' require 'mongrel/camping' require 'mongrel/progress' config = Mongrel::Configurator.new :host => host do listener :port => port do uri "/", :handler => Mongrel::Camping::CampingHandler.new(ParkPlace) uri "/progress", :handler => Mongrel::ProgressHandler.new uri "/favicon", :handler => Mongrel::Error404Handler.new("") trap("INT") { stop } run end end config.join Yeah, so, notice the ProgressHandler class and the require. In your forms:
...
Since the handler is mounted at '/progress', you can hit '/progress?upload_id=XXX' to read the stats: size: 55575 received: 11131 Left to do: * XML/YAML/JSON output. (based on the Accept header.) * Support for X-Upload-ID, X-Progress-ID, progress_id. (?) _why -------------- next part -------------- A non-text attachment was scrubbed... Name: progress.rb Type: application/x-ruby Size: 2683 bytes Desc: not available Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20060511/d4ca5b4c/attachment.bin From zedshaw at zedshaw.com Thu May 11 15:44:27 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Thu, 11 May 2006 15:44:27 -0400 Subject: [Mongrel] Upload progress "plugin" In-Reply-To: <44637ABE.9040309@ruby-lang.org> References: <44637ABE.9040309@ruby-lang.org> Message-ID: <1147376667.16187.1.camel@localhost.localdomain> On Thu, 2006-05-11 at 11:56 -0600, why the lucky stiff wrote: > mongreleers, > > This is a hack for adding basic upload progress support to Mongrel. > Currently, you can monitor the upload of any POST. I'm sure some work > needs to be done to get it functioning with Rails. Sweet, why. I'm actually working on something like this for the documentation as a plugin example. I'll chat with you about stealing this and doing the distribution. How do you think it'd work with Rails? I'll help you turn it into a plugin too. That'll be a good start for the doc. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Thu May 11 15:57:52 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Thu, 11 May 2006 15:57:52 -0400 Subject: [Mongrel] Mongrel 0.3.13 Pre-Release -- Out of Hibernation Message-ID: <1147377472.16187.19.camel@localhost.localdomain> Hello Mongrel Fans, After about a Month of busy work, bad computers, moving half my house across the country, and other dramas, I'm finally pushing out the next release of Mongrel. This pre-release has lots of little goodies and the start of some documentation that should get everyone primed for the big "Mongrel 0.4 Enterprisey Edition 1.2" coming real soon now. INSTALLING Anyone NOT using Win32 can install the pre-release with: gem install daemons gem install mongrel --source=http://mongrel.rubyforge.org/releases/ Please test all your apps and make sure that you don't have any problems. BUG REPORTING Report those bugs you find here: http://rubyforge.org/tracker/?atid=5145&group_id=1306&func=browse And put in any 0.4 feature requests you want in: http://rubyforge.org/tracker/?atid=5148&group_id=1306&func=browse 0.3.13 FEATURES This pre-release features lots of little fixes, and two nice contributions from Why and Dan Kubb. Why got file uploads working so that big files go to a tempfile. Dan Kubb got conditional responses for files working, so Mongrel seems super snappy. Here's the full list: * Large file uploads are streamed to a temp file rather than ram. (Thanks Why!) * Conditional HTTP responses for static files. (Thanks Dan Kubb!) * A fix to the start command?s?help so that?num-procs and?timeout are more clear. * A fix to the -B option since some idiot decided that they can change the object_id method of their classes to take a parameter. * No longer spews tons of junk to mongrel.log related to invalid parsing or closed client sockets. * Documented HttpRequest?s escape, unescape, and query_parse (which were stolen from Camping). * Removed some compiler warnings for unused variables in the C extension. * Rake now aborts with an obvious message if the http11 extension doesn?t build. * Requires ?resolv-replace? by default to prevent DNS queries from blocking Mongrel. If nobody reports problems by tomorrow then I'll have this rolled out as official and ready for Win32 folks as well. Enjoy! -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From technoweenie at gmail.com Thu May 11 18:37:42 2006 From: technoweenie at gmail.com (Rick Olson) Date: Thu, 11 May 2006 17:37:42 -0500 Subject: [Mongrel] Upload progress "plugin" In-Reply-To: <1147376667.16187.1.camel@localhost.localdomain> References: <44637ABE.9040309@ruby-lang.org> <1147376667.16187.1.camel@localhost.localdomain> Message-ID: <48fe25b0605111537q7ed7b4fbm4b3cb2709d831842@mail.gmail.com> I did some hacking on this in a Rails app and got basic ajax calls returning the status in JSON. The main change to Mongrel was the addition of Rails' MIME parsing classes. The progress status then looks like: respond_to do |accepts| accepts.html { out.write("size: #{status['size']}\nreceived: #{status['received']}\n") } accepts.js do head['Content-Type'] = 'text/javascript' out.write("{size:#{status['size']},received:#{status['received']}}") end end if status Here's the simple rails view / javascript I used to conduct the test: <% @upid = Time.now.to_i %> <%= start_form_tag "?upload_id=#{@upid}", :multipart => true, :onsubmit => "monitorUploadProgress(#{@upid})" %>

<%= file_field_tag :upload %>

<%= submit_tag :Upload %>

function monitorUploadProgress(upid) { new PeriodicalExecuter(function() { new Ajax.Request('/progress?upload_id=' + upid, { asynchronous:true, evalScripts:true, method:'get', onComplete:function(request) { new Insertion.Bottom('results', "
" +
request.responseText + "
"); } }); }, 3); } -- Rick Olson http://techno-weenie.net -------------- next part -------------- A non-text attachment was scrubbed... Name: mongrel_responds_to.diff Type: application/octet-stream Size: 10455 bytes Desc: not available Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20060511/8ba26353/attachment.obj From why at ruby-lang.org Thu May 11 19:06:26 2006 From: why at ruby-lang.org (why the lucky stiff) Date: Thu, 11 May 2006 17:06:26 -0600 Subject: [Mongrel] Upload progress "plugin" In-Reply-To: <48fe25b0605111537q7ed7b4fbm4b3cb2709d831842@mail.gmail.com> References: <44637ABE.9040309@ruby-lang.org> <1147376667.16187.1.camel@localhost.localdomain> <48fe25b0605111537q7ed7b4fbm4b3cb2709d831842@mail.gmail.com> Message-ID: <4463C372.3050708@ruby-lang.org> Rick Olson wrote: > respond_to do |accepts| > accepts.html { out.write("size: #{status['size']}\nreceived: > #{status['received']}\n") } > accepts.js do > head['Content-Type'] = 'text/javascript' > out.write("{size:#{status['size']},received:#{status['received']}}") > end > end if status Let's get it checked in. What about: respond_to do |accepts| accepts.html { out.write("size: #{status['size']}\nreceived: #{status['received']}\n") } accepts.js { out.write("{size:#{status['size']},received:#{status['received']}}") } end if status We're storing all the mimetypes, let's do a nice thing. _why From zedshaw at zedshaw.com Thu May 11 21:18:35 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Thu, 11 May 2006 21:18:35 -0400 Subject: [Mongrel] Upload progress "plugin" In-Reply-To: <48fe25b0605111537q7ed7b4fbm4b3cb2709d831842@mail.gmail.com> References: <44637ABE.9040309@ruby-lang.org> <1147376667.16187.1.camel@localhost.localdomain> <48fe25b0605111537q7ed7b4fbm4b3cb2709d831842@mail.gmail.com> Message-ID: <1147396715.6190.1.camel@localhost.localdomain> On Thu, 2006-05-11 at 17:37 -0500, Rick Olson wrote: > I did some hacking on this in a Rails app and got basic ajax calls > returning the status in JSON. The main change to Mongrel was the > addition of Rails' MIME parsing classes. The progress status then > looks like: > Whoa, that's an assload of Rails code suddenly showing up in Mongrel. Let's not check this in yet because there's already a simple MIME system in Mongrel. Also, I don't want this in the Mongrel code base, but rather as a GemPlugin distributed separately. I'll get with you and Why on how we can do that. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Thu May 11 21:20:05 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Thu, 11 May 2006 21:20:05 -0400 Subject: [Mongrel] Upload progress "plugin" In-Reply-To: <4463C372.3050708@ruby-lang.org> References: <44637ABE.9040309@ruby-lang.org> <1147376667.16187.1.camel@localhost.localdomain> <48fe25b0605111537q7ed7b4fbm4b3cb2709d831842@mail.gmail.com> <4463C372.3050708@ruby-lang.org> Message-ID: <1147396805.6190.4.camel@localhost.localdomain> On Thu, 2006-05-11 at 17:06 -0600, why the lucky stiff wrote: > Rick Olson wrote: > > respond_to do |accepts| > > accepts.html { out.write("size: #{status['size']}\nreceived: > > #{status['received']}\n") } > > accepts.js do > > head['Content-Type'] = 'text/javascript' > > out.write("{size:#{status['size']},received:#{status['received']}}") > > end > > end if status > Let's get it checked in. What about: > > respond_to do |accepts| > accepts.html { out.write("size: #{status['size']}\nreceived: > #{status['received']}\n") } > accepts.js { > out.write("{size:#{status['size']},received:#{status['received']}}") } > end if status > > We're storing all the mimetypes, let's do a nice thing. Hold up, don't check anything in. I want to do this as a GemPlugin people can add. I'm also dead against including tons of Rails code. Typically this ends up going really bad for the other frameworks as demonstrated when Camping was doing AR and causing issues with Rails AR. Let's coordinate this before shooting it into the main Mongrel core. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Thu May 11 21:31:27 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Thu, 11 May 2006 21:31:27 -0400 Subject: [Mongrel] New projects/mongrel_upload_progress (Was: Upload progress "plugin") In-Reply-To: <4463C372.3050708@ruby-lang.org> References: <44637ABE.9040309@ruby-lang.org> <1147376667.16187.1.camel@localhost.localdomain> <48fe25b0605111537q7ed7b4fbm4b3cb2709d831842@mail.gmail.com> <4463C372.3050708@ruby-lang.org> Message-ID: <1147397487.6190.10.camel@localhost.localdomain> Hey Why and Rick, I carved you a little corner of the svn just for your snazzy upload progress code. You now can do all your own stuffs in the projects/mongrel_upload_progress directory. It's all setup and ready to be turned into a gemplugin. Basic process is read: http://mongrel.rubyforge.org/docs/gem_plugin.html So you get an idea of how they're crafted, then here's the RDoc: http://mongrel.rubyforge.org/gem_plugin_rdoc/ Once you got a handle on that, you just fill in the lib with your code, hook up the init.rb and you're golden. Let me know if there's *minor* core API changes that need to be made to get this stuff working. To test it out you just build the gem with the Rakefile, then run your test app. The theory is if you did it right folks should be able to install your handlers by writing a config/mongrel.conf and using the -S command line option (or whatever Why does for Camping). Ping me up as you do this so I can help you through the stuff. I'll be interested in writing a document on how it was made. On Thu, 2006-05-11 at 17:06 -0600, why the lucky stiff wrote: > Rick Olson wrote: > > respond_to do |accepts| > > accepts.html { out.write("size: #{status['size']}\nreceived: > > #{status['received']}\n") } > > accepts.js do > > head['Content-Type'] = 'text/javascript' > > out.write("{size:#{status['size']},received:#{status['received']}}") > > end > > end if status > Let's get it checked in. What about: > > respond_to do |accepts| > accepts.html { out.write("size: #{status['size']}\nreceived: > #{status['received']}\n") } > accepts.js { > out.write("{size:#{status['size']},received:#{status['received']}}") } > end if status > > We're storing all the mimetypes, let's do a nice thing. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From why at ruby-lang.org Thu May 11 21:57:25 2006 From: why at ruby-lang.org (why the lucky stiff) Date: Thu, 11 May 2006 19:57:25 -0600 Subject: [Mongrel] Upload progress "plugin" In-Reply-To: <1147396805.6190.4.camel@localhost.localdomain> References: <44637ABE.9040309@ruby-lang.org> <1147376667.16187.1.camel@localhost.localdomain> <48fe25b0605111537q7ed7b4fbm4b3cb2709d831842@mail.gmail.com> <4463C372.3050708@ruby-lang.org> <1147396805.6190.4.camel@localhost.localdomain> Message-ID: <4463EB85.7000803@ruby-lang.org> Zed Shaw wrote: > On Thu, 2006-05-11 at 17:06 -0600, why the lucky stiff wrote: > >> Let's get it checked in. > Hold up, don't check anything in. I'm sorry, very bad choice of words. I am tremendously sorry about that. As a branch or a plugin, exactly. We talked about this in the presence of indian_chief earlier. I will consult his log. _why From dan at anotherdan.com Fri May 12 06:05:22 2006 From: dan at anotherdan.com (Dan Thrue) Date: Fri, 12 May 2006 12:05:22 +0200 Subject: [Mongrel] Mongrel 0.3.13 Pre-Release -- Out of Hibernation In-Reply-To: <1147377472.16187.19.camel@localhost.localdomain> References: <1147377472.16187.19.camel@localhost.localdomain> Message-ID: <478a1cee0605120305o79dc830kcfc0060adbaa53c0@mail.gmail.com> Good work guys, this pre-release boosted the perfomance of the application dramaticly... A little note from another happy customer :) On 5/11/06, Zed Shaw wrote: > Hello Mongrel Fans, > > After about a Month of busy work, bad computers, moving half my house > across the country, and other dramas, I'm finally pushing out the next > release of Mongrel. > > This pre-release has lots of little goodies and the start of some > documentation that should get everyone primed for the big "Mongrel 0.4 > Enterprisey Edition 1.2" coming real soon now. > > INSTALLING > > Anyone NOT using Win32 can install the pre-release with: > > gem install daemons > gem install mongrel --source=http://mongrel.rubyforge.org/releases/ > > Please test all your apps and make sure that you don't have any > problems. > > > BUG REPORTING > > Report those bugs you find here: > > http://rubyforge.org/tracker/?atid=5145&group_id=1306&func=browse > > And put in any 0.4 feature requests you want in: > > http://rubyforge.org/tracker/?atid=5148&group_id=1306&func=browse > > > 0.3.13 FEATURES > > This pre-release features lots of little fixes, and two nice > contributions from Why and Dan Kubb. Why got file uploads working so > that big files go to a tempfile. Dan Kubb got conditional responses for > files working, so Mongrel seems super snappy. Here's the full list: > > * Large file uploads are streamed to a temp file rather than ram. > (Thanks Why!) > * Conditional HTTP responses for static files. (Thanks Dan Kubb!) > * A fix to the start command's?help so that?num-procs and?timeout > are more clear. > * A fix to the -B option since some idiot decided that they can > change the object_id method of their classes to take a > parameter. > * No longer spews tons of junk to mongrel.log related to invalid > parsing or closed client sockets. > * Documented HttpRequest's escape, unescape, and query_parse > (which were stolen from Camping). > * Removed some compiler warnings for unused variables in the C > extension. > * Rake now aborts with an obvious message if the http11 extension > doesn't build. > * Requires 'resolv-replace' by default to prevent DNS queries from > blocking Mongrel. > > If nobody reports problems by tomorrow then I'll have this rolled out as > official and ready for Win32 folks as well. > > Enjoy! > > > -- > Zed A. Shaw > http://www.zedshaw.com/ > http://mongrel.rubyforge.org/ > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users From zedshaw at zedshaw.com Fri May 12 17:19:58 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Fri, 12 May 2006 17:19:58 -0400 Subject: [Mongrel] [ANN] New Mongrel 0.3.13 Documentation: HOWTO Do Everything Message-ID: <1147468798.14432.9.camel@localhost.localdomain> Just a quick note for a few new features/fixes available on the Mongrel pre-release and a new document that covers nearly all the big features and configurations for Mongrel. First, the document is http://mongrel.rubyforge.org/docs/howto.html and it covers: * All the start command options including the fresh -G option to generate a config for -C. * The format and usage of the MIME type file (-m option). * Using a YAML config file to set command line options (-C option). * Writing fancy Mongrel co * Improved "HOWTO":/docs/howto.html documentation with all options.nfig scripts in Ruby (-S option). * The POSIX signals Mongrel uses for restart, stop, and reload. * What the super debugging -B option produces and when to use it. * Quick start on installing the mongrel_cluster GemPlugin. The current pre-release now has the following fixes: * A fix for --num-procs and --timeout where they weren't really being set. * A new -G option for generating YAML configs for the -C option. Everyone should update from the releases directory with: $ gem uninstall mongrel $ gem install mongrel --source=http://mongrel.rubyforge.org/releases/ And try these out. Especially the --num-procs and --timeout since they weren't really being set previously (damn that's dumb). Luis is also asking to hold off on the official 0.3.13 release until he can fix up the win32 side and clean up the commands used there. He's got goodies in the works so that win32 folks can use the same mongrel_rails script everyone else is using, but get special win:: commands for managing the services. Enjoy! -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Fri May 12 23:23:26 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Fri, 12 May 2006 23:23:26 -0400 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Pre-Release Update Message-ID: <1147490606.10063.2.camel@localhost.localdomain> Hello Folks, There's another update to the Mongrel pre-release that fixes a small bug with the --version options to commands, and adds a new "version" command. Please update with: $ gem uninstall mongrel $ gem install mongrel --source=http://mongrel.rubyforge.org/releases/ And continue reporting problems to me. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From luislavena at gmail.com Sun May 14 12:20:04 2006 From: luislavena at gmail.com (Luis Lavena) Date: Sun, 14 May 2006 13:20:04 -0300 Subject: [Mongrel] Broken win32 service support for lastest mongrels. Message-ID: <71166b3b0605140920g1c707d1aq308db06a75cb9d78@mail.gmail.com> Ok, this might sound bad... well, actually it is. I'm my rewrite of mongrel_rails_service and provide a uniform set of commands in the line of gem_plugin commands, found a few issues while stopping the service. Thinking that rails (1.1.2) was responsable, tested against my 1.0.0 rails app, both with the same results. Again, reverted to mongrel 0.3.8, when services was working ok, with the same result (broken pipe during stop of the service). Weird, reverted to a fresh ruby installation (1.8.4, plain, not One-Click Installer), again with the same result. I need someone that could try lastest mongrel_rails_service against any version of rails, with correct start/stop functionality and that could share their setup. My guess is that my current XP is broken and will require revert to lastest image (last december). Until then, any feedback on this matter will be welcome. -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From zedshaw at zedshaw.com Sun May 14 14:47:07 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Sun, 14 May 2006 14:47:07 -0400 Subject: [Mongrel] Broken win32 service support for lastest mongrels. In-Reply-To: <71166b3b0605140920g1c707d1aq308db06a75cb9d78@mail.gmail.com> References: <71166b3b0605140920g1c707d1aq308db06a75cb9d78@mail.gmail.com> Message-ID: <1147632427.5848.2.camel@localhost.localdomain> Hey Luis, I'll take a look at it today. I have a *fresh* XP install with no Ruby installed on it even. Zed On Sun, 2006-05-14 at 13:20 -0300, Luis Lavena wrote: > Ok, this might sound bad... well, actually it is. > > I'm my rewrite of mongrel_rails_service and provide a uniform set of > commands in the line of gem_plugin commands, found a few issues while > stopping the service. > > Thinking that rails (1.1.2) was responsable, tested against my 1.0.0 > rails app, both with the same results. > > Again, reverted to mongrel 0.3.8, when services was working ok, with > the same result (broken pipe during stop of the service). > > Weird, reverted to a fresh ruby installation (1.8.4, plain, not > One-Click Installer), again with the same result. > > I need someone that could try lastest mongrel_rails_service against > any version of rails, with correct start/stop functionality and that > could share their setup. > > My guess is that my current XP is broken and will require revert to > lastest image (last december). > > Until then, any feedback on this matter will be welcome. > From zedshaw at zedshaw.com Sun May 14 19:46:56 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Sun, 14 May 2006 19:46:56 -0400 Subject: [Mongrel] [UPDATE] Mongrel 0.3.13 Pre-Release -- Conditional Responses, Better Parsing Message-ID: <1147650416.11722.18.camel@localhost.localdomain> Hi Folks, As you can tell we're getting closer to the 0.3.13 release being official. There's a new pre-release available for non-win32 users: gem install mongrel --source=http://mongrel.rubyforge.org/releases/ Which has the following fixes and enhancements: * Rewritten internal HTTP processing to protect against trickle attacks. This means that a client can send one byte of a request at a time and Mongrel will process it without backtracking or altering parser states. * Cleaned up parser internals to handle reallocated ram from Ruby's string extending code. * Applied a patch from Dan Kubb to ensure that ETags are returned on 304 responses. * Version display and usage line changes. The changes to the internal parser and IO are still very fresh, so let me know if you hit any problems. I'm still going through the code audit process on this, so especially let me know if Mongrel aborts on you with a particular error message. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From luislavena at gmail.com Sun May 14 23:52:45 2006 From: luislavena at gmail.com (Luis Lavena) Date: Mon, 15 May 2006 00:52:45 -0300 Subject: [Mongrel] Broken win32 service support for lastest mongrels. In-Reply-To: <1147632427.5848.2.camel@localhost.localdomain> References: <71166b3b0605140920g1c707d1aq308db06a75cb9d78@mail.gmail.com> <1147632427.5848.2.camel@localhost.localdomain> Message-ID: <71166b3b0605142052k57ad2a27p1a08f8896a1921bc@mail.gmail.com> Thank you Zed, Again, I decide to do this against my health (my fiance will kill me for doing this on Sunday), anyway: * Revert to my last december xp installation image (thank you Acronis!). * Used a clean Ruby 1.8.4 with readline, iconv and zlib compiled locally (no the One Click Installer). These are the gems I installed to test Rails 1.0.0: actionmailer (1.1.5) actionpack (1.11.2) actionwebservice (1.0.0) activerecord (1.13.2) activesupport (1.2.5) mongrel (0.3.8) rails (1.0.0) rake (0.7.1) sources (0.0.1) sqlite3-ruby (1.1.0) win32-service (0.5.0) * Created a empty rails 1.0.0 app name myservice. * Checked it worked with webrick, and mongrel_rails start and got this information from index.html: Ruby version 1.8.4 (i386-mswin32) RubyGems version 0.8.11 Rails version 1.0.0 Active Record version 1.13.2 Action Pack version 1.11.2 Action Web Service version 1.0.0 Action Mailer version 1.1.5 Active Support version 1.2.5 Application root D:/Programming/Sources/myservice Environment development Database adapter sqlite3 So far, that was OK. * Installed 'myservice' using mongrel_rails_service: mongrel_rails_service -n myservice -e development (force the development environment instead of production as default) * Started the service, after 10 seconds, service was ready, checked and compared with previous output, was ok. * Stopped the service using mongrel_rails_service stop, it stopped just fine. Before I jump into conclusion, done a new start & stop round, this time with a broken pipe error. Conclusion: something don't work the same way twice. To probe that I was doing something wrong (which most of the times that is correct), I created the simple http_service.rb attached to this message. It only create a Simple Handler and a DirHandler of the local folder, always listening in port 3000. So far, tested against 0.3.8 and 0.3.12.4 of mongrel, functionality was ok (no problem pipe here). I changed a lot of the "concept" on how the services work in this script, so I need help from all the windows users on the list. Please download the script, put in some folder, and run: >ruby http_service.rb install >ruby http_service.rb start Browse to http://localhost:3000 Check it worked, then stop the service: >ruby http_service.rb stop (please check if it report errors or not). Run with remove command to remove the service from your machine. Reply to this post with your environment: >ruby -v >ver (windows version) Ex: Microsoft Windows XP [Version 5.1.2600] Against which version of Mongrel you tested it. I have found that the lack of locking in the debugging methods causes the broken pipe errors. I'll find workaround (maybe add logging to eventlog of win32), suggestions are welcome. Thank you guys for the time you spend on this, I really appreciate it. Based on this progress, I'll rewrite the new mongrel_service script to fix this and will try. Please, anyone with problems, reply this so we could get these fixed in the next release. Later, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi -------------- next part -------------- A non-text attachment was scrubbed... Name: http_service.rb Type: application/octet-stream Size: 3585 bytes Desc: not available Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20060515/7e6fd57e/attachment.obj From zedshaw at zedshaw.com Mon May 15 01:42:20 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Mon, 15 May 2006 01:42:20 -0400 Subject: [Mongrel] Broken win32 service support for lastest mongrels. In-Reply-To: <71166b3b0605142052k57ad2a27p1a08f8896a1921bc@mail.gmail.com> References: <71166b3b0605140920g1c707d1aq308db06a75cb9d78@mail.gmail.com> <1147632427.5848.2.camel@localhost.localdomain> <71166b3b0605142052k57ad2a27p1a08f8896a1921bc@mail.gmail.com> Message-ID: <1147671740.11165.4.camel@localhost.localdomain> Ok, I'll try this out too. On Mon, 2006-05-15 at 00:52 -0300, Luis Lavena wrote: > Please download the script, put in some folder, and run: > >ruby http_service.rb install > >ruby http_service.rb start > Browse to http://localhost:3000 > Check it worked, then stop the service: > >ruby http_service.rb stop > (please check if it report errors or not). > Run with remove command to remove the service from your machine. One question, if the service stops then what about just not caring about the error? If it doesn't actually stop the system from functioning, we can probably just ignore it. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From luislavena at gmail.com Mon May 15 01:55:29 2006 From: luislavena at gmail.com (Luis Lavena) Date: Mon, 15 May 2006 02:55:29 -0300 Subject: [Mongrel] Broken win32 service support for lastest mongrels. In-Reply-To: <1147671740.11165.4.camel@localhost.localdomain> References: <71166b3b0605140920g1c707d1aq308db06a75cb9d78@mail.gmail.com> <1147632427.5848.2.camel@localhost.localdomain> <71166b3b0605142052k57ad2a27p1a08f8896a1921bc@mail.gmail.com> <1147671740.11165.4.camel@localhost.localdomain> Message-ID: <71166b3b0605142255w7b7ebac8tced722908e0e6001@mail.gmail.com> On 5/15/06, Zed Shaw wrote: [snip] > One question, if the service stops then what about just not caring about > the error? If it doesn't actually stop the system from functioning, we > can probably just ignore it. The problem is that sometimes... that depends on windows mood. I have seen a few times that after you got the broken pipe error, the offending process (the service) is still running, but don't answer via http nor any attempts to stop it again. Besides, average users will use the Service Manager to handle the service, which will show error messages (and we didn't talk about eventlog!). If we could fix it, less reports about that problem will raise in the future and we wil get a better user experience overall... Later, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From Daniel.Berger at qwest.com Mon May 15 10:43:49 2006 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Mon, 15 May 2006 09:43:49 -0500 Subject: [Mongrel] Broken win32 service support for lastest mongrels. Message-ID: <39AA6550E5AA554AB1456707D6E5563DBD0013@QTOMAE2K3M01.AD.QINTRA.COM> > -----Original Message----- > From: mongrel-users-bounces at rubyforge.org > [mailto:mongrel-users-bounces at rubyforge.org] On Behalf Of Luis Lavena > Sent: Sunday, May 14, 2006 11:55 PM > To: mongrel-users at rubyforge.org > Subject: Re: [Mongrel] Broken win32 service support for > lastest mongrels. > > > On 5/15/06, Zed Shaw wrote: > [snip] > > One question, if the service stops then what about just not caring > > about the error? If it doesn't actually stop the system from > > functioning, we can probably just ignore it. > > The problem is that sometimes... that depends on windows > mood. I have seen a few times that after you got the broken > pipe error, the offending process (the service) is still > running, but don't answer via http nor any attempts to stop it again. > > Besides, average users will use the Service Manager to handle > the service, which will show error messages (and we didn't > talk about eventlog!). > > If we could fix it, less reports about that problem will > raise in the future and we wil get a better user experience overall... I've forwarded this to the win32utils-devel list to see if anyone has any insight. Oh, and I should mention that I'm working on a pure Ruby version of win32-eventlog. I hope to have it out in the next couple of weeks. Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. From joshmh at gmail.com Mon May 15 10:58:25 2006 From: joshmh at gmail.com (Joshua Harvey) Date: Mon, 15 May 2006 16:58:25 +0200 Subject: [Mongrel] Mongrel and ssl? behind Pound Message-ID: <3527dd260605150758h1a41ce7ere36e9ebd74915886@mail.gmail.com> I was about to write a long post about how I couldn't get request.ssl?to work in Rails behind Pound and Mongrel, but then I figured it out. In your pound.cfg file, just add: HTTPSHeaders 1 "X-Forwarded-Proto: https" Assuming you've got Pound working correctly with SSL, this will giveRails the header it's looking for. If there's any interest in a Debian setup of Mongrel + Lighty behindPound, I'd be happy to write down what I did. The only reasons I'meven using Lighty is because I couldn't figure out how to add Expireheaders to static content in Mongrel and because I need PHP for Mint. Joshhttp://shnoo.gr From born70s at gmail.com Mon May 15 20:13:58 2006 From: born70s at gmail.com (Kevin) Date: Mon, 15 May 2006 17:13:58 -0700 Subject: [Mongrel] Pass env var from Apache to Mongrel? Message-ID: I use Apache to serve the static pages and let Mongrel handle Rails requests via mod_rewrite/proxy. Apache RewriteRule can set environment variable on the fly, and this is one of the features I used, set an env var based on domain name. I used to use SCGI Runner which was fine as the env var was passed to Rails via scgi protocol. I seems can't find a way to set env var in Mongrel on the fly. One work around I can think of is to append a variable to the query string, but that's less elegant nor secure. Any thoughts? Thanks, Kevin From zedshaw at zedshaw.com Mon May 15 20:42:31 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Mon, 15 May 2006 20:42:31 -0400 Subject: [Mongrel] Pass env var from Apache to Mongrel? In-Reply-To: References: Message-ID: <1147740151.5869.4.camel@localhost.localdomain> Hi Kevin, On Mon, 2006-05-15 at 17:13 -0700, Kevin wrote: > I use Apache to serve the static pages and let Mongrel handle Rails > requests via mod_rewrite/proxy. Apache RewriteRule can set > environment variable on the fly, and this is one of the features I > used, set an env var based on domain name. You should look at how mod_rewrite can inject HTTP headers. This is commonly used when you have to translate to a different Host string, but you can really inject any HTTP header you want. On the Rails side it should show up as a capitalized version like this: X-MyBrother-Is-Jim => X_MYBROTHER_IS_JIM And will be in the request hash like all the other parameters you can get. Key thing is to not put this in the request string (like you said). -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From luislavena at gmail.com Tue May 16 02:13:45 2006 From: luislavena at gmail.com (Luis Lavena) Date: Tue, 16 May 2006 03:13:45 -0300 Subject: [Mongrel] Broken win32 service support for lastest mongrels. In-Reply-To: <39AA6550E5AA554AB1456707D6E5563DBD0013@QTOMAE2K3M01.AD.QINTRA.COM> References: <39AA6550E5AA554AB1456707D6E5563DBD0013@QTOMAE2K3M01.AD.QINTRA.COM> Message-ID: <71166b3b0605152313i2b5adef8q5ef06f9549b9c458@mail.gmail.com> On 5/15/06, Berger, Daniel wrote: > I've forwarded this to the win32utils-devel list to see if anyone has > any insight. > Ok, done a new round of code to pin-point the problem. Attached it http_service2.rb, this file implements a Mongrel::Configurator instead of plain HttpServer. If you check the service_main code, will see that the first version explicit start (run) the server here, but this instead need to call run in the service_init to get it working. Also, there is no need to call @config.stop there, because it never get called. In previous mail I talked about "ghost process" (or orphaned ones, whatever). if you change service_main from: while state == RUNNING sleep 1 end to: @config.join It will start and stop ok, but checking the task manager, a ruby.exe process was left behind, with 3 threads! I tested this with ruby.exe and rubyw.exe What really annoys me is that KirbyBase, which also offer a win32 service, join the drb thread (like @config.join) in the service_main all without problems... Anyway, So far, the code in the attach works ok, on any condition, BUT.... the same setup didn't work for rails (besides there are some issues with load_plugins). Please try this new script, and reply or mail me personally. I really appreciate the time the list take on helping solve this issue. Regards, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi -------------- next part -------------- A non-text attachment was scrubbed... Name: http_service2.rb Type: application/octet-stream Size: 3562 bytes Desc: not available Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20060516/ee21858f/attachment.obj From born70s at gmail.com Tue May 16 03:47:48 2006 From: born70s at gmail.com (Kevin) Date: Tue, 16 May 2006 00:47:48 -0700 Subject: [Mongrel] Pass env var from Apache to Mongrel? In-Reply-To: <1147740151.5869.4.camel@localhost.localdomain> References: <1147740151.5869.4.camel@localhost.localdomain> Message-ID: Zed, I did what you suggested through mod_header and it works like a charm (well, it has to be Apache 2.0+ as RequestHeader is not available in 1.3). Thanks for your work, Mongrel rocks. Cheers, Kevin From choonkeat at gmail.com Thu May 18 02:58:56 2006 From: choonkeat at gmail.com (choonkeat) Date: Thu, 18 May 2006 14:58:56 +0800 Subject: [Mongrel] mime yaml Message-ID: <64e1f5070605172358s29c5e00bxffd3634f12689b50@mail.gmail.com> First off, apologies if this is addressed.. I didn't find anyone having the same problem (which usually means the problem is me!) I'm running the standard command to start a Rails server, with additional custom mime YAML: mongrel_rails start -m /etc/mongrel_mime.yml Content of the /etc/mongrel_mime.yml is only a single line: .xml: text/xml However, the custom mime isn't picked up and my XML files were served with default mime. A bit of digging I found trunk/bin/mongrel_rails (line 87) containing lines to parse the YAML file: mime = {} if defaults[:mime_map] log "Loading additional MIME types from #{defaults[:mime_map]}" mime = load_mime_map(defaults[:mime_map], mime) end The only thing is... the variable "mime" wasn't used anywhere. Further down at line 99 is: uri "/", :handler => rails The custom mime will only be picked up if I change that line to: uri "/", :handler => rails({:mime => mime}) What am i missing here? Why isn't the 'mime' local variable used? Thanks for any enlightenment -- choonkeat http://www.rssfwd.com/ From zedshaw at zedshaw.com Thu May 18 12:00:05 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Thu, 18 May 2006 12:00:05 -0400 Subject: [Mongrel] mime yaml In-Reply-To: <64e1f5070605172358s29c5e00bxffd3634f12689b50@mail.gmail.com> References: <64e1f5070605172358s29c5e00bxffd3634f12689b50@mail.gmail.com> Message-ID: <1147968005.5888.2.camel@localhost.localdomain> On Thu, 2006-05-18 at 14:58 +0800, choonkeat wrote: > The custom mime will only be picked up if I change that line to: > uri "/", :handler => rails({:mime => mime}) > Ah, it's a bug. And it's fixed in the svn and pre-release. Please update from http://mongrel.rubyforge.org/releases/ to get it. I'm gonna look for more things like this and let you know. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From kyle at kylemaxwell.com Fri May 19 15:17:29 2006 From: kyle at kylemaxwell.com (Kyle Maxwell) Date: Fri, 19 May 2006 12:17:29 -0700 Subject: [Mongrel] Mongrel/Apache and static content Message-ID: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> I'm looking for an easy way to have mongrel only serve dynamic railscontent, while letting Apache serve non-Rails content. Unfortunately,it seems that you have to segregate the static content in its ownfolder. That was also the case with the SCGI runner. I used thetrick outlined athttp://comments.gmane.org/gmane.comp.lang.ruby.rails/23347 to managethis. I was curious if a similar trick would be the best way tohandle this issue with Mongrel. I'm hoping that there's a simpler wayI've overlooked. -- Kyle MaxwellChief TechnologistE Factor Media // FN Interactivekyle at efactormedia.com1-866-263-3261 From Will_Green at URSCorp.com Fri May 19 15:23:58 2006 From: Will_Green at URSCorp.com (Will_Green at URSCorp.com) Date: Fri, 19 May 2006 15:23:58 -0400 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> Message-ID: This can be accomplished easily with mod_proxy (assuming only one rails app per virtual host, and using Apache 2.2 with mod_proxy_balancer). ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass /javascripts ! ProxyPass / balancer://myapp/ ProxyPassReverse / balancer://myapp/ == Will Green Web Developer & IT Coordinator, URS Creative Imaging http://www.urscreativeimaging.com/ 7650 West Courtney Campbell Causeway Suite 700 Tampa, FL 33607 813.675.6849 (direct) 813.286.1711 (main) This e-mail and any attachments are confidential. If you receive this message in error or are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy the e-mail and any attachments or copies. From kyle at kylemaxwell.com Fri May 19 17:38:38 2006 From: kyle at kylemaxwell.com (Kyle Maxwell) Date: Fri, 19 May 2006 14:38:38 -0700 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> Message-ID: <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> > This can be accomplished easily with mod_proxy (assuming only one rails app> per virtual host, and using Apache 2.2 with mod_proxy_balancer). I don't think you read my post. Particularly, the part where I said: > Unfortunately, it seems that you have to segregate the static content in its own> folder. To clarify, I was wondering about mixing static and dynamic content inthe same folder or folder hierarchy. -- Kyle Maxwell From zedshaw at zedshaw.com Fri May 19 17:45:34 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Fri, 19 May 2006 17:45:34 -0400 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> Message-ID: <1148075134.5852.0.camel@localhost.localdomain> Hi Kyle, You'll need a set of mod_rewrite rules to really get this right. I'm currently writing the apache best practice documentation, so I'll ping the list and you specifically when that's working right. Zed On Fri, 2006-05-19 at 14:38 -0700, Kyle Maxwell wrote: > > This can be accomplished easily with mod_proxy (assuming only one rails app> per virtual host, and using Apache 2.2 with mod_proxy_balancer). > I don't think you read my post. Particularly, the part where I said: > > Unfortunately, it seems that you have to segregate the static content in its own> folder. > To clarify, I was wondering about mixing static and dynamic content inthe same folder or folder hierarchy. > > -- Kyle Maxwell > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users From bradley at railsmachine.com Fri May 19 18:45:19 2006 From: bradley at railsmachine.com (bradley taylor) Date: Fri, 19 May 2006 18:45:19 -0400 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: <1148075134.5852.0.camel@localhost.localdomain> References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> <1148075134.5852.0.camel@localhost.localdomain> Message-ID: Hey y'all... Give this a try and let me know how it works! http://fluxura.com/articles/2006/05/19/apache-for-static-and-mongrel- for-rails-with-mod_deflate-and-capistrano-support Thanks, Bradley Taylor ------ Rails Machine Simplified Ruby on Rails application deployment http://railsmachine.com On May 19, 2006, at 5:45 PM, Zed Shaw wrote: > Hi Kyle, > > You'll need a set of mod_rewrite rules to really get this right. I'm > currently writing the apache best practice documentation, so I'll ping > the list and you specifically when that's working right. > > Zed > > On Fri, 2006-05-19 at 14:38 -0700, Kyle Maxwell wrote: >>> This can be accomplished easily with mod_proxy (assuming only one >>> rails app> per virtual host, and using Apache 2.2 with >>> mod_proxy_balancer). >> I don't think you read my post. Particularly, the part where I said: >>> Unfortunately, it seems that you have to segregate the static >>> content in its own> folder. >> To clarify, I was wondering about mixing static and dynamic >> content inthe same folder or folder hierarchy. >> >> -- Kyle Maxwell >> _______________________________________________ >> Mongrel-users mailing list >> Mongrel-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/mongrel-users > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users From kyle at kylemaxwell.com Fri May 19 19:02:19 2006 From: kyle at kylemaxwell.com (Kyle Maxwell) Date: Fri, 19 May 2006 16:02:19 -0700 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> <1148075134.5852.0.camel@localhost.localdomain> Message-ID: <68eb3dd10605191602q1d274d9bh94d943af4b193b9c@mail.gmail.com> > http://fluxura.com/articles/2006/05/19/apache-for-static-and-mongrel-> for-rails-with-mod_deflate-and-capistrano-support That's a mouthful, but it sounds promising :) From jason at joyent.com Fri May 19 19:21:16 2006 From: jason at joyent.com (Jason Hoffman) Date: Fri, 19 May 2006 16:21:16 -0700 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: <68eb3dd10605191602q1d274d9bh94d943af4b193b9c@mail.gmail.com> References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> <1148075134.5852.0.camel@localhost.localdomain> <68eb3dd10605191602q1d274d9bh94d943af4b193b9c@mail.gmail.com> Message-ID: On May 19, 2006, at 4:02 PM, Kyle Maxwell wrote: >> http://fluxura.com/articles/2006/05/19/apache-for-static-and- >> mongrel-> for-rails-with-mod_deflate-and-capistrano-support > That's a mouthful, but it sounds promising :) > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users It's just the # Redirect all non-static requests to cluster RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] part for what you're asking for and Bradley's correct, that will work fine for you. That's a nice elegant two line config for that (nice work bradley). We tend to stick to only proxying rather than rewriting and while you can do ProxyPass /favicon.ico ! There isn't any respect for a wildcard there in the proxy pass directive. Regards, J ???????????????????????????????????????????????????????????? Jason A. Hoffman, PhD | Founder, CTO, Joyent Inc. Email: jason at joyent.com or jason at textdrive.com ???????????????????????????????????????????????????????????? From bradley at railsmachine.com Fri May 19 21:02:43 2006 From: bradley at railsmachine.com (bradley taylor) Date: Fri, 19 May 2006 21:02:43 -0400 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> <1148075134.5852.0.camel@localhost.localdomain> <68eb3dd10605191602q1d274d9bh94d943af4b193b9c@mail.gmail.com> Message-ID: <8B689907-DF98-4D2D-AA9A-6698F81C63CB@railsmachine.com> Hi Jason, On May 19, 2006, at 7:21 PM, Jason Hoffman wrote: > > # Redirect all non-static requests to cluster > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} > [P,QSA,L] > part for what you're asking for and Bradley's correct, that will work > fine for you. I should have highlighted that part! Thanks for pointing it out. > That's a nice elegant two line config for that (nice > work bradley). Thanks! > > We tend to stick to only proxying rather than rewriting and while you > can do > > ProxyPass /favicon.ico ! > > There isn't any respect for a wildcard there in the proxy pass > directive. There's definitely a trade off of performance for configuration simplicity/maintainability. The rewrites certainly have a negative impact on performance, but the ability to "config and forget" is pretty appealing for a lot of deployments. If you don't use Rails page caching and you don't mind occasionally adding additional ProxyPass directives for application specific assets, then proxying is the way to go. Modifying the Apache conf to add a file_column or reloading a new conf to support Capistrano's disable_web is kind of a drag (and an annoyance for automated deployment/configuration). I'm hoping to find a better balance between the two approaches than what I wrote up, but need to spend more time with httperf (and a big jug of corn whiskey). I imagine the answer is dependent on the maturity of one's application, comfort level with sysadmin stuff, and need to support 2000 requests/sec or 2000 requests/week! It would be nice to have some good benchmarks on various deployments and graph the relationship between simplicity, features, and performance. Unfortunately, I tend to quickly loose productive development hours when I get sucked into the parallel universe that is httperf and Apache configuration tweaking. What we, the Mongrel Nation, need is a front-end with the simplicity of Pound combined with Lighty's static performance, good caching support, and select Apache features . Seems like quite an opportunity for an enterprising C/C++ developer... Regards, Bradley Taylor ------ Rails Machine Simplified Ruby on Rails application deployment http://railsmachine.com From rsaccon at gmail.com Sat May 20 13:04:59 2006 From: rsaccon at gmail.com (Roberto Saccon) Date: Sat, 20 May 2006 14:04:59 -0300 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> <1148075134.5852.0.camel@localhost.localdomain> Message-ID: Bradley, I tried this apache config and it worked fien. Only issue I found: After uncommenting all logfile lines, I got an error at: logs/your_app_deflate_log I replaced with: logs/your_app_deflate_log deflate and it worked, but (so far) only compressed HTML files and no javascript or CSS files (Browser: Firefox 1.5.3) But considering that is took a couple of minutes to get and compile form source apache 2.2.2 and make it work with mongrel, I am more than satisfied with the result. (With my lighty-mongrel setup I didn't get compressing to work at all) regards Roberto On 5/19/06, bradley taylor wrote: > > Hey y'all... > > Give this a try and let me know how it works! > > http://fluxura.com/articles/2006/05/19/apache-for-static-and-mongrel- > for-rails-with-mod_deflate-and-capistrano-support > > Thanks, > Bradley Taylor > > ------ > Rails Machine > Simplified Ruby on Rails application deployment > http://railsmachine.com > > On May 19, 2006, at 5:45 PM, Zed Shaw wrote: > > > Hi Kyle, > > > > You'll need a set of mod_rewrite rules to really get this right. I'm > > currently writing the apache best practice documentation, so I'll ping > > the list and you specifically when that's working right. > > > > Zed > > > > On Fri, 2006-05-19 at 14:38 -0700, Kyle Maxwell wrote: > >>> This can be accomplished easily with mod_proxy (assuming only one > >>> rails app> per virtual host, and using Apache 2.2 with > >>> mod_proxy_balancer). > >> I don't think you read my post. Particularly, the part where I said: > >>> Unfortunately, it seems that you have to segregate the static > >>> content in its own> folder. > >> To clarify, I was wondering about mixing static and dynamic > >> content inthe same folder or folder hierarchy. > >> > >> -- Kyle Maxwell > >> _______________________________________________ > >> Mongrel-users mailing list > >> Mongrel-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/mongrel-users > > > > _______________________________________________ > > Mongrel-users mailing list > > Mongrel-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/mongrel-users > > > > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > -- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060520/e870ce4f/attachment.htm From jason at joyent.com Sat May 20 14:29:51 2006 From: jason at joyent.com (Jason Hoffman) Date: Sat, 20 May 2006 11:29:51 -0700 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> <1148075134.5852.0.camel@localhost.localdomain> Message-ID: <6BF407E9-FDCD-40D1-A311-F70E044FE2ED@joyent.com> On May 20, 2006, at 10:04 AM, Roberto Saccon wrote: > and it worked, but (so far) only compressed HTML files and no > javascript or CSS files (Browser: Firefox 1.5.3) So that's because of # Deflate AddOutputFilterByType DEFLATE text/html text/plain text/xml With mod_deflate you have two options: compress everything by default and exclude what you don't want to run through (like .gif), or compress nothing by default and include the mime types you want to compress. I call this implicit (these are the "Set" commands) or explicit (these are the "Add" commands) compression. Bradley's config is explicit because it lists the mime-types. I put a complete config example at http://textsnippets.com/posts/show/ 486 - J From jason at joyent.com Sat May 20 14:48:19 2006 From: jason at joyent.com (Jason Hoffman) Date: Sat, 20 May 2006 11:48:19 -0700 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: <8B689907-DF98-4D2D-AA9A-6698F81C63CB@railsmachine.com> References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> <1148075134.5852.0.camel@localhost.localdomain> <68eb3dd10605191602q1d274d9bh94d943af4b193b9c@mail.gmail.com> <8B689907-DF98-4D2D-AA9A-6698F81C63CB@railsmachine.com> Message-ID: On May 19, 2006, at 6:02 PM, bradley taylor wrote: > There's definitely a trade off of performance for configuration > simplicity/maintainability. The rewrites certainly have a negative > impact on performance, but the ability to "config and forget" is > pretty appealing for a lot of deployments. Yes, agreed. > If you don't use Rails page caching One question here is where one does the caching. On web servers? In a cache module in your switches/routers? Dedicated edge of network caches? RAM caches on dedicated load-balancers (this is generally where we let caching happen)? When it comes to caching on web servers I think the issue really of cached versus dynamic is speed of ramp-up to a steady state. When you get a big enough bump of traffic, can you respond without getting so far behind that you can't recover? The usual question I ask is whether the application and web is already up and humming, and if so, can it saturate the network connection? > and you don't mind occasionally adding additional > ProxyPass directives for application specific assets, then proxying > is the way to go. Modifying the Apache conf to add a file_column or > reloading a new conf to support Capistrano's disable_web is kind of a > drag (and an annoyance for automated deployment/configuration). Yes, luckily rails applications are pretty standard, a single ProxyPass /images ! is sufficient for all sites. And while mod_rewrite versus mod_proxy to do the proxying itself are mutually exclusive, I thought you could combine other aspects/functions. I forget (because I typically don't combine them) is it really the case the a series of mod_rewrite rules are ignored when followed by proxy pass directives? > It would be nice to have some good benchmarks on various > deployments and > graph the relationship between simplicity, features, and performance. > Unfortunately, I tend to quickly loose productive development hours > when I get sucked into the parallel universe that is httperf and > Apache configuration tweaking. It probably wouldn't be much different. We've been doing quite of a bit of tracing through the stack with dtrace (dtrace in Kernel SSL, mod_dtrace in apache2, dtrace providers in ruby, dtrace providers in postgresql etc) and the rewriting process in apache isn't too heavy for most common rewrites (mod_security is a heavier module). > What we, the Mongrel Nation, need is a front-end with the simplicity > of Pound combined with Lighty's static performance, good caching > support, and select Apache features . Seems like quite an opportunity > for an enterprising C/C++ developer... If someone has specific ideas about this (I do) and would interested in being employed doing it, let me know. - J From zedshaw at zedshaw.com Sat May 20 15:51:40 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Sat, 20 May 2006 15:51:40 -0400 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> <1148075134.5852.0.camel@localhost.localdomain> <68eb3dd10605191602q1d274d9bh94d943af4b193b9c@mail.gmail.com> <8B689907-DF98-4D2D-AA9A-6698F81C63CB@railsmachine.com> Message-ID: <1148154700.6035.18.camel@localhost.localdomain> On Sat, 2006-05-20 at 11:48 -0700, Jason Hoffman wrote: > > What we, the Mongrel Nation, need is a front-end with the simplicity > > of Pound combined with Lighty's static performance, good caching > > support, and select Apache features . Seems like quite an opportunity > > for an enterprising C/C++ developer... > > If someone has specific ideas about this (I do) and would interested > in being employed doing it, let me know. Well, I guess it's time to just let everyone know that I'm working on a "super secret" proxy server to go along with Mongrel that would basically do all the stuff Bradley is talking about (which Bradley knows so I'm curious why he's jamming my game! :-). It's only secret because I'm still rolling the code around in my head and trying out alternative designs between Mongrel stints and Adult Swim viewings. There's also a few other folks working on something similar, but I'll let them tell everyone. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Sat May 20 16:30:08 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Sat, 20 May 2006 16:30:08 -0400 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Update -- Code Review, Code Coverage Message-ID: <1148157008.6035.39.camel@localhost.localdomain> Hey Folks, I've been holding off the official 0.3.13 release so that Luis can get the win32 side very nice and clean. We fixed a major problem last night so it's only a short time before we get it out. Luis is working really hard on it, so just be patient. In the meantime, I've been doing a code audit of the Mongrel code as it is now and fixing any little things I come across. I've just updated the pre-release gems for 0.3.13 with the following fixes: * Cleaned up the new HTTP IO loop a bit so that it's even more accurate. Still haven't been able to replicate my earlier SEGFAULT errors, which is why I'm doing a code audit. * Removed various unneeded errors and files. * Removed resolv-replace since it seems it only works reliably on Linux. If you find that DNS resolving takes forever and stops your ruby program then consider require 'resolv-replace' somewhere as a fix. * Moved a bunch of crap around so that Wilson's broke ass win32 setup would work. :-) * The MIME types that you set from a YAML file actually weren't being set. Now they are. I'm an idiot. * Austin Godber wrote up some nice instructions for using pound. http://mongrel.rubyforge.org/docs/pound.html * A code review of lib/mongrel.rb and lib/mongrel/rails.rb fixing up some minor things. * Initial changes to let people specify which type of -B output they want, just in case they only want thread logging or something. * Fixed a format string error that was causing problems when people closed the socket on send_file. * Fixes for win32 so that CTRL-C works, it handles SIGINT properly, and the shutdown is more graceful. This should also fix similar problems with people who run a ruby that has pthreads. * Small fixes to test files so that they can be run independently as reported by Rui Lopes. Additionally, I'm using rcov to get a coverage report. Everyone can check it out at http://mongrel.rubyforge.org/coverage/ as I write more tests. I'm hoping to get the test coverage closer to 100%, but that's pretty difficult since some of the code requires actually having a running Rails application. DOCUMENTATION VOLUNTEERS We're looking for folks who are interested in helping write Mongrel documentation. Writing the documentation is pretty easy, since it's done with webgen and using textile. If anyone's interested, take a look at: http://mongrel.rubyforge.org/docs/ And pick one of the empty pages. I'm currently working on the Apache documentation, but anyone who wants to volunteer can just e-mail me and I'll hook you up with instructions. All authors get credit for writing their documentation and can link to their blogs. Thanks, and please report the bugs. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From wilsonb at gmail.com Sat May 20 16:37:04 2006 From: wilsonb at gmail.com (Wilson Bilkovich) Date: Sat, 20 May 2006 16:37:04 -0400 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Update -- Code Review, Code Coverage In-Reply-To: <1148157008.6035.39.camel@localhost.localdomain> References: <1148157008.6035.39.camel@localhost.localdomain> Message-ID: On 5/20/06, Zed Shaw wrote: > Hey Folks, > > * Moved a bunch of crap around so that Wilson's broke ass win32 setup > would work. :-) That's cold, man.. It's not broke ass.. it's finely tuned! From zedshaw at zedshaw.com Sat May 20 19:21:53 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Sat, 20 May 2006 19:21:53 -0400 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Bugs Update -- Change UID/GID Patch In-Reply-To: <1148157008.6035.39.camel@localhost.localdomain> References: <1148157008.6035.39.camel@localhost.localdomain> Message-ID: <1148167313.11391.2.camel@localhost.localdomain> Just a quick announce telling people to update the pre-release again. Fixed and added the following goodies: * Bug where send_file wasn't indicating that the body has been sent which caused problems in a few situations. * Bug where DirHandler wasn't unescaping the URI paths. * Patch from Bradley Taylor that gives mongrel_rails start the options -u and -g. These will change the uid/gid on UNIX (not WIN32!) to the requested ones. Please test this out on various Unix flavors and report bugs. * Spelling corrections (hot damn gvim is the bomb). -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From luislavena at gmail.com Sat May 20 20:53:16 2006 From: luislavena at gmail.com (Luis Lavena) Date: Sat, 20 May 2006 21:53:16 -0300 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Bugs Update -- Change UID/GID Patch In-Reply-To: <1148167313.11391.2.camel@localhost.localdomain> References: <1148157008.6035.39.camel@localhost.localdomain> <1148167313.11391.2.camel@localhost.localdomain> Message-ID: <71166b3b0605201753j6775f3a7y135fc71adc2699cc@mail.gmail.com> On 5/20/06, Zed Shaw wrote: > * Patch from Bradley Taylor that gives mongrel_rails start the options > -u and -g. These will change the uid/gid on UNIX (not WIN32!) to the > requested ones. Man, hate we clash parameters, soon we will be using -$ -% and -* to set new options... Why better we don't start leaving these new options to the config file and keep params to the minimum? -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From zedshaw at zedshaw.com Sat May 20 22:52:33 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Sat, 20 May 2006 22:52:33 -0400 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Bugs Update -- Change UID/GID Patch In-Reply-To: <71166b3b0605201753j6775f3a7y135fc71adc2699cc@mail.gmail.com> References: <1148157008.6035.39.camel@localhost.localdomain> <1148167313.11391.2.camel@localhost.localdomain> <71166b3b0605201753j6775f3a7y135fc71adc2699cc@mail.gmail.com> Message-ID: <1148179953.12538.3.camel@localhost.localdomain> On Sat, 2006-05-20 at 21:53 -0300, Luis Lavena wrote: > On 5/20/06, Zed Shaw wrote: > > * Patch from Bradley Taylor that gives mongrel_rails start the options > > -u and -g. These will change the uid/gid on UNIX (not WIN32!) to the > > requested ones. > > Man, hate we clash parameters, soon we will be using -$ -% and -* to > set new options... > > Why better we don't start leaving these new options to the config file > and keep params to the minimum? > > Damn, sorry about that man. We can change those easily though. I actually think I might change it to -M user:group since it doesn't make a lot of sense to just change user. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From bradley at railsmachine.com Sun May 21 08:19:02 2006 From: bradley at railsmachine.com (bradley taylor) Date: Sun, 21 May 2006 08:19:02 -0400 Subject: [Mongrel] Mongrel/Apache and static content In-Reply-To: <1148154700.6035.18.camel@localhost.localdomain> References: <68eb3dd10605191217q6c3fc986s3cdab49e06005078@mail.gmail.com> <68eb3dd10605191438t113c87a4hc01473b23c21ddeb@mail.gmail.com> <1148075134.5852.0.camel@localhost.localdomain> <68eb3dd10605191602q1d274d9bh94d943af4b193b9c@mail.gmail.com> <8B689907-DF98-4D2D-AA9A-6698F81C63CB@railsmachine.com> <1148154700.6035.18.camel@localhost.localdomain> Message-ID: On May 20, 2006, at 3:51 PM, Zed Shaw wrote: > > Well, I guess it's time to just let everyone know that I'm working > on a > "super secret" proxy server to go along with Mongrel that would > basically do all the stuff Bradley is talking about (which Bradley > knows > so I'm curious why he's jamming my game! :-). It's job security. If I can secretly promote the creation of 5 different proxy servers with 86.7% functional overlap, then Rails deployment will remain a complex, mystical endeavor. Come on, if this stuff was actually straightforward, how am I supposed to retire to a Georgia barrier island next year? My life of mint juleps and long walks on the beach awaits! :-) :bradley ------ Rails Machine Simplified Ruby on Rails application deployment http://railsmachine.com From bradley at railsmachine.com Sun May 21 08:20:15 2006 From: bradley at railsmachine.com (bradley taylor) Date: Sun, 21 May 2006 08:20:15 -0400 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Bugs Update -- Change UID/GID Patch In-Reply-To: <1148179953.12538.3.camel@localhost.localdomain> References: <1148157008.6035.39.camel@localhost.localdomain> <1148167313.11391.2.camel@localhost.localdomain> <71166b3b0605201753j6775f3a7y135fc71adc2699cc@mail.gmail.com> <1148179953.12538.3.camel@localhost.localdomain> Message-ID: <460251B0-D066-48B8-843A-E26709E0BB7F@railsmachine.com> On May 20, 2006, at 10:52 PM, Zed Shaw wrote: > On Sat, 2006-05-20 at 21:53 -0300, Luis Lavena wrote: >> On 5/20/06, Zed Shaw wrote: >>> * Patch from Bradley Taylor that gives mongrel_rails start the >>> options >>> -u and -g. These will change the uid/gid on UNIX (not WIN32!) to >>> the >>> requested ones. >> >> Man, hate we clash parameters, soon we will be using -$ -% and -* to >> set new options... >> >> Why better we don't start leaving these new options to the config >> file >> and keep params to the minimum? Since both mongrel_rails and mongrel_cluster support config file generation, we still need a way to specify what options to write to the config file. > > Damn, sorry about that man. We can change those easily though. I > actually think I might change it to -M user:group since it doesn't > make > a lot of sense to just change user. I submitted a new patch that removes the short name options [-u,-g] and leaves the long names, --user and --group. I also added a check to Start::validate that requires that both user and group are specified together. This should address both concerns. The patch also switches the order of the calls to change_privilege by changing to the group then user. Thanks, Bradley ------ Rails Machine Simplified Ruby on Rails application deployment http://railsmachine.com From luislavena at gmail.com Sun May 21 08:30:50 2006 From: luislavena at gmail.com (Luis Lavena) Date: Sun, 21 May 2006 09:30:50 -0300 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Bugs Update -- Change UID/GID Patch In-Reply-To: <460251B0-D066-48B8-843A-E26709E0BB7F@railsmachine.com> References: <1148157008.6035.39.camel@localhost.localdomain> <1148167313.11391.2.camel@localhost.localdomain> <71166b3b0605201753j6775f3a7y135fc71adc2699cc@mail.gmail.com> <1148179953.12538.3.camel@localhost.localdomain> <460251B0-D066-48B8-843A-E26709E0BB7F@railsmachine.com> Message-ID: <71166b3b0605210530s27a5b80fg175261173f6178a2@mail.gmail.com> On 5/21/06, bradley taylor wrote: > > On May 20, 2006, at 10:52 PM, Zed Shaw wrote: > > > On Sat, 2006-05-20 at 21:53 -0300, Luis Lavena wrote: > >> On 5/20/06, Zed Shaw wrote: > >>> * Patch from Bradley Taylor that gives mongrel_rails start the > >>> options > >>> -u and -g. These will change the uid/gid on UNIX (not WIN32!) to > >>> the > >>> requested ones. > >> > >> Man, hate we clash parameters, soon we will be using -$ -% and -* to > >> set new options... > >> > >> Why better we don't start leaving these new options to the config > >> file > >> and keep params to the minimum? > > Since both mongrel_rails and mongrel_cluster support config file > generation, we still need a way to specify what options to write to > the config file. My concern is that -u is user in win32 to set the processor affinity, and some user that follow win32->linux path will found issues with their declarations on how mongrel should be running. Also, I'll be adding options for user context to the service stuff, what will allow run a mongrel service on accounts different than LocalService. > > Thanks, > Bradley > Its a excelent work Brad, and I think we should keep differences in params between platform to the minimun, so docs don't get a lot of "this only works on posix" "this stuff don't work on win32", "this is for my poor win32 machine" and so on. Regards, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From luislavena at gmail.com Sun May 21 09:12:21 2006 From: luislavena at gmail.com (Luis Lavena) Date: Sun, 21 May 2006 10:12:21 -0300 Subject: [Mongrel] Mongrel as win32-service, round3. Message-ID: <71166b3b0605210612x5b1c0c2ey7da2cd0b8e844231@mail.gmail.com> Hello lists! This is not spam, but included the 2 lists (mongrel-users and win32utils-devel) because the both are involved. Attached is the 3rd version of a simple http_service script used previously to get the things right for the mongrel Rails service. With the modifications Zed implemented the past days (into the beta gem, 0.3.13). Now the service part works better. Still, a few things must be worked to get rails 100% in this env. I also commented into the file a few things about how service work: You cannot do file operations (like openning a file and logging into it) inside service_stop, or actually stopping the listeners threads user by mongrel make the service hang and report an error. Found that the rb_funcall() to service_stop (if defined) is done previously to setting the service state to SERVICE_STOP_PENDING, a thing that sometimes make the service manager think the service just crashed. So far, tested in Windows XP SP2 without any kind of problems (runned 50 start/serve/stop cycles). Any feedback on this will be helpful, so I attached a Rakefile that should be used to perform the same test cycles I have done here. (You will need ApacheBench or replace the worker definitin with something that could give some load the the mongrel service). When it finish (or report errors) please mail me the service and stress log files. Thanks in advance for the time everyone take on this. Regards, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi -------------- next part -------------- A non-text attachment was scrubbed... Name: http_service3.rb Type: application/octet-stream Size: 4149 bytes Desc: not available Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20060521/5ee5b700/attachment-0002.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Rakefile Type: application/octet-stream Size: 575 bytes Desc: not available Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20060521/5ee5b700/attachment-0003.obj From bradley at railsmachine.com Sun May 21 09:34:56 2006 From: bradley at railsmachine.com (bradley taylor) Date: Sun, 21 May 2006 09:34:56 -0400 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Bugs Update -- Change UID/GID Patch In-Reply-To: <71166b3b0605210530s27a5b80fg175261173f6178a2@mail.gmail.com> References: <1148157008.6035.39.camel@localhost.localdomain> <1148167313.11391.2.camel@localhost.localdomain> <71166b3b0605201753j6775f3a7y135fc71adc2699cc@mail.gmail.com> <1148179953.12538.3.camel@localhost.localdomain> <460251B0-D066-48B8-843A-E26709E0BB7F@railsmachine.com> <71166b3b0605210530s27a5b80fg175261173f6178a2@mail.gmail.com> Message-ID: <72C13F11-9EF7-45B6-9C54-B188E2E15D43@railsmachine.com> On May 21, 2006, at 8:30 AM, Luis Lavena wrote: >>>> Why better we don't start leaving these new options to the config >>>> file >>>> and keep params to the minimum? >> >> Since both mongrel_rails and mongrel_cluster support config file >> generation, we still need a way to specify what options to write to >> the config file. > > My concern is that -u is user in win32 to set the processor affinity, > and some user that follow win32->linux path will found issues with > their declarations on how mongrel should be running. I agree and that's why I removed -u and -g. My point is that we still need to add options to support configuration file generation. However, I think we can prevent name clashes by only using long option names like --user and --group. > Also, I'll be adding options for user context to the service stuff, > what will allow run a mongrel service on accounts different than > LocalService. You should be able to add --user/--group and not have any conflicts. The question is whether Process::GID and Process::UID are supported on Win32. The Ruby doc describes them as "a collection of module functions which can be used to portably get, set, and switch the current process?s real, effective, and saved group IDs." Although I don't know if the "portably" part includes Win32. If not, it should be possible to add a platform check in Mongrel::Configurator::change_privilege that calls ImpersonateSecurityContext (or similar function) instead. > Its a excelent work Brad, and I think we should keep differences in > params between platform to the minimun, so docs don't get a lot of > "this only works on posix" "this stuff don't work on win32", "this is > for my poor win32 machine" and so on. Thanks. I agree. Regards, Bradley Taylor ------ Rails Machine Simplified Ruby on Rails application deployment http://railsmachine.com From luislavena at gmail.com Sun May 21 09:49:06 2006 From: luislavena at gmail.com (Luis Lavena) Date: Sun, 21 May 2006 10:49:06 -0300 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Bugs Update -- Change UID/GID Patch In-Reply-To: <72C13F11-9EF7-45B6-9C54-B188E2E15D43@railsmachine.com> References: <1148157008.6035.39.camel@localhost.localdomain> <1148167313.11391.2.camel@localhost.localdomain> <71166b3b0605201753j6775f3a7y135fc71adc2699cc@mail.gmail.com> <1148179953.12538.3.camel@localhost.localdomain> <460251B0-D066-48B8-843A-E26709E0BB7F@railsmachine.com> <71166b3b0605210530s27a5b80fg175261173f6178a2@mail.gmail.com> <72C13F11-9EF7-45B6-9C54-B188E2E15D43@railsmachine.com> Message-ID: <71166b3b0605210649m437d9275q98ee0bce858555dc@mail.gmail.com> On 5/21/06, bradley taylor wrote: [snip] > > Also, I'll be adding options for user context to the service stuff, > > what will allow run a mongrel service on accounts different than > > LocalService. > > You should be able to add --user/--group and not have any conflicts. > > The question is whether Process::GID and Process::UID are supported > on Win32. The Ruby doc describes them as "a collection of module > functions which can be used to portably get, set, and switch the > current process's real, effective, and saved group IDs." Although I > don't know if the "portably" part includes Win32. If not, it should > be possible to add a platform check in > Mongrel::Configurator::change_privilege that calls > ImpersonateSecurityContext (or similar function) instead. For running plain mongrel_rails isn't possible, but instead when registering the service, so the service manager will do the impersonation for you when start the service. Also, I'll like to address the dependencies of the service, so networking or other service get up before we try to bind a socket (this happens sometimes when you set your service to start automatically). Later, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From kamk at volny.cz Sun May 21 16:17:16 2006 From: kamk at volny.cz (Kamil Kukura) Date: Sun, 21 May 2006 22:17:16 +0200 Subject: [Mongrel] problem with "start" in URL Message-ID: Hi, I noticed a problem when switched from SCGI to Mongrel. At very first moment my application goes to url /start/dashboard/overview which in Mongrel gives me 404 Not Found error. As soon as I changed it to /appstart/dashboard/overview it fixed the problem. -- Kamil From zedshaw at zedshaw.com Tue May 23 09:03:52 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Tue, 23 May 2006 09:03:52 -0400 Subject: [Mongrel] [ANN] Mongrel 0.3.13 Pre-Release Update -- Yep, Again Message-ID: <1148389432.29468.14.camel@localhost.localdomain> Hi Folks, This is another pre-release announcement with lots of goodies for people to test and play with. At this rate the 0.3.13 release may just turn into 0.4. GETTING IT Pretty simple, just gem install mongrel --source=http://mongrel.rubyforge.org/releases/ You can get more information at http://mongrel.rubyforge.org/ WHAT'S IN IT This release has lots of little things, mostly stuff related to the list of bugs and feature requests in the tracker: http://rubyforge.org/tracker/?group_id=1306 I've carved the bug/feature list down to 13 out of 51 reported defects. The important fixes and improvements are: * Improved test coverage: http://mongrel.rubyforge.org/coverage/ but no real additional bugs found. * A statistics and status handler for folks to play with. I'll have to document this later, but if you're interested check out examples/simpletest.rb or the test/test_handlers.rb * A DeflateFilter that you can add to the end of a handler chain and get deflate encoding if the client supports it or optionally always. Again, not documented yet, so the brave will have to see the samples or tests. * Newest rcov with the built-in rake task. * Bug 4414 -- no more PID files getting clobbered. * Applied user:group change patch from Bradley Taylor. * Updated the Pound documentation from Austin Godber, corrections from Rui Lopes. * Bug 4473 -- DirHandler escapes file paths correctly and will write directory listings with proper ending /. * Bug 4477 -- HttpResponse.send_file wasn't indicating that the response body is complete. * Removal of some chatty error messages. * Lots of little build and test harness tweaks. TESTING IT There has been one report of someone on FreeBSD seeing 0.3.13 pre-release of Mongrel being slower that 0.3.12.4 by a huge margin. I don't have the same results--in fact, 0.3.13 is faster by about 25%. Please test this and let me know if you have the same discrepancy in performance between the two versions. Otherwise, test your applications with this and shoot me feedback. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From Walter at mwsewall.com Tue May 23 09:59:10 2006 From: Walter at mwsewall.com (Walter) Date: Tue, 23 May 2006 09:59:10 -0400 Subject: [Mongrel] Can Win32 service more than one rails request at a time? Message-ID: <9DB53D616B4D5B47B8353ACBF155C6B73BD49A@mwsewall.com> Hi, I am trying to run Mongrel on win32 to serve an internal rails application. We are accessing legacy data, and some transactions can take 5 to 10 seconds. This is holding up every other request. The -n does not seem to be supported on Win32. Am I missing something, or should I look elsewhere to serve my Rails app on win32? Thanks, Walt -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.7.0/345 - Release Date: 5/22/2006 From technoweenie at gmail.com Tue May 23 10:04:12 2006 From: technoweenie at gmail.com (Rick Olson) Date: Tue, 23 May 2006 09:04:12 -0500 Subject: [Mongrel] Can Win32 service more than one rails request at a time? In-Reply-To: <9DB53D616B4D5B47B8353ACBF155C6B73BD49A@mwsewall.com> References: <9DB53D616B4D5B47B8353ACBF155C6B73BD49A@mwsewall.com> Message-ID: <48fe25b0605230704q39d9ce39u6a4d28803bbdf61c@mail.gmail.com> On 5/23/06, Walter wrote: > Hi, > > I am trying to run Mongrel on win32 to serve an internal rails application. > > We are accessing legacy data, and some transactions can take 5 to 10 seconds. This is holding up every other request. The -n does not seem to be supported on Win32. > > Am I missing something, or should I look elsewhere to serve my Rails app on win32? > > > Thanks, > > Walt Rails is not thread-safe, so mongrel locks it. You could implement these tasks in a custom mongrel handler, or look into ezra's backgrounddrb plugin. http://www.brainspl.at/articles/2006/05/15/backgoundrb-initial-release -- Rick Olson http://techno-weenie.net From Walter at mwsewall.com Tue May 23 10:15:53 2006 From: Walter at mwsewall.com (Walter) Date: Tue, 23 May 2006 10:15:53 -0400 Subject: [Mongrel] Can Win32 service more than one rails request at a time? Message-ID: <9DB53D616B4D5B47B8353ACBF155C6B73BD4A8@mwsewall.com> > Rails is not thread-safe, so mongrel locks it. You could implement > these tasks in a custom mongrel handler, or look into ezra's > backgrounddrb plugin. > > http://www.brainspl.at/articles/2006/05/15/backgoundrb-initial-release > > -- > Rick Olson > http://techno-weenie.net > I realize that mongrel is not thread safe, I was hoping mongrel might spawn a few processes and serve them in the background to emulate what I wanted. I have looked at the backgrounddrb plug-in and will use that for things like statement generation, and very long running tasks. The problem is I am accessing a system that I cannot change (for the time being) and the length of time for the queries are directly proportional to how much data each customer may have. So most queries are fast enough, but some customers have so much data that they bog things down. I would have to make everything a remote call, more work and overhead than I am looking for. On top of that I cannot change the indexes or table structure (we are accessing tables that another program accesses). At some point we will build a new system from scratch to address these issues, but for the time being I am stuck with what I have. Anyone know of a simple win32 web proxy that can deal with multiple mongrel servers? Thanks, Walt -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.7.0/345 - Release Date: 5/22/2006 From luislavena at gmail.com Tue May 23 10:41:00 2006 From: luislavena at gmail.com (Luis Lavena) Date: Tue, 23 May 2006 11:41:00 -0300 Subject: [Mongrel] Can Win32 service more than one rails request at a time? In-Reply-To: <9DB53D616B4D5B47B8353ACBF155C6B73BD4A8@mwsewall.com> References: <9DB53D616B4D5B47B8353ACBF155C6B73BD4A8@mwsewall.com> Message-ID: <71166b3b0605230741p3589a419t378ff71edb4d1dff@mail.gmail.com> On 5/23/06, Walter wrote: [...] > I realize that mongrel is not thread safe, I was hoping mongrel might spawn a few processes and serve them in the background to emulate what I wanted. > Rails is not thread-safe. > I have looked at the backgrounddrb plug-in and will use that for things like statement generation, and very long running tasks. The problem is I am accessing a system that I cannot change (for the time being) and the length of time for the queries are directly proportional to how much data each customer may have. So most queries are fast enough, but some customers have so much data that they bog things down. I would have to make everything a remote call, more work and overhead than I am looking for. > > On top of that I cannot change the indexes or table structure (we are accessing tables that another program accesses). At some point we will build a new system from scratch to address these issues, but for the time being I am stuck with what I have. > The idea of the BackgroundDrb is that you perform these task out-of-bound from the webserver/dispatcher/rails, so it could handle other request and also you could "query" the status of the bulk process. No matter how many processors you spawn (even if the -n param was available in win32 service)... 1 Controller call would hang the whole server until it return, thats why the suggestion of using BackgroundDRb. If your lengthly process need parse or perform actions using the model, I will comment that something isn't in the right place. Using Apache or Lighttpd will require you use FCGI, which also mean that you will need to "synchronize" your transactions to the DB to avoid corrupt data. > Anyone know of a simple win32 web proxy that can deal with multiple mongrel servers? Couldn't find one, thats why start working on it, but still a lot of work to do. Regards, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From Walter at mwsewall.com Tue May 23 11:27:35 2006 From: Walter at mwsewall.com (Walter) Date: Tue, 23 May 2006 11:27:35 -0400 Subject: [Mongrel] Can Win32 service more than one rails request at atime? Message-ID: <9DB53D616B4D5B47B8353ACBF155C6B73BD4D8@mwsewall.com> > On 5/23/06, Walter wrote: > [...] > > I realize that mongrel is not thread safe, I was hoping mongrel might > spawn a few processes and serve them in the background to emulate what I > wanted. > > > > Rails is not thread-safe. > Yes, that?s what I meant. > > The idea of the BackgroundDrb is that you perform these task > out-of-bound from the webserver/dispatcher/rails, so it could handle > other request and also you could "query" the status of the bulk > process. > Yes I am familiar with it, I was just trying to avoid it for simple tasks, like getting a list of all invoices for a customer. Yes this can take 6+ seconds to get. > No matter how many processors you spawn (even if the -n param was > available in win32 service)... 1 Controller call would hang the whole > server until it return, thats why the suggestion of using > BackgroundDRb. > Ahh I see. > If your lengthly process need parse or perform actions using the > model, I will comment that something isn't in the right place. > > Using Apache or Lighttpd will require you use FCGI, which also mean > that you will need to "synchronize" your transactions to the DB to > avoid corrupt data. > The problem is we are using an application that is 20+ years old, and was never intended to be accessed via and ODBC driver (luckily we found one, it may be buggy but it works). Some parts of the company need to use the original application, other parts we access through our own data-access system (similar to AR but simpler). We currently have an internal web-application that piggy backs on to the original DB, but need to change some significant things (will add new tables), and the future plans are to rewrite it so it no longer uses the original DB. This would be done subsection by subsection and converted to Rails, so we are starting now. We have all of the data access working fine, its just some transactions are slow for a subset of the data being accessed. The database itself is non transactional file based system. The app is written in Dataflex which is/was a sort of 4GL RAD builder that had its own DB built in. > > Anyone know of a simple win32 web proxy that can deal with multiple > mongrel servers? > > Couldn't find one, thats why start working on it, but still a lot of work > to do. > Very nice. Thanks, Walt -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.7.0/345 - Release Date: 5/22/2006 From Will_Green at URSCorp.com Tue May 23 12:23:12 2006 From: Will_Green at URSCorp.com (Will_Green at URSCorp.com) Date: Tue, 23 May 2006 12:23:12 -0400 Subject: [Mongrel] Can Win32 service more than one rails request at atime? In-Reply-To: <9DB53D616B4D5B47B8353ACBF155C6B73BD4D8@mwsewall.com> Message-ID: > Anyone know of a simple win32 web proxy that can deal with multiple > mongrel servers? Apache 2.2 with mod_proxy_balancer. I know this link has appeared on this list before, but here it is again: Scaling Rails with Apache 2.2, mod_proxy_balancer and Mongrel http://blog.innerewut.de/articles/2006/04/21/scaling-rails-with-apache-2-2-mod_proxy_balancer-and-mongrel == Will Green Web Developer & IT Coordinator, URS Creative Imaging http://www.urscreativeimaging.com/ 7650 West Courtney Campbell Causeway Suite 700 Tampa, FL 33607 813.675.6849 (direct) 813.286.1711 (main) This e-mail and any attachments are confidential. If you receive this message in error or are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy the e-mail and any attachments or copies. From kevwil at gmail.com Tue May 23 12:59:51 2006 From: kevwil at gmail.com (Kevin Williams) Date: Tue, 23 May 2006 10:59:51 -0600 Subject: [Mongrel] Can Win32 service more than one rails request at atime? In-Reply-To: References: <9DB53D616B4D5B47B8353ACBF155C6B73BD4D8@mwsewall.com> Message-ID: <683a886f0605230959r2f8b150ck4534188b2961008@mail.gmail.com> Yes, there is a 2.2.2 binary build for win32 up on the Apache web site. On 5/23/06, Will_Green at urscorp.com wrote:> > Anyone know of a simple win32 web proxy that can deal with multiple> > mongrel servers?>> Apache 2.2 with mod_proxy_balancer.>> I know this link has appeared on this list before, but here it is again:>> Scaling Rails with Apache 2.2, mod_proxy_balancer and Mongrel> http://blog.innerewut.de/articles/2006/04/21/scaling-rails-with-apache-2-2-mod_proxy_balancer-and-mongrel>> ==> Will Green> Web Developer & IT Coordinator, URS Creative Imaging> http://www.urscreativeimaging.com/> 7650 West Courtney Campbell Causeway> Suite 700> Tampa, FL 33607> 813.675.6849 (direct)> 813.286.1711 (main)>>> This e-mail and any attachments are confidential. If you receive this> message in error or are not the intended recipient, you should not retain,> distribute, disclose or use any of this information and you should destroy> the e-mail and any attachments or copies.>>>>>>> _______________________________________________> Mongrel-users mailing list> Mongrel-users at rubyforge.org> http://rubyforge.org/mailman/listinfo/mongrel-users> -- Cheers, Kevin From schoenm at earthlink.net Tue May 23 14:13:32 2006 From: schoenm at earthlink.net (Michael A. Schoen) Date: Tue, 23 May 2006 11:13:32 -0700 Subject: [Mongrel] [Rails] [ANN] Mongrel 0.3.13 Pre-Release Update -- Yep, Again In-Reply-To: <1148389432.29468.14.camel@localhost.localdomain> References: <1148389432.29468.14.camel@localhost.localdomain> Message-ID: <447350CC.7060300@earthlink.net> Zed Shaw wrote: > Hi Folks, > > This is another pre-release announcement with lots of goodies for people > to test and play with. At this rate the 0.3.13 release may just turn > into 0.4. YOU. JUST. ROCK. From born70s at gmail.com Tue May 23 20:13:04 2006 From: born70s at gmail.com (Kevin C) Date: Tue, 23 May 2006 17:13:04 -0700 Subject: [Mongrel] Can Win32 service more than one rails request at a time? In-Reply-To: <48fe25b0605230704q39d9ce39u6a4d28803bbdf61c@mail.gmail.com> References: <9DB53D616B4D5B47B8353ACBF155C6B73BD49A@mwsewall.com> <48fe25b0605230704q39d9ce39u6a4d28803bbdf61c@mail.gmail.com> Message-ID: I'm confused here. Does this not-thread-safe mean we can only run ONE mongrel for ONE app on ONE server? Can we start another mongrel for the same app on the same server but on a different port (and serve through proxy)? I suppose we can run another mongrel for the same app on another server. -- Kevin Chen http://www.realmatic.com From wilsonb at gmail.com Tue May 23 20:33:27 2006 From: wilsonb at gmail.com (Wilson Bilkovich) Date: Tue, 23 May 2006 20:33:27 -0400 Subject: [Mongrel] Can Win32 service more than one rails request at a time? In-Reply-To: References: <9DB53D616B4D5B47B8353ACBF155C6B73BD49A@mwsewall.com> <48fe25b0605230704q39d9ce39u6a4d28803bbdf61c@mail.gmail.com> Message-ID: On 5/23/06, Kevin C wrote: > I'm confused here. > > Does this not-thread-safe mean we can only run ONE mongrel for ONE app > on ONE server? Can we start another mongrel for the same app on the > same server but on a different port (and serve through proxy)? > > I suppose we can run another mongrel for the same app on another server. > Mongrel is fine, and happy running 100 copies on one server. Rails itself is not thread-safe, and that means you need one Mongrel (or FastCGI instance, or WEBrick, or whatever) per Rails process. If you want to run three Rails apps, you need three somethings (preferably Mongrels). From zedshaw at zedshaw.com Tue May 23 21:03:43 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Tue, 23 May 2006 21:03:43 -0400 Subject: [Mongrel] Can Win32 service more than one rails request at a time? In-Reply-To: References: <9DB53D616B4D5B47B8353ACBF155C6B73BD49A@mwsewall.com> <48fe25b0605230704q39d9ce39u6a4d28803bbdf61c@mail.gmail.com> Message-ID: <1148432623.6073.26.camel@localhost.localdomain> On Tue, 2006-05-23 at 17:13 -0700, Kevin C wrote: > I'm confused here. > > Does this not-thread-safe mean we can only run ONE mongrel for ONE app > on ONE server? Can we start another mongrel for the same app on the > same server but on a different port (and serve through proxy)? > > I suppose we can run another mongrel for the same app on another server. > Short explanation: Yes, this is normally what you have to do to get a good production setup going. Here's the long explanation that should help you understand what's going on. First, the Mongrel way: 1) Mongrel is thread safe as far as it will run any registered handlers in threads and make sure that multiple threads have their own resources. 2) Mongrel HttpHandler objects are connected to URIs, but there's only one per each URI. This means that they run fast since there's no object creation, but that they are very old school and a pain to develop for, only useful for people who really need the speed. 3) Mongrel handlers are run in order using a processing chain. Let's say you register 4 handlers to "/": uri "/", :handler => AuthenticationFilter.new uri "/", :handler => DoFastStuffHandler.new uri "/", :handler => StatisticsFilter.new uri "/", :handler => DeflateFilter.new What happens is that each of these is run in order with the same HttpRequest and HttpResponse objects, they get their turn, and then the final results are sent back to the user. (NOTE: Filter and Handler are both HttpHandler classes, just named differently for clarity). 4) When your handler runs, any instance variables (@foo) are reused by all the threads. You have to work to guard these yourself. It's much like old-school Java servlet programming. This is done for speed only, and most people won't be writing handlers unless they are uber advanced. OK, so now how does rails fit into things? The problem with Rails is that it's got so much code generation and automagic going on that it's really difficult to make it thread safe. Things would be different if Ruby could ensure that it's code generation and class loading were atomic, but it can't. Because of this Rails has to be locked while it's processing. So, let's say you hit a Rails action with one thread, then this is what happens: 1) RailsHandler first checks if the request could be page cached or is a file. a) If it is then the DirHandler takes over instead. THIS IS FAST AND NOT LOCKED. Done, next request. 2) RailsHandler determines that this isn't a file and isn't page cached, so it must run the Rails Dispatcher to service the request. 3) LOCK!!! But only the call to Dispatcher, the rest of Mongrel keeps trucking. 4) Wait hours for everyone's IO.popen to a perl script that talks to ten databases to produce a full index of the internet and then image map it to generate a CAPTCHA. 5) While the above is happening, #1 and #2 still keep going processing clients. Mongrel is threaded so it happily queues clients up that are all waiting at #3. 6) UNLOCK. #4 completes THE FIGHT BEGINS! Whichever client stuck at #3 gets the lock will then continue and you're back at #3. 7) Continue until your IO.popen kills server. Incidentally, the results of the Rails request are sent back to the client *after* the lock is released. Rails actually spits its junk to a StringIO so that it can get done without worrying about socket crap, and then Mongrel deals with the IO and threads from there. (I'm mentioning IO.popen because it's incredibly evil, don't use it or fork). Now, what this generally means is if you have page caching turned on and most of your rails requests are pretty snappy, then you can most likely handle quite a few concurrent users without any problems. As long as clients get in and get out of the #3 through #6 LOCK/UNLOCK region you're set. It also means that you only pay a lock penalty for Rails to run it's action and generate results to a StrinIO. Mongrel handles all the socket garbage in a threaded way. The problem comes when folks expect Rails to be an operating system. They have it spawning processes, managing tons of files, generating maps and reports and latex output and putting them through pre-press operations that take 10 minutes. When this happens you have 3 choices: 1) Only let one person use the application. 2) Start a bunch of Mongrels listening on various ports (on various machines) and use pound, pen, balance, lighttpd, litespeed, or apache to proxy requests for a "fronting" machine to the N backends. 3) Rewrite your stuff to use BackgroundDRB or some other custom off-load worker server, and use a nice AJAX "Job in progress..." set of actions to keep things snapppy. Best part about this is you can actually shove a large portion of the status out into a Mongrel handler (now you know why I covered it). Now, why doesn't Mongrel do forking you may ask? All my tests found that the fork available in Ruby just isn't reliable. It causes IO to get dropped, sockets to go away, files get closed at weird times, and it's just generally bad news. Also, fork isn't really well supported on win32. Nope, it's just loads easier to use mongrel_cluster to manage a ton of systems, or to setup a bunch of win32 services that listen on different ports. Well, hope that long answer helped you out. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Wed May 24 07:36:10 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Wed, 24 May 2006 07:36:10 -0400 Subject: [Mongrel] Contributing Documentation Message-ID: <1148470570.6090.18.camel@localhost.localdomain> Hey Everyone, A few folks have contacted me about writing documentation for Mongrel. There's a lot of blank pages on: http://mongrel.rubyforge.org/docs/index.html And I've got only so much time. To make it easier for everyone who wants to do this, I've written the following instructions: http://mongrel.rubyforge.org/docs/contrib.html This should hopefully get everyone up to speed and working on docs that they'd like to write or think we need. I'm also going to look at trying to get a wiki setup for the rubyforge project as a place for users to contribute additional documentation that's not in the "canon". My good friend Austin Godber just recently wrote the Pound (http://mongrel.rubyforge.org/docs/pound.html ) documentation, so feel free to use his work as a starting point and example. Thanks! -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From machomagna at gmail.com Wed May 24 11:07:43 2006 From: machomagna at gmail.com (Josh Starcher) Date: Wed, 24 May 2006 11:07:43 -0400 Subject: [Mongrel] bug #4398 Message-ID: <683802290605240807l35d8dbbct66f9e48e30dc8845@mail.gmail.com> I was told to reopent bug #4398 if I continued to have problems. I don't think I have permissions to reopen a bug, but I have added a new comment. If someone has time to look at it and give me so more feedback I'd appreciate it. Thanks for all your hard work! -- Josh Starcher -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060524/bc086802/attachment.htm From spurton at gmail.com Wed May 24 12:09:14 2006 From: spurton at gmail.com (scott burton) Date: Wed, 24 May 2006 09:09:14 -0700 Subject: [Mongrel] Can Win32 service more than one rails request at a time? In-Reply-To: <1148432623.6073.26.camel@localhost.localdomain> References: <9DB53D616B4D5B47B8353ACBF155C6B73BD49A@mwsewall.com> <48fe25b0605230704q39d9ce39u6a4d28803bbdf61c@mail.gmail.com> <1148432623.6073.26.camel@localhost.localdomain> Message-ID: Sounds like a Mongrel/Rails performance post on http://mongrel.rubyforge.org/ waiting to happen :) On 5/23/06, Zed Shaw wrote: > > On Tue, 2006-05-23 at 17:13 -0700, Kevin C wrote: > > I'm confused here. > > > > Does this not-thread-safe mean we can only run ONE mongrel for ONE app > > on ONE server? Can we start another mongrel for the same app on the > > same server but on a different port (and serve through proxy)? > > > > I suppose we can run another mongrel for the same app on another server. > > > > Short explanation: Yes, this is normally what you have to do to get a > good production setup going. > > Here's the long explanation that should help you understand what's going > on. First, the Mongrel way: > > 1) Mongrel is thread safe as far as it will run any registered handlers > in threads and make sure that multiple threads have their own resources. > 2) Mongrel HttpHandler objects are connected to URIs, but there's only > one per each URI. This means that they run fast since there's no object > creation, but that they are very old school and a pain to develop for, > only useful for people who really need the speed. > 3) Mongrel handlers are run in order using a processing chain. Let's > say you register 4 handlers to "/": > uri "/", :handler => AuthenticationFilter.new > uri "/", :handler => DoFastStuffHandler.new > uri "/", :handler => StatisticsFilter.new > uri "/", :handler => DeflateFilter.new > > What happens is that each of these is run in order with the same > HttpRequest and HttpResponse objects, they get their turn, and then the > final results are sent back to the user. (NOTE: Filter and Handler are > both HttpHandler classes, just named differently for clarity). > 4) When your handler runs, any instance variables (@foo) are reused by > all the threads. You have to work to guard these yourself. It's much > like old-school Java servlet programming. This is done for speed only, > and most people won't be writing handlers unless they are uber advanced. > > OK, so now how does rails fit into things? The problem with Rails is > that it's got so much code generation and automagic going on that it's > really difficult to make it thread safe. Things would be different if > Ruby could ensure that it's code generation and class loading were > atomic, but it can't. Because of this Rails has to be locked while it's > processing. > > So, let's say you hit a Rails action with one thread, then this is what > happens: > > 1) RailsHandler first checks if the request could be page cached or is a > file. > a) If it is then the DirHandler takes over instead. THIS IS FAST > AND NOT LOCKED. Done, next request. > 2) RailsHandler determines that this isn't a file and isn't page cached, > so it must run the Rails Dispatcher to service the request. > 3) LOCK!!! But only the call to Dispatcher, the rest of Mongrel keeps > trucking. > 4) Wait hours for everyone's IO.popen to a perl script that talks to ten > databases to produce a full index of the internet and then image map it > to generate a CAPTCHA. > 5) While the above is happening, #1 and #2 still keep going processing > clients. Mongrel is threaded so it happily queues clients up that are > all waiting at #3. > 6) UNLOCK. #4 completes THE FIGHT BEGINS! Whichever client stuck at #3 > gets the lock will then continue and you're back at #3. > 7) Continue until your IO.popen kills server. Incidentally, the results > of the Rails request are sent back to the client *after* the lock is > released. Rails actually spits its junk to a StringIO so that it can > get done without worrying about socket crap, and then Mongrel deals with > the IO and threads from there. > > (I'm mentioning IO.popen because it's incredibly evil, don't use it or > fork). > > Now, what this generally means is if you have page caching turned on and > most of your rails requests are pretty snappy, then you can most likely > handle quite a few concurrent users without any problems. As long as > clients get in and get out of the #3 through #6 LOCK/UNLOCK region > you're set. It also means that you only pay a lock penalty for Rails to > run it's action and generate results to a StrinIO. Mongrel handles all > the socket garbage in a threaded way. > > The problem comes when folks expect Rails to be an operating system. > They have it spawning processes, managing tons of files, generating maps > and reports and latex output and putting them through pre-press > operations that take 10 minutes. When this happens you have 3 choices: > > 1) Only let one person use the application. > 2) Start a bunch of Mongrels listening on various ports (on various > machines) and use pound, pen, balance, lighttpd, litespeed, or apache to > proxy requests for a "fronting" machine to the N backends. > 3) Rewrite your stuff to use BackgroundDRB or some other custom off-load > worker server, and use a nice AJAX "Job in progress..." set of actions > to keep things snapppy. Best part about this is you can actually shove > a large portion of the status out into a Mongrel handler (now you know > why I covered it). > > Now, why doesn't Mongrel do forking you may ask? All my tests found > that the fork available in Ruby just isn't reliable. It causes IO to > get dropped, sockets to go away, files get closed at weird times, and > it's just generally bad news. Also, fork isn't really well supported on > win32. Nope, it's just loads easier to use mongrel_cluster to manage a > ton of systems, or to setup a bunch of win32 services that listen on > different ports. > > Well, hope that long answer helped you out. > > > -- > Zed A. Shaw > http://www.zedshaw.com/ > http://mongrel.rubyforge.org/ > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > -- I was thinking of the immortal words of Socrates, when he said, "I drank what?" -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060524/4611121f/attachment-0001.htm From technoweenie at gmail.com Wed May 24 12:19:00 2006 From: technoweenie at gmail.com (Rick Olson) Date: Wed, 24 May 2006 11:19:00 -0500 Subject: [Mongrel] upload progress progress (progress of the upload progress progress plugin) Message-ID: <48fe25b0605240919p3019d734y2cb28879c3db7af7@mail.gmail.com> Hey guys, I've been hacking on the upload progress stuff that _why started. I started a backpack page if anyone's interested. http://technoweenie.backpackit.com/pub/602283 If you want access to the files, send me your backpack email. -- Rick Olson http://techno-weenie.net From born70s at gmail.com Wed May 24 12:44:01 2006 From: born70s at gmail.com (Kevin C) Date: Wed, 24 May 2006 09:44:01 -0700 Subject: [Mongrel] Can Win32 service more than one rails request at a time? In-Reply-To: <1148432623.6073.26.camel@localhost.localdomain> References: <9DB53D616B4D5B47B8353ACBF155C6B73BD49A@mwsewall.com> <48fe25b0605230704q39d9ce39u6a4d28803bbdf61c@mail.gmail.com> <1148432623.6073.26.camel@localhost.localdomain> Message-ID: Zed, Thanks for your explanation, it clears lots of confusion. > 2) Start a bunch of Mongrels listening on various ports (on various > machines) and use pound, pen, balance, lighttpd, litespeed, or apache to > proxy requests for a "fronting" machine to the N backends. Can I launch multiple Mongrels on vairous ports on the same server(not various servers) and proxy by apache? I guess the LOCK only applies to threads within the same mongrel process, each Mongrel holds its own and don't step on each other, right? -- Kevin Chen http://www.realmatic.com From defeated2k4 at gmail.com Wed May 24 15:00:37 2006 From: defeated2k4 at gmail.com (Ed C.) Date: Wed, 24 May 2006 15:00:37 -0400 Subject: [Mongrel] Rails App in Subfolder = Routing Error Recognition Failed Message-ID: <736593a0605241200p62c06efap92ae2967e26b5d70@mail.gmail.com> Zed / List, On my workstation I'm running lighttpd 1.4.11 and mongrel 0.3.12.4. Here are my proxy settings: proxy.debug = 0 proxy.balance = "fair" proxy.server = ( "/RailsAppSample" => (( "host" => "127.0.0.1", "port" => 1337 ))) I can access http://localhost/ (default lighty welcome page) and http://localhost:1337/ (default rails welcome page) just fine! However, when I try to access http://localhost/RailsAppSample/ I get: Routing Error Recognition failed for "/RailsAppSample/" (I've seen examples of people running multiple rails apps under lighttpd + fcgi using a "strip-request-uri" option, but I don't think that exists for mod_proxy.) Does anyone have any suggestions? Thanks, Ed C. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060524/41a49f5b/attachment.htm From bradley at railsmachine.com Wed May 24 15:12:11 2006 From: bradley at railsmachine.com (bradley taylor) Date: Wed, 24 May 2006 15:12:11 -0400 Subject: [Mongrel] [ANN] mongrel_cluster 0.1.3 prerelease Message-ID: <6FD680F1-5396-49A2-BD19-1E76DCBE05E4@railsmachine.com> Hi y'all, An prerelase of mongrel_cluster 0.1.3 is available for testing with the Mongrel 0.3.13 prerelease. This release contains bug fixes and adds a Ruby script for managing all applications on a server with a single command. To install: gem install mongrel_cluster --source=http:// railsmachine.rubyforge.org/releases/ Changes: * Suppress output from mongrel_rails. * Added a verbose option (-v, --verbose) to print output from mongrel_rails. * Added support for changing the user/group of mongrel_rails process. * Added bin/mongrel_cluster_ctl to start/stop all clusters on a server. Usage: mongrel_cluster_ctl (start|stop|restart) [options] * Addred resources/mongrel_cluster * Fixed bugs in Capistrano recipes with mongrel_config variable. * Remove use_sudo from configure_mongrel_cluster task. * Changed restart_mongrel_cluster task to call stop/start. * Added Capistrano tasks to support mongrel_cluster_ctl. Known issues: * Output suppression doesn't quite work as expected. Some messages from "mongrel_rails start" are not suppressed. * Changing user/group should no-op if specified user/group is the same as caller (may require Mongrel patch). * Documentation. * Win32 needs love. How to automatically start Mongrel clusters on system boot with mongrel_cluster_ctl: 1. Create /etc/mongrel_cluster 2. Create a symlink to the configuration files of clusters that you want to automatically start/stop. You can also use the setup_mongrel_cluster_ctl Capistrano task. 3. Setup start on boot and stop on shutdown. The gem contains an init.d script that works with RHEL/CentOS/Fedora. Red Hat systems: - Copy from resources/mongrel_cluster bash script to /etc/init.d/ mongrel_cluster. - run "chkconfig --level 345 mongrel_cluster on" to enable running mongrel_cluster_ctl on start up. - start all clusters with "service mongrel_cluster start" - stop all clusters with "service mongrel_cluster stop" Other systems: - Look at resources/mongrel_cluster bash script for example usage of mongrel_cluster_ctl from a bash script. - Modify as needed for your OS. - Email me a modified version for your OS and I will include in the final release. Please include instructions for starting on boot. Please add bugs, requests, etc to the RubyForge tracker: http://rubyforge.org/tracker/?group_id=1336 Thanks, Bradley Taylor ------ Rails Machine Simplified Ruby on Rails deployment http://railsmachine.com From andreturpin at gmail.com Wed May 24 15:16:12 2006 From: andreturpin at gmail.com (Andre Turpin) Date: Wed, 24 May 2006 13:16:12 -0600 Subject: [Mongrel] Mongrel install/compile problems on Ubuntu dapper Message-ID: <10d7a51f0605241216q7e3d0713q3e4c97edbebd8bf6@mail.gmail.com> Installed gcc and make and the default friends that they bring along, then did # sudo gem install mongrel and got the following... andre at andre:~$ sudo gem install mongrel Attempting local installation of 'mongrel' Local gem file not found: mongrel*.gem Attempting remote installation of 'mongrel' Select which gem to install for your platform (i486-linux) 1. mongrel 0.3.12.4 (ruby) 2. mongrel 0.3.12.4 (mswin32) 3. mongrel 0.3.12.3 (mswin32) 4. mongrel 0.3.12.3 (ruby) 5. mongrel 0.3.12.2 (ruby) 6. mongrel 0.3.12.2 (mswin32) 7. mongrel 0.3.12.1 (mswin32) 8. mongrel 0.3.12.1 (ruby) 9. mongrel 0.3.12 (mswin32) 10. mongrel 0.3.12 (ruby) 11. mongrel 0.3.11 (ruby) 12. mongrel 0.3.11 (mswin32) 13. mongrel 0.3.10.1 (ruby) 14. mongrel 0.3.10 (ruby) 15. mongrel 0.3.9 (ruby) 16. mongrel 0.3.8 (ruby) 17. mongrel 0.3.8 (mswin32) 18. mongrel 0.3.7.1 (ruby) 19. mongrel 0.3.7.1 (mswin32) 20. mongrel 0.3.7 (ruby) 21. mongrel 0.3.6 (ruby) 22. mongrel 0.3.6 (mswin32) 23. mongrel 0.3.5 (ruby) 24. mongrel 0.3.5 (mswin32) 25. mongrel 0.3.4 (mswin32) 26. mongrel 0.3.4 (ruby) 27. mongrel 0.3.3 (ruby) 28. mongrel 0.3.2 (ruby) 29. mongrel 0.3.1 (ruby) 30. mongrel 0.3 (ruby) 31. mongrel 0.2.2 (ruby) 32. mongrel 0.2.1 (ruby) 33. mongrel 0.2.0 (ruby) 34. Cancel installation > 1 Building native extensions. This could take a while... In file included from http11.c:1: /usr/lib/ruby/1.8/i486-linux/ruby.h:28:21: error: stdlib.h: No such file or directory /usr/lib/ruby/1.8/i486-linux/ruby.h:32:21: error: string.h: No such file or directory /usr/lib/ruby/1.8/i486-linux/ruby.h:42:19: error: stdio.h: No such file or directory /usr/lib/ruby/1.8/i486-linux/ruby.h:64:20: error: alloca.h: No such file or directory In file included from /usr/lib/gcc/i486-linux-gnu/4.0.3/include/syslimits.h:7, from /usr/lib/gcc/i486-linux-gnu/4.0.3/include/limits.h:11, from /usr/lib/ruby/1.8/i486-linux/ruby.h:84, from http11.c:1: /usr/lib/gcc/i486-linux-gnu/4.0.3/include/limits.h:122:61: error: limits.h: No such file or directory In file included from /usr/lib/ruby/1.8/i486-linux/ruby.h:677, from http11.c:1: /usr/lib/ruby/1.8/i486-linux/missing.h:16:24: error: sys/time.h: No such file or directory /usr/lib/ruby/1.8/i486-linux/missing.h:25:25: error: sys/types.h: No such file or directory In file included from /usr/lib/ruby/1.8/i486-linux/ruby.h:678, from http11.c:1: /usr/lib/ruby/1.8/i486-linux/intern.h:215: error: syntax error before 'fd_set' /usr/lib/ruby/1.8/i486-linux/intern.h:216: warning: 'struct timeval' declared inside parameter list /usr/lib/ruby/1.8/i486-linux/intern.h:216: warning: its scope is only this definition or declaration, which is probably not what you want /usr/lib/ruby/1.8/i486-linux/intern.h:446: warning: parameter names (without types) in function declaration In file included from http11.c:1: /usr/lib/ruby/1.8/i486-linux/ruby.h:687:21: error: pthread.h: No such file or directory In file included from http11.c:1: /usr/lib/ruby/1.8/i486-linux/ruby.h:689: error: syntax error before 'rb_nativethread_t' /usr/lib/ruby/1.8/i486-linux/ruby.h:689: warning: type defaults to 'int' in declaration of 'rb_nativethread_t' /usr/lib/ruby/1.8/i486-linux/ruby.h:689: warning: data definition has no type or storage class http11.c:3:20: error: assert.h: No such file or directory http11.c:6:19: error: ctype.h: No such file or directory http11.c: In function 'http_field': http11.c:72: warning: implicit declaration of function 'toupper' http11.c: In function 'header_done': http11.c:144: warning: implicit declaration of function 'strchr' http11.c:144: warning: incompatible implicit declaration of built-in function 'strchr' http11.c:126: warning: unused variable 'port' http11.c:125: warning: unused variable 'host' http11.c: In function 'HttpParser_free': http11.c:165: warning: implicit declaration of function 'free' http11.c: In function 'URIClassifier_alloc': http11.c:333: warning: implicit declaration of function 'assert' make: *** [http11.o] Error 1 In file included from http11.c:1: /usr/lib/ruby/1.8/i486-linux/ruby.h:28:21: error: stdlib.h: No such file or directory /usr/lib/ruby/1.8/i486-linux/ruby.h:32:21: error: string.h: No such file or directory /usr/lib/ruby/1.8/i486-linux/ruby.h:42:19: error: stdio.h: No such file or directory /usr/lib/ruby/1.8/i486-linux/ruby.h:64:20: error: alloca.h: No such file or directory In file included from /usr/lib/gcc/i486-linux-gnu/4.0.3/include/syslimits.h:7, from /usr/lib/gcc/i486-linux-gnu/4.0.3/include/limits.h:11, from /usr/lib/ruby/1.8/i486-linux/ruby.h:84, from http11.c:1: /usr/lib/gcc/i486-linux-gnu/4.0.3/include/limits.h:122:61: error: limits.h: No such file or directory In file included from /usr/lib/ruby/1.8/i486-linux/ruby.h:677, from http11.c:1: /usr/lib/ruby/1.8/i486-linux/missing.h:16:24: error: sys/time.h: No such file or directory /usr/lib/ruby/1.8/i486-linux/missing.h:25:25: error: sys/types.h: No such file or directory In file included from /usr/lib/ruby/1.8/i486-linux/ruby.h:678, from http11.c:1: /usr/lib/ruby/1.8/i486-linux/intern.h:215: error: syntax error before 'fd_set' /usr/lib/ruby/1.8/i486-linux/intern.h:216: warning: 'struct timeval' declared inside parameter list /usr/lib/ruby/1.8/i486-linux/intern.h:216: warning: its scope is only this definition or declaration, which is probably not what you want /usr/lib/ruby/1.8/i486-linux/intern.h:446: warning: parameter names (without types) in function declaration In file included from http11.c:1: /usr/lib/ruby/1.8/i486-linux/ruby.h:687:21: error: pthread.h: No such file or directory In file included from http11.c:1: /usr/lib/ruby/1.8/i486-linux/ruby.h:689: error: syntax error before 'rb_nativethread_t' /usr/lib/ruby/1.8/i486-linux/ruby.h:689: warning: type defaults to 'int' in declaration of 'rb_nativethread_t' /usr/lib/ruby/1.8/i486-linux/ruby.h:689: warning: data definition has no type or storage class http11.c:3:20: error: assert.h: No such file or directory http11.c:6:19: error: ctype.h: No such file or directory http11.c: In function 'http_field': http11.c:72: warning: implicit declaration of function 'toupper' http11.c: In function 'header_done': http11.c:144: warning: implicit declaration of function 'strchr' http11.c:144: warning: incompatible implicit declaration of built-in function 'strchr' http11.c:126: warning: unused variable 'port' http11.c:125: warning: unused variable 'host' http11.c: In function 'HttpParser_free': http11.c:165: warning: implicit declaration of function 'free' http11.c: In function 'URIClassifier_alloc': http11.c:333: warning: implicit declaration of function 'assert' make: *** [http11.o] Error 1 ruby extconf.rb install mongrel checking for main() in -lc... no creating Makefile make gcc -fPIC -Wall -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I. -c http11.c make install gcc -fPIC -Wall -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I. -c http11.c Successfully installed mongrel-0.3.12.4 Installing RDoc documentation for mongrel-0.3.12.4... andre at andre:~$ http11 doesn't seem to want to compile, just wondering what other packages might be necessary? kernel headers? Pixiedust? Thanks for clues, Andre -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060524/59571b77/attachment-0001.htm From luislavena at gmail.com Wed May 24 15:20:26 2006 From: luislavena at gmail.com (Luis Lavena) Date: Wed, 24 May 2006 16:20:26 -0300 Subject: [Mongrel] Mongrel install/compile problems on Ubuntu dapper In-Reply-To: <10d7a51f0605241216q7e3d0713q3e4c97edbebd8bf6@mail.gmail.com> References: <10d7a51f0605241216q7e3d0713q3e4c97edbebd8bf6@mail.gmail.com> Message-ID: <71166b3b0605241220w632846bfs2ab6fda75d3d1380@mail.gmail.com> On 5/24/06, Andre Turpin wrote: [...] > Building native extensions. This could take a while... > In file included from http11.c:1: > /usr/lib/ruby/1.8/i486-linux/ruby.h:28:21: error: stdlib.h: > No such file or directory > /usr/lib/ruby/1.8/i486-linux/ruby.h:32:21: error: string.h: > No such file or directory > /usr/lib/ruby/1.8/i486-linux/ruby.h:42:19: error: stdio.h: > No such file or directory > /usr/lib/ruby/1.8/i486-linux/ruby.h:64:20: error: alloca.h: Looks like you don't have all the tools for a build env... stdlib.h and stdio.h must be in the INCLUDE environment variable. -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From technoweenie at gmail.com Wed May 24 16:08:57 2006 From: technoweenie at gmail.com (Rick Olson) Date: Wed, 24 May 2006 15:08:57 -0500 Subject: [Mongrel] Rails App in Subfolder = Routing Error Recognition Failed In-Reply-To: <736593a0605241200p62c06efap92ae2967e26b5d70@mail.gmail.com> References: <736593a0605241200p62c06efap92ae2967e26b5d70@mail.gmail.com> Message-ID: <48fe25b0605241308u536defefka497e7074d0eb430@mail.gmail.com> > Routing Error > Recognition failed for "/RailsAppSample/" > > (I've seen examples of people running multiple rails apps under lighttpd + > fcgi using a "strip-request-uri" option, but I don't think that exists for > mod_proxy.) > > Does anyone have any suggestions? try this (in config/environment.rb) ActionController::AbstractRequest.relative_url_root = "/RailsAppSample" -- Rick Olson http://techno-weenie.net From tlockney at gmail.com Wed May 24 18:42:27 2006 From: tlockney at gmail.com (Thomas Lockney) Date: Wed, 24 May 2006 15:42:27 -0700 Subject: [Mongrel] Mongrel install/compile problems on Ubuntu dapper In-Reply-To: <10d7a51f0605241216q7e3d0713q3e4c97edbebd8bf6@mail.gmail.com> References: <10d7a51f0605241216q7e3d0713q3e4c97edbebd8bf6@mail.gmail.com> Message-ID: On 5/24/06, Andre Turpin wrote: > > Installed gcc and make and the default friends that they bring along, then > did > # sudo gem install mongrel > try installing the build-essential package (apt-get install build-essential), it's possible some of the standard libs didn't get installed by just installing gcc and make. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060524/19d4e4b6/attachment.htm From andreturpin at gmail.com Wed May 24 19:56:34 2006 From: andreturpin at gmail.com (Andre Turpin) Date: Wed, 24 May 2006 17:56:34 -0600 Subject: [Mongrel] Mongrel install/compile problems on Ubuntu dapper In-Reply-To: References: <10d7a51f0605241216q7e3d0713q3e4c97edbebd8bf6@mail.gmail.com> Message-ID: <10d7a51f0605241656o496d93aaq4a09390069466c44@mail.gmail.com> Thanks Thomas for the suggestion...turns out it was largely error between the keyboard and the chair... running "apt-get install build-essential" threw in some stuff I didn't have on the system, and it was the most immediate fix but I also had a pre-release gem from Zed's announcement alongside the standard...not sure if maybe the two versions fighting was part/all of the problem... >Select RubyGem to uninstall: > 1. mongrel-0.3.12.4 > 2. mongrel-0.3.13 > 3. All versions > 3 Then reinstalling via gems normal method worked, it's working just fine. Thanks! -Andre -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060524/45899431/attachment.htm From peter.krantz at gmail.com Thu May 25 10:30:00 2006 From: peter.krantz at gmail.com (Peter Krantz) Date: Thu, 25 May 2006 16:30:00 +0200 Subject: [Mongrel] Instructions for virtual hosting with Apache + Mongrel? Message-ID: <7b9ad66d0605250730g1ac0136bmb7cd2090f706ba4e@mail.gmail.com> Hi! I am trying to convince my hosting provider to install Mongrel (so that I can use it behind Apache 1.3). I have looked, but could not find any instructions on how to set up Mongrel for virtual hosting specifically. My hosting provider runs FreeBSD. Installing the Mongrel gem and providing each account with an extra higher port for proxing behind Apache seems to easy. Could it really be that simple? Kind regards, Peter http://www.standards-schmandards.com http://www.peterkrantz.com From jw at innerewut.de Thu May 25 10:59:12 2006 From: jw at innerewut.de (Jonathan Weiss) Date: Thu, 25 May 2006 16:59:12 +0200 Subject: [Mongrel] Instructions for virtual hosting with Apache + Mongrel? In-Reply-To: <7b9ad66d0605250730g1ac0136bmb7cd2090f706ba4e@mail.gmail.com> References: <7b9ad66d0605250730g1ac0136bmb7cd2090f706ba4e@mail.gmail.com> Message-ID: <4475C640.1060308@innerewut.de> Peter Krantz wrote: > Hi! > > I am trying to convince my hosting provider to install Mongrel (so > that I can use it behind Apache 1.3). I have looked, but could not > find any instructions on how to set up Mongrel for virtual hosting > specifically. My hosting provider runs FreeBSD. > > Installing the Mongrel gem and providing each account with an extra > higher port for proxing behind Apache seems to easy. Could it really > be that simple? Yes, you have normal virtual host definitions and proxy them to Mongrel. Each proxy/mongrel uses another port. > > Kind regards, > > Peter > Jonathan From defeated2k4 at gmail.com Thu May 25 17:11:03 2006 From: defeated2k4 at gmail.com (Ed C.) Date: Thu, 25 May 2006 17:11:03 -0400 Subject: [Mongrel] (OT?) Rails App in Subfolder = Routing Error Recognition Failed Message-ID: <736593a0605251411m1f582d9bp78a1f54a79a069f8@mail.gmail.com> All, I realize this was probably off-topic (not really mongrel-centric) -- my apologies. I "solved" the problem by appending to my Environment.rb: ActionController::AbstractRequest.relative_url_root = "/RailsAppSample" How come that doesn't serve up the default "public/index.html" ? It caused a Routing Error for "", so I added a temporary default to Routes.rb: map.connect '', :controller => "rails/info", :action => "properties" Regards, Ed C. On 5/24/06, Ed C. wrote: > > Zed / List, > > On my workstation I'm running lighttpd 1.4.11 and mongrel 0.3.12.4. Here > are my proxy settings: > > proxy.debug = 0 > proxy.balance = "fair" > proxy.server = ( > "/RailsAppSample" => (( > "host" => "127.0.0.1", > "port" => 1337 > ))) > > I can access http://localhost/ (default lighty welcome page) and > http://localhost:1337/ (default rails welcome page) just fine! > > However, when I try to access http://localhost/RailsAppSample/ I get: > > Routing Error > Recognition failed for "/RailsAppSample/" > > (I've seen examples of people running multiple rails apps under lighttpd + > fcgi using a "strip-request-uri" option, but I don't think that exists for > mod_proxy.) > > Does anyone have any suggestions? > > Thanks, > Ed C. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060525/11893223/attachment.htm From josh at besquared.net Fri May 26 04:49:59 2006 From: josh at besquared.net (Josh Ferguson) Date: Fri, 26 May 2006 04:49:59 -0400 Subject: [Mongrel] Plugin Question Message-ID: <4476C137.6070403@besquared.net> I got some advice from Rick last night and started coding this handler to allow for time-based secure downloading similar to mod_secdownload that lighttpd offers. I got most of the code in the handler worked out and packaged into a gem but am still having the following problems: 1) I have a configuration script as follows require 'mongrel' config = Mongrel::Configurator.new :host => "127.0.0.1" do listener do uri "/downloads", :handler => plugin('/handlers/securedownload',{:secret_string => "secret_string"}) end run end When I try 'listener :port => 3000 do' I get a bind (port already in use) error. The script above however starts up but http://localhost:3000/downloads doesn't start up the handler. The process method of my handler is never called, I just get a routing error from rails. 2) When I pass in the options to the plugin like this how do I get to the options hash while inside of the process method? Note: I also tried to get just the DirHandler example working and I couldn't get the server to recognize that path either, so there might be something more sinister going on here. Any help appreciated. If I can get this to recognize my handler I'll almost have it working. Is there a wiki I could do a writeup on as to how to write handlers after I get this finished? Josh Ferguson From jon.fernyhough at zogix.com Fri May 26 06:39:10 2006 From: jon.fernyhough at zogix.com (Jon Fernyhough) Date: Fri, 26 May 2006 11:39:10 +0100 Subject: [Mongrel] Packaging with mongrel Message-ID: <002201c680b0$9ffb3e00$1a02a8c0@jondell> Hi All First of all - I would like to say Mongrel is fantastic! We are developing a hybrid solution incorporating a central server and local servers (which allows offline working) - with Webrick we were suffering from 500 (and other errors) that the switch to Mongrel has fixed. Since we are providing the local server as a download application we wanted to find a way to package up the code and ruby modules that were being used. Erik Veenstra packaging application (http://www.erikveen.dds.nl/distributingrubyapplications/rails.html) provides a mechanism to generate a minimal size download with everything needed to run the ruby application. We had to overcome a couple of issues to get the package working with Mongrel and thought it good to share that info (and check that we haven't done something stupid)! 1. The first problem we had to overcome is in generating the exe package using Erik's rubyscript2exe. In generating an executable you need to include an "init.rb" file that starts Mongrel. This file is also executed during the packaging to determine which libraries need to be included. With webrick, once the server starts you stop it using Ctrl-C, which shuts the server down and allows the packaging script to complete. Using Mongrel on windows, the only way to stop the server is Ctrl-Break - which also stops the packaging process itself. On Linux I'm sure we could have used the "mongrel_rails stop" command but did not have that luxury on Windows. Instead, we found that we could start the mongrel server in a thread, combined with an appropriate sleep period the init.rb process terminates without us having to stop the server and allows rubyscript2exe to gather all the appropriate libraries. This is not what we want when we actually run the packaged exe - so we set a condition in the init.rb file that uses the thread during packaging and starts the server normally when we run the packaged exe: if defined?(REQUIRE2LIB) threadno1 = Thread.new { ARGV << "start" << "-n" << "20" version = "> 0" if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95 if Gem::Version.correct?(ARGV[0][1..-2]) version = ARGV[0][1..-2] ARGV.shift end end require_gem 'mongrel', version load 'mongrel_rails' } sleep 30.0 else ARGV << "start" << "-n" << "20" version = "> 0" if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95 if Gem::Version.correct?(ARGV[0][1..-2]) version = ARGV[0][1..-2] ARGV.shift end end require_gem 'mongrel', version load 'mongrel_rails' end 2. Although this mechanism generates the package, when we come to run the executable, the gem_plugin mechanism fails. Since our download does not rely on any plugins we added a couple of conditions in the mongrel_rails file to disable the plugin mechanism: if not defined?(RUBYSCRIPT2EXE) log "Loading any Rails specific GemPlugins" load_plugins end and if not defined?(RUBYSCRIPT2EXE) GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE end With these two changes, the packaged exe can now successfully run mongrel with our rails application. Can anybody see a reason why this is a bad thing to do or have suggestions on how this can be improved. --- Jon Fernyhough http://www.zogix.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060526/af804bcc/attachment-0001.htm From luislavena at gmail.com Fri May 26 09:53:50 2006 From: luislavena at gmail.com (Luis Lavena) Date: Fri, 26 May 2006 10:53:50 -0300 Subject: [Mongrel] Plugin Question In-Reply-To: <4476C137.6070403@besquared.net> References: <4476C137.6070403@besquared.net> Message-ID: <71166b3b0605260653h264ad346ra94375120a7b0e78@mail.gmail.com> On 5/26/06, Josh Ferguson wrote: [...] > > When I try 'listener :port => 3000 do' I get a bind (port already in > use) error. > Have you tried 'netstat' and see what process is using the port? [...] > > Note: I also tried to get just the DirHandler example working and I > couldn't get the server to recognize that path either, so there might be > something more sinister going on here. > I agree, I left in the desert process that still is using the port. You could also try adding the handler using the configuration script of mongrel_rails, so that avoids problems with typos or anything in your configurator implementation. > Any help appreciated. If I can get this to recognize my handler I'll > almost have it working. Is there a wiki I could do a writeup on as to > how to write handlers after I get this finished? > Whats your environment? OS, ruby -v, mongrel version, etc. No wiki yet, but write a draft and I think Zed will include in the official docs. Regards, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From luislavena at gmail.com Fri May 26 10:11:59 2006 From: luislavena at gmail.com (Luis Lavena) Date: Fri, 26 May 2006 11:11:59 -0300 Subject: [Mongrel] Packaging with mongrel In-Reply-To: <002201c680b0$9ffb3e00$1a02a8c0@jondell> References: <002201c680b0$9ffb3e00$1a02a8c0@jondell> Message-ID: <71166b3b0605260711k35603934ga83e1852bf7dfd28@mail.gmail.com> On 5/26/06, Jon Fernyhough wrote: > > > Hi All > > First of all - I would like to say Mongrel is fantastic! We are developing a > hybrid solution incorporating a central server and local servers (which > allows offline working) - with Webrick we were suffering from 500 (and other > errors) that the switch to Mongrel has fixed. > > Since we are providing the local server as a download application we wanted > to find a way to package up the code and ruby modules that were being used. > Erik Veenstra packaging application > (http://www.erikveen.dds.nl/distributingrubyapplications/rails.html) > provides a mechanism to generate a minimal size download with everything > needed to run the ruby application. We had to overcome a couple of issues to > get the package working with Mongrel and thought it good to share that info > (and check that we haven't done something stupid)! > The other thing you could use is All In One Ruby (also from Erik Veenstra) http://www.erikveen.dds.nl/allinoneruby/index.html > 1. The first problem we had to overcome is in generating the exe package > using Erik's rubyscript2exe. In generating an executable you need to include > an "init.rb" file that starts Mongrel. This file is also executed during the > packaging to determine which libraries need to be included. With webrick, > once the server starts you stop it using Ctrl-C, which shuts the server down > and allows the packaging script to complete. Using Mongrel on windows, the > only way to stop the server is Ctrl-Break - which also stops the packaging > process itself. On the beta gem (0.3.13) that issue is solved, so you could use Cntrl-C without problem in Windows or Linux. [...] > > if defined?(REQUIRE2LIB) > threadno1 = Thread.new { > ARGV << "start" << "-n" << "20" > version = "> 0" > if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95 > if Gem::Version.correct?(ARGV[0][1..-2]) > version = ARGV[0][1..-2] > ARGV.shift > end > end > > require_gem 'mongrel', version > load 'mongrel_rails' > } > > sleep 30.0 > else > ARGV << "start" << "-n" << "20" > version = "> 0" > if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95 > if Gem::Version.correct?(ARGV[0][1..-2]) > version = ARGV[0][1..-2] > ARGV.shift > end > end > > require_gem 'mongrel', version > load 'mongrel_rails' > end > I would suggest you replace the big sleep with small intervals: 30.times do sleep 1 end That will wait 30 seconds, but tell ruby scheduler to allow running its other threads. > > 2. Although this mechanism generates the package, when we come to run the > executable, the gem_plugin mechanism fails. Since our download does not rely > on any plugins we added a couple of conditions in the mongrel_rails file to > disable the plugin mechanism: [...] I have seen similar issues with gem_plugin running it as services. I'll suggest try the same env. using All In One Ruby which is more "traditional" than the script2exe. > > With these two changes, the packaged exe can now successfully run mongrel > with our rails application. Can anybody see a reason why this is a bad thing > to do or have suggestions on how this can be improved. > I have investigated the scenario you describe before, for the same purpose as you, but maintaining a packaged exe is more complicated than packaged zip with AIO Ruby. Also, we found that the late requiring done by the magic of rails often don't load all the libraries needed by the package, and fails miserably (with sqlite3 and mysql we tested that). Just my comments and suggestions. Regards, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From banshee at banshee.com Fri May 26 13:16:27 2006 From: banshee at banshee.com (James Moore) Date: Fri, 26 May 2006 10:16:27 -0700 Subject: [Mongrel] mongrel_rails cluster::start problem with multiple runs? Message-ID: <000901c680e8$1f916c70$6401a8c0@BansheeSoftware.local> mongrel_rails cluster::start doesn't seem to pay attention to whether or not the processes exist or not. If you run it twice, the first set of processes are created, then then second run will overwrite the log/{pidfiles} files with the new process numbers. Problem is that the second group of processes are gone, since the first ones had the port open. I'd think that the right thing to do would be for cluster::start to see if the process identified in the pidfile still exists, and to fail if it's still there. - James Moore From godber at uberhip.com Fri May 26 13:28:04 2006 From: godber at uberhip.com (Austin Godber) Date: Fri, 26 May 2006 10:28:04 -0700 Subject: [Mongrel] mongrel_rails cluster::start problem with multiple runs? In-Reply-To: <000901c680e8$1f916c70$6401a8c0@BansheeSoftware.local> References: <000901c680e8$1f916c70$6401a8c0@BansheeSoftware.local> Message-ID: <44773AA4.9030401@uberhip.com> James Moore wrote: > mongrel_rails cluster::start doesn't seem to pay attention to whether or not > the processes exist or not. If you run it twice, the first set of processes > are created, then then second run will overwrite the log/{pidfiles} files > with the new process numbers. Problem is that the second group of processes > are gone, since the first ones had the port open. > > I'd think that the right thing to do would be for cluster::start to see if > the process identified in the pidfile still exists, and to fail if it's > still there. The latest prerelease of mongrel fixes the pid stomping bug (4414). I haven't tried this in combination with the latest mongrel_cluster pre-release but its on my TODO list for the weekend. Check Zed's pre-release announcement: http://rubyforge.org/pipermail/mongrel-users/2006-May/000263.html Austin From zedshaw at zedshaw.com Fri May 26 13:36:41 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Fri, 26 May 2006 13:36:41 -0400 Subject: [Mongrel] Plugin Question In-Reply-To: <4476C137.6070403@besquared.net> References: <4476C137.6070403@besquared.net> Message-ID: <1148665001.7381.8.camel@localhost.localdomain> On Fri, 2006-05-26 at 04:49 -0400, Josh Ferguson wrote: > When I try 'listener :port => 3000 do' I get a bind (port already in > use) error. > Hey Josh, try a different port. Mostly likely you have something already running on 3000. If you are passing this to mongrel_rails with -S then you only need the "uri ..." statement. Not the whole Configurator class and so on. > The script above however starts up but http://localhost:3000/downloads > doesn't start up the handler. The process method of my handler is never > called, I just get a routing error from rails. > Well, if you can run rails actions then handlers are working. You'll have to first make sure it binds to the right port, or just use -S and pass it a file with only your "uri ..." statement. Then it should all work (with rails that is). > 2) When I pass in the options to the plugin like this how do I get to > the options hash while inside of the process method? Since you are using the plugin system, you get a few things for free: * listener is the listener that this handler is working with. * @options are the options that you were given. And @options is a hash. You can override this behavior by defining your own initialize method, and if you need something really really different then you can use the HttpHandler class which defines almost nothing. > > Note: I also tried to get just the DirHandler example working and I > couldn't get the server to recognize that path either, so there might be > something more sinister going on here. > Well, considering it works for rails I'll have to say you need to go back and review what you've done. If you're passing the code you showed to -S then all you have to do is strip out everything but the "uri ..." line and it should pick right up. > Any help appreciated. If I can get this to recognize my handler I'll > almost have it working. Is there a wiki I could do a writeup on as to > how to write handlers after I get this finished? http://mongrel.rubyforge.org/docs/contrib.html That's instructions on how to contribute documentation. I'm avoiding a wiki until I can get a fixed set of documentation done up that the wiki could be based on. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Fri May 26 13:40:00 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Fri, 26 May 2006 13:40:00 -0400 Subject: [Mongrel] Packaging with mongrel In-Reply-To: <002201c680b0$9ffb3e00$1a02a8c0@jondell> References: <002201c680b0$9ffb3e00$1a02a8c0@jondell> Message-ID: <1148665200.7381.11.camel@localhost.localdomain> On Fri, 2006-05-26 at 11:39 +0100, Jon Fernyhough wrote: > ? > Hi All > > Since we are providing the local server as a download application we > wanted to find a way to package up the code and ruby modules that were > being used. Erik Veenstra packaging application > (http://www.erikveen.dds.nl/distributingrubyapplications/rails.html) > provides a mechanism to generate a minimal size download with > everything needed to run the ruby application. We had to overcome a > couple of issues to get the package working with Mongrel and thought > it good to share that info (and check that we haven't done something > stupid)! > > With these two changes, the packaged exe can now successfully run > mongrel with our rails application. Can anybody see a reason why this > is a bad thing to do or have suggestions on how this can be improved. > Hey Jon, that's great. Do you think you'd like to write some documentation on this for the Mongrel site? Take a look at: http://mongrel.rubyforge.org/docs/contrib.html And then follow the instructions if you're interested. I'm sure other folks would like it. Since it's wiki syntax for the documentation (using webgen) you could probably start off by just cut-pasting your e-mail into a text file and cleaning it up a bit. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From zedshaw at zedshaw.com Fri May 26 13:41:33 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Fri, 26 May 2006 13:41:33 -0400 Subject: [Mongrel] mongrel_rails cluster::start problem with multiple runs? In-Reply-To: <000901c680e8$1f916c70$6401a8c0@BansheeSoftware.local> References: <000901c680e8$1f916c70$6401a8c0@BansheeSoftware.local> Message-ID: <1148665293.7381.13.camel@localhost.localdomain> On Fri, 2006-05-26 at 10:16 -0700, James Moore wrote: > mongrel_rails cluster::start doesn't seem to pay attention to whether or not > the processes exist or not. If you run it twice, the first set of processes > are created, then then second run will overwrite the log/{pidfiles} files > with the new process numbers. Problem is that the second group of processes > are gone, since the first ones had the port open. > > I'd think that the right thing to do would be for cluster::start to see if > the process identified in the pidfile still exists, and to fail if it's > still there. Hey James, can you say which version of Mongrel and which version of mongrel_cluster you're using? The latest pre-release of both fixes a lot of this. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From scoopr at iki.fi Sat May 27 10:50:15 2006 From: scoopr at iki.fi (Mikko Lehtonen) Date: Sat, 27 May 2006 17:50:15 +0300 Subject: [Mongrel] Error in http parser or client? Message-ID: <44786727.8030202@iki.fi> Hello, I started a little pet project of making a webdav plugin for mongrel. First thing I did was get the test suite called litmus from http://www.webdav.org/neon/litmus/ and run it against a completely dummy handler that doesn't even try to handle anything. Then mongrel said to me: BAD CLIENT (127.0.0.1): Invalid HTTP format, parsing fails. REQUEST DATA: DELETE /test/litmus/frag/#ment HTTP/1.1 Host: localhost:3000 User-Agent: litmus/0.10.5 neon/0.25.4 Connection: TE TE: trailers X-Litmus: basic: 8 (delete_fragment) Now, I'm completely new to dav protocol and mongrel itself (consider this a learning project), but shouldn't all dav be standard http, so that the http parser or the test suite has a bug, or I've completely misunderstood something.. For the record, that was the only test of about 14 that made mongrel say anything, otherwise the test suite failed with quite expected results. Thanks, Mikko Lehtonen From curio at free.fr Sun May 28 12:50:23 2006 From: curio at free.fr (=?ISO-8859-1?Q?Fran=E7ois_SIMOND?=) Date: Sun, 28 May 2006 18:50:23 +0200 Subject: [Mongrel] Rails, ActionController::Base.allow_concurrency and mongrel Message-ID: <4479D4CF.7080704@free.fr> Hello all, Are you aware of the rails ActionController::Base.allow_concurrency option ? If this option is true, rails is able to process simultaneous multiples actions. It appears that rails is thread-safe (if the user application is), and that this option is mostly unknown. Webrick take care of this option in rails-1.1.2/lib/webrick_server.rb at line 80 : REQUEST_MUTEX.lock unless ActionController::Base.allow_concurrency I think that even if using multi-threading in mongrel would not increase performance, it could dramatically decreases memory requirements for rails apps (usefull for shared hosting) and makes configuration easyer (proxy becomes optionnal) Thanks :) -- Fran?ois SIMOND From curio at free.fr Sun May 28 13:38:58 2006 From: curio at free.fr (=?ISO-8859-1?Q?Fran=E7ois_SIMOND?=) Date: Sun, 28 May 2006 19:38:58 +0200 Subject: [Mongrel] Patch : Rails, ActionController::Base.allow_concurrency and mongrel In-Reply-To: <4479D4CF.7080704@free.fr> References: <4479D4CF.7080704@free.fr> Message-ID: <4479E032.5050502@free.fr> Here is a rudimentary patch against mongrel-0.3.12.4, that basically works ! I could not imagine that it would be so easy :) -- Fran?ois SIMOND -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: patch Url: http://rubyforge.org/pipermail/mongrel-users/attachments/20060528/f1446434/attachment.bat From zedshaw at zedshaw.com Sun May 28 18:35:53 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Sun, 28 May 2006 18:35:53 -0400 Subject: [Mongrel] Patch : Rails, ActionController::Base.allow_concurrency and mongrel In-Reply-To: <4479E032.5050502@free.fr> References: <4479D4CF.7080704@free.fr> <4479E032.5050502@free.fr> Message-ID: <1148855753.5869.18.camel@localhost.localdomain> On Sun, 2006-05-28 at 19:38 +0200, Fran?ois SIMOND wrote: > Here is a rudimentary patch against mongrel-0.3.12.4, that basically works ! > I could not imagine that it would be so easy :) Here's the things that blow up--even with this setting--unless there's been some *major* improvements in how Rails' was structured: * Classes mysteriously "disappear" or aren't loaded. Ruby's dynamic class loading and instance_eval is not thread safe, so when multiple threads load rails actions, models, and helpers the Dispatcher throws random exceptions. * Model objects used in one thread show up in another thread. Last time this was because there were problems with how shared connections were being used between the different threads. * Requests mysteriously pick up other thread's request input or output. No idea why this was. It's really really weird. * High load causes database connections to explode exponentially into the thousands. This is caused by use Thread.current[] to store the DB connection, which causes the rails application to connect one time for each thread. * Once connected, the connection doesn't go away, but the thread does. This means that when each thread is created, connects, and then finishes it's response, the connection is kept around until the GC kills it. This causes file descriptor leaks that eventually make the whole Mongrel server stop functioning because the number of open files is greater than the 1024 select() limit on most systems. * Long running Mongrel servers start eating lots of memory or stop running. This is mostly caused by the connections per thread model not being cleaned up, but even when this is cleaned out it's still not good enough. Files, other thread, popen calls, fork, and many other resources or notoriously poorly managed by nearly every Rails programmer. I started working on fixing these problems way back in the SCGI days, but the task was so daunting that I just gave up. So, yes, your little patch is very easy. It probably won't work without a lot of extra effort. If you're interested in doing some hack-o-tronic work to make this function, then you'll have to either rule out the above problems (with more than one request with a browser) or find a way to implement fixes outside of rails. Some possible solutions: 1) Rip out anything left over in a Thread.current[] after the rails request is done. 2) Find a way to mark what request/response/IO objects are assigned to each thread, and then blow-up if they change during processing. This would most likely be a debugging option for people suspecting crossover. 3) Find a way to keep track of what a rails controller opens, and then make sure it gets closed completely. This'll be a real realy pain in the ass since people love to open crap at random and not clean it up. 4) Do a completely pre-loading when a rails application is started in production mode so that all classes are properly loaded ahead of time and you don't have to worry about Ruby's lack of thread safety here. If you're up to the challenge, then give it a shot. You'll want to setup a test harness with your current code that thrashes the living hell out of a real rails application for a long period of time and then fix everything that comes up. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ From curio at free.fr Sun May 28 20:28:28 2006 From: curio at free.fr (=?UTF-8?B?RnJhbsOnb2lzIFNJTU9ORA==?=) Date: Mon, 29 May 2006 02:28:28 +0200 Subject: [Mongrel] Patch : Rails, ActionController::Base.allow_concurrency and mongrel In-Reply-To: <1148855753.5869.18.camel@localhost.localdomain> References: <4479D4CF.7080704@free.fr> <4479E032.5050502@free.fr> <1148855753.5869.18.camel@localhost.localdomain> Message-ID: <447A402C.5030909@free.fr> Zed Shaw a ?crit : > On Sun, 2006-05-28 at 19:38 +0200, Fran?ois SIMOND wrote: > >> Here is a rudimentary patch against mongrel-0.3.12.4, that basically works ! >> I could not imagine that it would be so easy :) >> > > Here's the things that blow up--even with this setting--unless there's > been some *major* improvements in how Rails' was structured: > Too bad.. i thought that you had already made it but i wanted to try, encouraged by preliminar test results :) > * Classes mysteriously "disappear" or aren't loaded. Ruby's dynamic > class loading and instance_eval is not thread safe, so when multiple > threads load rails actions, models, and helpers the Dispatcher throws > random exceptions. > * Model objects used in one thread show up in another thread. Last time > this was because there were problems with how shared connections were > being used between the different threads. > * Requests mysteriously pick up other thread's request input or output. > No idea why this was. It's really really weird. > * High load causes database connections to explode exponentially into > the thousands. This is caused by use Thread.current[] to store the DB > connection, which causes the rails application to connect one time for > each thread. > * Once connected, the connection doesn't go away, but the thread does. > This means that when each thread is created, connects, and then finishes > it's response, the connection is kept around until the GC kills it. > This causes file descriptor leaks that eventually make the whole Mongrel > server stop functioning because the number of open files is greater than > the 1024 select() limit on most systems. > * Long running Mongrel servers start eating lots of memory or stop > running. This is mostly caused by the connections per thread model not > being cleaned up, but even when this is cleaned out it's still not good > enough. Files, other thread, popen calls, fork, and many other > resources or notoriously poorly managed by nearly every Rails > programmer. > For ActiveRecord related weirdness, i hope that it was adressed in 1.1.x by recent AR allow_concurrency modifications and connection pool patch. I neigher really have ideas for the wrong input or output.. Do you think that these threads were incorrectly finished ? ( like the example in http://groups.google.com/group/comp.lang.ruby/msg/0b79331e7d40e9b8 ) > I started working on fixing these problems way back in the SCGI days, > but the task was so daunting that I just gave up. So, yes, your little > patch is very easy. It probably won't work without a lot of extra > effort. > Were your fixes integrated in rails trunk ? > If you're interested in doing some hack-o-tronic work to make this > function, then you'll have to either rule out the above problems (with > more than one request with a browser) or find a way to implement fixes > outside of rails. Some possible solutions: > I love this word, "hack-o-tronic" :) but i do not know if i'll like to do it.. > 1) Rip out anything left over in a Thread.current[] after the rails > request is done. > Like Thread.current = nil GC.start ? :) > 2) Find a way to mark what request/response/IO objects are assigned to > each thread, and then blow-up if they change during processing. This > would most likely be a debugging option for people suspecting crossover. > Maybe it could be done by re-defining and logging each problematic operation. > 3) Find a way to keep track of what a rails controller opens, and then > make sure it gets closed completely. This'll be a real realy pain in > the ass since people love to open crap at random and not clean it up. > Right. That's the reason why rails team has disabled allow_concurrency by default. > 4) Do a completely pre-loading when a rails application is started in > production mode so that all classes are properly loaded ahead of time > and you don't have to worry about Ruby's lack of thread safety here. > An appropriate script could do that at mongrel rails startup, looking in standard or configured paths, and loading every class first. > If you're up to the challenge, then give it a shot. You'll want to > setup a test harness with your current code that thrashes the living > hell out of a real rails application for a long period of time and then > fix everything that comes up. My primary goal is to find solutions for a rails app that i'm currently developping (a free personnal and social photo gallery). This application need some long-time processings and uploads, and will be installed in shared hosting too. I'll maybe use BackgrounDRb for the image resize operations, but I think that i can build it better if i'm not much restricted in terms of time of concurrential requests, so I'll try ! Do you have testcases that I could use as a quickstart ? And thank you Zed for a such detailled response ! -- Francois Simond From banshee at banshee.com Mon May 29 14:50:10 2006 From: banshee at banshee.com (James Moore) Date: Mon, 29 May 2006 11:50:10 -0700 Subject: [Mongrel] mongrel_rails cluster::start problem withmultiple runs? In-Reply-To: <1148665293.7381.13.camel@localhost.localdomain> Message-ID: <01ae01c68350$b61ca230$6401a8c0@BansheeSoftware.local> > Hey James, can you say which version of Mongrel and which version of > mongrel_cluster you're using? The latest pre-release of both fixes a > lot of this. Just installed 0.3.13 on FC4. The behaviour of start doesn't match what I'd expect; it doesn't complain about starting twice: [james at server1 rv]$ /usr/local/bin/ruby /usr/local/bin/mongrel_rails start -d -e production -p 3000 -a 127.0.0.1 -P log/mongrel.3000.pid ** Starting Mongrel in production mode at 127.0.0.1:3000 ** Daemonizing, any open files are closed. Look at log/mongrel.3000.pid and log/mongrel.log for info. [james at server1 rv]$ /usr/local/bin/ruby /usr/local/bin/mongrel_rails start -d -e production -p 3000 -a 127.0.0.1 -P log/mongrel.3000.pid ** Starting Mongrel in production mode at 127.0.0.1:3000 ** Daemonizing, any open files are closed. Look at log/mongrel.3000.pid and log/mongrel.log for info. [james at server1 rv]$ My expectation would be behavior something like apachectl, where you get: [root at server1 httpd-2.2.2]# /usr/local/apache2/bin/apachectl start httpd (pid 16490) already running It may be that I need to adjust my expectations and this isn't a bug, though. My preference would be to have start fail if the pid file exists, and tell you the process exists. Restart would warn about a pidfile that exists but no matching process, but would continue on to start a server. Basically, match apachectl. (I was going to say that 'start' would fail if the pidfile was there but the process was gone, just like apachectl. I checked that behavior before mailing, and that's not what happens. apachectl will happily stomp on a pidfile with a bogus pid in it, which isn't how I thought it worked.) A 'cluster::status' command (outputing maybe something easy to parse, like YAML?) of some sort would be great, too. - James From banshee at banshee.com Mon May 29 15:06:10 2006 From: banshee at banshee.com (James Moore) Date: Mon, 29 May 2006 12:06:10 -0700 Subject: [Mongrel] Patch : Rails, ActionController::Base.allow_concurrency and mongrel In-Reply-To: <447A402C.5030909@free.fr> Message-ID: <022001c68352$f2a20860$6401a8c0@BansheeSoftware.local> Any thought for having a preforking mongrel, with a few features like min_servers, max_servers, min_spare_servers, etc? - James From josh at besquared.net Tue May 30 01:33:51 2006 From: josh at besquared.net (Josh Ferguson) Date: Tue, 30 May 2006 01:33:51 -0400 Subject: [Mongrel] Mongrel Bug Message-ID: <447BD93F.3020906@besquared.net> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060530/c8b30f37/attachment.htm From luislavena at gmail.com Tue May 30 07:27:26 2006 From: luislavena at gmail.com (Luis Lavena) Date: Tue, 30 May 2006 08:27:26 -0300 Subject: [Mongrel] Mongrel Bug In-Reply-To: <447BD93F.3020906@besquared.net> References: <447BD93F.3020906@besquared.net> Message-ID: <71166b3b0605300427w24f5df37xa700a9742b2c09d6@mail.gmail.com> On 5/30/06, Josh Ferguson wrote: > > Mongrel's tempfile generation on win32 is broken meaning large files can't > be uploaded. > > On line 198 of mongrel.rb (0.13.3) HttpRequest#initialize the tempfile > function is called: > > if clen > Const::MAX_BODY > @body = Tempfile.new(self.class.name) > @body.binmode > else > > Unfortunately this also includes the module name as the example shows: > > Mongrel::HttpRequest2496.9 > > Win32 doesn't allow the ':' character in file names so this fails. > > I just solved the problem by replacing > > self.class.name > > with > > self.class.name.split('::').last > > Cheers, > Josh Ferguson > Josh, thank you for the bug, this was already checked into SVN. But still isn't released (nor in the beta gem). My guess is that Zed will release 0.3.13 during this week. Regards, -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From jchavez at rojo.net Tue May 30 12:46:03 2006 From: jchavez at rojo.net (jchavez at rojo.net) Date: Tue, 30 May 2006 11:46:03 -0500 Subject: [Mongrel] Error in mongrel_rails script with Cygwin/Mongrel/Rails Message-ID: <447C76CB.1000007@rojo.net> Hi, I am experiencing an error in the mongrel_rails script on a pc under cygwin/mongrel/rails. My installation details and error are as follows: With some guidance from various blogposts out there, I installed Cygwin on a Windows XP box followed by: Ruby 1.8.4(via cygwin setup), Gems (0.8.1 via ruby install.rb), Mongrel .3.12.4 (via gems), Rake 0.7.1(via gems, GemPlugin (via gems), Rails (via gems -include-dependencies which installed dependencies but failed to install rails itself ) then, Rails (via gems w/out dependencies clause)to get rails. Using mongrel via simpletest.rb works just fine but when I attempt to run mongrel_rails, I get the following error: $ mongrel_rails /usr/lib/ruby/gems/1.8/gems/gem_plugin-0.2.1/lib/gem_plugin.rb:109:in `load': uninitialized constant Gem::SourceIndex (N ameError) from /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/bin/mongrel_rails:191 from /usr/bin/mongrel_rails:19 Which I think is on this line in the script: GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE Perhaps I missed installing a component? I'm not sure what the issue could be from this error. Any ideas where I might look? Thanks in advance, jchavez P.S. I attempted to build mongrel before installing via gems but didn't finish. Not sure if this would affect this. Also, I had posted this to the FAQ thread in the ruby forge forum but it seemed to be not the right place given the title. I've posted asking the admin to remove. Sorry for the bad post. From alisonrowland at fastmail.fm Tue May 30 15:44:49 2006 From: alisonrowland at fastmail.fm (Alison Rowland) Date: Tue, 30 May 2006 15:44:49 -0400 Subject: [Mongrel] Getting /etc/mongrel_cluster and startup script to work? Message-ID: Hi, I'm trying to setup my mongrel clusters to start on boot. I have followed the instructions under the "On Boot Initialization Setup" section at http://mongrel.rubyforge.org/docs/mongrel_cluster.html. When I try to start it up, I get the following error: me at mybox.com: sudo /etc/init.d/mongrel_cluster start Starting all mongrel_clusters... !!! Path to log file not valid: log/mongrel.log start reported an error. Use mongrel_rails start -h to get help. I have experimented with putting the full path to the log file in mongrel_cluster.yml, to no avail. mongrel_rails cluster::start works just fine when run from the app directory. Surely I must be missing something... any ideas? Thanks, Alison From godber at uberhip.com Tue May 30 15:54:18 2006 From: godber at uberhip.com (Austin Godber) Date: Tue, 30 May 2006 12:54:18 -0700 Subject: [Mongrel] Getting /etc/mongrel_cluster and startup script to work? In-Reply-To: References: Message-ID: <447CA2EA.8060106@uberhip.com> Alison Rowland wrote: > Hi, > > I'm trying to setup my mongrel clusters to start on boot. I have > followed the instructions under the "On Boot Initialization Setup" > section at http://mongrel.rubyforge.org/docs/mongrel_cluster.html. > > When I try to start it up, I get the following error: > > me at mybox.com: sudo /etc/init.d/mongrel_cluster start > Starting all mongrel_clusters... > !!! Path to log file not valid: log/mongrel.log > start reported an error. Use mongrel_rails start -h to get help. > > I have experimented with putting the full path to the log file in > mongrel_cluster.yml, to no avail. mongrel_rails cluster::start works > just fine when run from the app directory. Surely I must be missing > something... any ideas? It sounds like the -c option didn't work for you when configuring. This -c option needs to be set so that all the paths are relative to your apps root directory. When you run the "mongrel_rails cluster::configure" command make sure it looks like this: sudo mongrel_rails cluster::configure -e production -p 8000 -N 3 \ -c /usr/local/vhosts/testapp --user mongrel --group mongrel After you have run this, your config/mongrel_cluster.yml should look something like this: --- user: mongrel cwd: /usr/local/vhosts/testapp port: "8000" environment: development group: mongrel pid_file: log/mongrel.pid servers: 3 Again, its critical that the cwd: entry be present. Depending on your browser the mongrel_cluster page covers up part of that command with the news column. I will shorten that line. Thanks for your feedback and let me know how it goes. Austin From josh at besquared.net Tue May 30 15:59:57 2006 From: josh at besquared.net (Josh Ferguson) Date: Tue, 30 May 2006 15:59:57 -0400 Subject: [Mongrel] x-sendfile Message-ID: <447CA43D.3090105@besquared.net> I wrote an x-sendfile thing for the railshandler to get mongrel to catch the response header and stream out files from an application I'm writing but I'm pretty sure that zed said he'd built in x-sendfile somewhere already. I couldn't find it, could someone lead me to it? Does mongrel work with SSL? If not is anyone interested in having someone write in SSL support? heh Josh From zedshaw at zedshaw.com Tue May 30 16:26:23 2006 From: zedshaw at zedshaw.com (zedshaw at zedshaw.com) Date: Tue, 30 May 2006 13:26:23 -0700 (PDT) Subject: [Mongrel] x-sendfile In-Reply-To: <447CA43D.3090105@besquared.net> References: <447CA43D.3090105@besquared.net> Message-ID: <63815.154.20.236.245.1149020783.squirrel@webmail.zedshaw.com> > I wrote an x-sendfile thing for the railshandler to get mongrel to catch > the response header and stream out files from an application I'm writing > but I'm pretty sure that zed said he'd built in x-sendfile somewhere > already. I couldn't find it, could someone lead me to it? > > Does mongrel work with SSL? If not is anyone interested in having > someone write in SSL support? heh > > Josh No x-sendfile support, but actually just better "sendfile" support (a system API call and method for streaming out files better in Mongrel). The x-sendfile stuff tends to be more application framework specific rather than a Mongrel thing. Mongrel tries to reduce the amount of interference with the app frameworks since they usually make their own (more intelligent) decisions about what to send or not. Instead, each framework just needs a plugin that adds x-sendfile and they're set. Now, if you've got something that has a usage outside of the frameworks then just make a gemplugin (I'll help) and publish it same way as mongrel_cluster. As for SSL, nothing yet. Remember that Mongrel is not intended to be a full web server, so rather than bloat it with SSL support we just recommend putting it behind a real web server, kssl, stunnel, or some other "SSL heavy lifter". I think pen has experimental SSL support. You might try that out. Zed From josh at besquared.net Tue May 30 17:03:32 2006 From: josh at besquared.net (Josh Ferguson) Date: Tue, 30 May 2006 17:03:32 -0400 Subject: [Mongrel] Mongrel Secure Download Handler In-Reply-To: <63815.154.20.236.245.1149020783.squirrel@webmail.zedshaw.com> References: <447CA43D.3090105@besquared.net> <63815.154.20.236.245.1149020783.squirrel@webmail.zedshaw.com> Message-ID: <447CB324.7010204@besquared.net> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060530/20f59bc8/attachment.htm From zedshaw at zedshaw.com Tue May 30 19:47:08 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Tue, 30 May 2006 19:47:08 -0400 Subject: [Mongrel] Mongrel Bug In-Reply-To: <447BD93F.3020906@besquared.net> References: <447BD93F.3020906@besquared.net> Message-ID: <1149032828.6081.1.camel@localhost.localdomain> On Tue, 2006-05-30 at 01:33 -0400, Josh Ferguson wrote: > Mongrel's tempfile generation on win32 is broken meaning large files > can't be uploaded. > > On line 198 of mongrel.rb (0.13.3) HttpRequest#initialize the tempfile > function is called: > > if clen > Const::MAX_BODY > @body = Tempfile.new(self.class.name) > @body.binmode Looks like the way tempfiles are made is pretty irregular. I just fixed this under win32 using cygwin. When I get the regular ruby one-click installed i'll test it there. Also fixed up a few other annoying things related to win32. Anyway, I'll be pumping out a release later tonight that will include a win32 gem as well. Stay tuned and be ready to test. Zed From zedshaw at zedshaw.com Tue May 30 19:49:32 2006 From: zedshaw at zedshaw.com (Zed Shaw) Date: Tue, 30 May 2006 19:49:32 -0400 Subject: [Mongrel] Patch : Rails, ActionController::Base.allow_concurrency and mongrel In-Reply-To: <022001c68352$f2a20860$6401a8c0@BansheeSoftware.local> References: <022001c68352$f2a20860$6401a8c0@BansheeSoftware.local> Message-ID: <1149032972.6081.5.camel@localhost.localdomain> On Mon, 2006-05-29 at 12:06 -0700, James Moore wrote: > Any thought for having a preforking mongrel, with a few features like > min_servers, max_servers, min_spare_servers, etc? > > - James Pre-forking is not reliable under ruby for some odd reason. I had this running with SCGI, but when the IO on the main socket comes in at higher rates you get the data mixed up between the pre-forked processes. Only way around it is to write a custom C program that then embeds Ruby which then runs Mongrel, which is a lot more trouble than it's worth right now. And, none of the preforking will ever work on win32 since windows doesn't have the same kind of fork semantics that Unix does. Zed From luislavena at gmail.com Wed May 31 00:57:50 2006 From: luislavena at gmail.com (Luis Lavena) Date: Wed, 31 May 2006 01:57:50 -0300 Subject: [Mongrel] SVN revision 218: errors and failures under win32. Message-ID: <71166b3b0605302157o79b71e05l3f95873c7eaa8074@mail.gmail.com> Zed: 1) Error: test_more_web_server(HandlersTest): EOFError: end of file reached I solved this changing the following lines in test_handlers.rb:75-76 res = hit([ "http://127.0.0.1:9998/", "http://127.0.0.1:9998/test", I cannot solve the other failures: 1) Failure: test_header_is_too_long(WebServerTest) [./test/test_ws.rb:93:in `test_header_is_too_long' ./test/testhelp.rb:8:in `redirect_test_io' ./test/test_ws.rb:91:in `test_header_is_too_long']: <[Errno::ECONNRESET, Errno::EPIPE, Errno::ECONNABORTED]> exception expected but none was thrown. 2) Failure: test_num_processors_overload(WebServerTest) [./test/test_ws.rb:101:in `test_num_processors_overload' ./test/testhelp.rb:8:in `redirect_test_io' ./test/test_ws.rb:100:in `test_num_processors_overload']: <[Errno::ECONNRESET, Errno::EPIPE]> exception expected but was Class: Message: <"Invalid argument"> -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From zedshaw at zedshaw.com Wed May 31 03:19:48 2006 From: zedshaw at zedshaw.com (zedshaw at zedshaw.com) Date: Wed, 31 May 2006 00:19:48 -0700 (PDT) Subject: [Mongrel] SVN revision 218: errors and failures under win32. In-Reply-To: <71166b3b0605302157o79b71e05l3f95873c7eaa8074@mail.gmail.com> References: <71166b3b0605302157o79b71e05l3f95873c7eaa8074@mail.gmail.com> Message-ID: <1094.67.69.65.253.1149059988.squirrel@webmail.zedshaw.com> Ok, I'll fix those up tonight when I test on ruby one-click. > Zed: > > 1) Error: > test_more_web_server(HandlersTest): > EOFError: end of file reached > > I solved this changing the following lines in test_handlers.rb:75-76 > res = hit([ "http://127.0.0.1:9998/", > "http://127.0.0.1:9998/test", > From jchavez at rojo.net Wed May 31 13:55:00 2006 From: jchavez at rojo.net (jchavez at rojo.net) Date: Wed, 31 May 2006 12:55:00 -0500 Subject: [Mongrel] Error in mongrel_rails script with Cygwin/Mongrel/Rails In-Reply-To: <447C76CB.1000007@rojo.net> References: <447C76CB.1000007@rojo.net> Message-ID: <447DD874.6070009@rojo.net> Hi, I seemed to have solved the problem. For everyone's benefit, what I did was I uninstalled all the rails gems, re-installed gems (version 0.8.11 tgz from rubyforge) and reinstalled rails with --include-dependences (which is now an option) and everything works perfectly. Nice to see mongrel and rails starting up smoothly on cygwin. Next up is configuring an app with the db backend in which I saw a few concerns on sqlite on various posts. thx. jchavez at rojo.net wrote: > Hi, > > I am experiencing an error in the mongrel_rails script on a pc under > cygwin/mongrel/rails. My installation details and error are as follows: > > With some guidance from various blogposts out there, I installed Cygwin > on a Windows XP box followed by: > Ruby 1.8.4(via cygwin setup), > Gems (0.8.1 via ruby install.rb), > Mongrel .3.12.4 (via gems), > Rake 0.7.1(via gems, > GemPlugin (via gems), > Rails (via gems -include-dependencies which installed dependencies but > failed to install rails itself ) then, > Rails (via gems w/out dependencies clause)to get rails. > > Using mongrel via simpletest.rb works just fine but when I attempt to > run mongrel_rails, I get the following error: > > $ mongrel_rails > /usr/lib/ruby/gems/1.8/gems/gem_plugin-0.2.1/lib/gem_plugin.rb:109:in > `load': uninitialized constant Gem::SourceIndex (N > ameError) > from /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/bin/mongrel_rails:191 > from /usr/bin/mongrel_rails:19 > > Which I think is on this line in the script: > GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE, > "rails" => GemPlugin::EXCLUDE > > Perhaps I missed installing a component? I'm not sure what the issue > could be from this error. Any ideas where I might look? > > Thanks in advance, > jchavez > > P.S. I attempted to build mongrel before installing via gems but didn't > finish. Not sure if this would affect this. > > Also, I had posted this to the FAQ thread in the ruby forge forum but it > seemed to be not the right place given the title. I've posted asking the > admin to remove. Sorry for the bad post. > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > From alisonrowland at fastmail.fm Wed May 31 15:14:28 2006 From: alisonrowland at fastmail.fm (Alison Rowland) Date: Wed, 31 May 2006 15:14:28 -0400 Subject: [Mongrel] Getting /etc/mongrel_cluster and startup script to work? In-Reply-To: <447CA2EA.8060106@uberhip.com> References: <447CA2EA.8060106@uberhip.com> Message-ID: Thanks, configuring with -c did the trick! But now I've got a different problem: I can't get the startup script to work at system reboot. It's in /etc/init.d, and it works like a charm when I call it from the command line. I'm on Ubuntu, and my system runlevel is 2. I used sysv-rc-conf (which I've successfully used before) to set it up, and I've confirmed that it's symlinked (e.g. S20mongrel_cluster) in /etc/rc2.d. I have tried setting it to start before the webserver (Litespeed), and also after, to no avail. Upon restart, no mongrel, but it'll start right up if I call it manually. Any ideas? Thanks. --Alison On May 30, 2006, at 3:54 PM, Austin Godber wrote: > Alison Rowland wrote: >> Hi, >> >> I'm trying to setup my mongrel clusters to start on boot. I have >> followed the instructions under the "On Boot Initialization Setup" >> section at http://mongrel.rubyforge.org/docs/mongrel_cluster.html. >> >> When I try to start it up, I get the following error: >> >> me at mybox.com: sudo /etc/init.d/mongrel_cluster start >> Starting all mongrel_clusters... >> !!! Path to log file not valid: log/mongrel.log >> start reported an error. Use mongrel_rails start -h to get help. >> >> I have experimented with putting the full path to the log file in >> mongrel_cluster.yml, to no avail. mongrel_rails cluster::start works >> just fine when run from the app directory. Surely I must be missing >> something... any ideas? > > It sounds like the -c option didn't work for you when configuring. > This > -c option needs to be set so that all the paths are relative to your > apps root directory. > > When you run the "mongrel_rails cluster::configure" command make > sure it > looks like this: > > sudo mongrel_rails cluster::configure -e production -p 8000 -N 3 \ > -c /usr/local/vhosts/testapp --user mongrel --group mongrel > > After you have run this, your config/mongrel_cluster.yml should look > something like this: > > --- > user: mongrel > cwd: /usr/local/vhosts/testapp > port: "8000" > environment: development > group: mongrel > pid_file: log/mongrel.pid > servers: 3 > > Again, its critical that the cwd: entry be present. > > Depending on your browser the mongrel_cluster page covers up part of > that command with the news column. I will shorten that line. > > Thanks for your feedback and let me know how it goes. > > Austin > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users From godber at gmail.com Wed May 31 21:50:14 2006 From: godber at gmail.com (Austin Godber) Date: Wed, 31 May 2006 18:50:14 -0700 Subject: [Mongrel] Getting /etc/mongrel_cluster and startup script to work? In-Reply-To: References: <447CA2EA.8060106@uberhip.com> Message-ID: <50c31cc40605311850u2badb44ctbc258d039a24e725@mail.gmail.com> On 5/31/06, Alison Rowland wrote: > Thanks, configuring with -c did the trick! > > But now I've got a different problem: I can't get the startup script > to work at system reboot. It's in /etc/init.d, and it works like a > charm when I call it from the command line. I'm on Ubuntu, and my > system runlevel is 2. I used sysv-rc-conf (which I've successfully > used before) to set it up, and I've confirmed that it's symlinked > (e.g. S20mongrel_cluster) in /etc/rc2.d. I have tried setting it to > start before the webserver (Litespeed), and also after, to no avail. > Upon restart, no mongrel, but it'll start right up if I call it > manually. Any ideas? Thanks. Hmm ... take a look at your init script ... I bet it can't find mongrel_cluster_ctl because its in /usr/local/bin ... try changing this: CONF_DIR=/etc/mongrel_cluster RETVAL=0 to this: CONF_DIR=/etc/mongrel_cluster PATH=/usr/local/bin:$PATH RETVAL=0 Just make sure you are adding the real path to mongrel_cluster_ctl. This solution should work I will bring this to Bradley's attention so he can fix it in the distribution the way he sees fit. Let me know if this solves your problem. Austin