Re: [Mongrel] dropping lighty+fastcgi and moving to apache+mongrel in production

2007-03-13 Thread Philip Hallstrom
 Most of my machines have apache+mongrel running but the mongrels are using
 the localhost.
 In my production environment, I have 4 boxes. I have setup 2 http servers (
 apache 2.2.4 ) and 2 app servers. They are currently using lighttpd+fastcgi.
 Which I am changing this week.
 I want to get advice from you guys before I actually do this since this is
 my production env.

 I have installed apache on the the 2 https servers and will serve local
 content in app/public on them both, but in my cluster.conf file on my
 staging server I use:

 BalancerMember http://localhost:port(s)

 Since I have 2 app servers (separate boxes), I plan on running 10 mongrels
 on each.. I am assuming I just simply use:

Why 10?  Have you tested that assumption?  We found 4 mongrels to be our 
sweet spot... http://mongrel.rubyforge.org/docs/how_many_mongrels.html

Also, you might consider merging the web/app servers... we found that 
apache didn't use up that many resources serving static files so each of 
our servers runs both apache and mongrel.  So you might consider running 
apache + 4 mongrels on each of the 4 servers...

Guess I'm assuming your HTTP is behind some other load balancer...


 BalancerMember http://10.0.1.1:800*
 ...
 BalancerMember http://10.0.1.2:800*
 ...

 Should this be identical on both http servers?

 So I would have a total of 20 entries per conf on each http server ( 10x2
 mongrels for 2 app servers ).

 Otherwise I am assuming the setup is the same as if they were local
 mongrels. If you guys can let me know if I am on the right track here I
 would appreciate it.

 Regards,
 -- 
 -mike

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] dropping lighty+fastcgi and moving to apache+mongrel in production

2007-03-13 Thread Philip Hallstrom
  Since I have 2 app servers (separate boxes), I plan on running 10
 mongrels
  on each.. I am assuming I just simply use:
 
 Why 10?  Have you tested that assumption?  We found 4 mongrels to be our
 sweet spot... http://mongrel.rubyforge.org/docs/how_many_mongrels.html

 Well, Someone else on the team had previously set up 10 so that is what I
 was assuming to go with here. I will read the link you just gave me. Thanks
 you!

Yeah, definitely go through the steps in that URL.  We had been running 20 
FCGI's then went to 8 mongrels I believe then Zed posted those docs and 
when we tested we found 4 to be ideal.  Seems counter intuitive, but there 
ya go :)

 Also, you might consider merging the web/app servers... we found that
 apache didn't use up that many resources serving static files so each of
 our servers runs both apache and mongrel.  So you might consider running
 apache + 4 mongrels on each of the 4 servers...

 I did think of that and suggested it to the CIO. I was wondering why we
 would go 2 and 2 when 4 and 4 gives us the performance and redundancy, I am
 pondering your suggestions whole heartedly. Just a note I have been a *nix
 admin for roughly 8 years but this is my first Rails production environment.
 So I don't have much experience. Your feedback is more than helpful.

I suppose it depends on how hard your apache servers are working.  Ours 
don't work that hard at all so we'd rather rails had access to more 
ram/cpu...

 Guess I'm assuming your HTTP is behind some other load balancer...

 Interestingly enough we don't. In many of the other networks we did have HW
 for load balancing. This environment is using round robin dns, though this
 is my first encounter with using round robin to handle the load balancing
 needs as well. I am open to any suggestions you may have in regards to the
 direction we should investigate. Right now there are 4 machines but soon
 that may double. So I am thinking of both short-term and long-term needs
 right now. Anything else you have to offer would be appreciated.

Hrm.  I think I would.  The problem with round robin is how long the cycle 
is... if it's too long and you get slashdotted (for example) won't all 
those new users end up on a single web server?

I didn't set it up, but I like the load balancer we've got since it lets 
us disable a backend and we can take it offline and do whatever we want 
with it and bring it back up, etc...

I haven't used it, but a lot of people really seem to like HAproxy as a 
software solution.  Might be worth investigating as well.

-p
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Multiple Processes Spawned from mongrel_rails start ?

2007-02-15 Thread Philip Hallstrom
 I have mongrel 1.0.1, rails 1.2.2 ruby 1.8.5 running on Centos 4.4.

 When I execute the mongrel_rails start -d I see that 3 processes are spawned. 
  See below:

 [EMAIL PROTECTED] aaa]# mongrel_rails start -d
 [EMAIL PROTECTED] aaa]# ps -def |grep mong
 root  2743 1  9 07:14 ?00:00:01 /usr/bin/ruby 
 /usr/bin/mongrel_rails start -d
 root  2744  2743  0 07:14 ?00:00:00 /usr/bin/ruby 
 /usr/bin/mongrel_rails start -d
 root  2745  2744  0 07:14 ?00:00:00 /usr/bin/ruby 
 /usr/bin/mongrel_rails start -d

 Is this normal?

 When I had mongrel 0.3.13.3, rails 1.1.0, ruby 1.8.4 on rhel 4 only 1 process 
 would be spawned.

 I realize I changed versions of EVERYTHING so I'm wondering if this is 
 now the normal behavior or if something is going wrong.


Search the list for this issue... I don't remember the particulars other 
than some OS's report three instances via ps even though there really is 
only one running...

-philip
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Attention FreeBSD Gurus

2007-01-26 Thread Philip Hallstrom
 I received this piece of code in a patch that turns on the FreeBSD http 
 filtering.  I completely missed that it calls /sbin/sysctl directly 
 which means I'm slipping on my auditing.

[snip]
unless `/sbin/sysctl -nq net.inet.accf.http`.empty?
[snip]

 I'd like to know the following from the FreeBSD crew:

 1) Are there any potential malicious potentials to this?  I don't assume 
 any intent, but would like to know if I need to rush out a fix if 
 there's a hackable problem with this (even theoretical).

Looks okay to me, and there's no arguments being passed in.. as long as 
it's not in a loop somewhere :)

 2) What would be the un-ghetto way to do this same check?

This is probably the easiest, unless you wanted to write a C extension for 
accessing sysctl on freebsd.

http://www.freebsd.org/cgi/man.cgi?query=sysctlapropos=0sektion=3manpath=FreeBSD+6.1-RELEASEformat=html

The only thing I'd keep in mind is this section at the end of the 
sysctl(1) man page:

BUGS
 The sysctl utility presently exploits an undocumented 
interface to
the kernel sysctl facility to traverse the sysctl tree and to retrieve
format and name information.  This correct interface is being thought
about for the time being.

http://www.freebsd.org/cgi/man.cgi?query=sysctlapropos=0sektion=0manpath=FreeBSD+6.1-RELEASEformat=html

But I've been using freebsd since 1998 and sysctl has always been there 
and for what I use it for (about the same as above) hasn't changed that I 
can recall...

-philip
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


[Mongrel] Anyway to dynamically start/stop mongrel based on web traffic?

2007-01-10 Thread Philip Hallstrom
Hey all -

I've got a question that I haven't seen addressed anywhere and was 
wondering if anyone has put any thought into it or not...

Here's my setup... I have several *small* sites running apache/mongrel. 
Each has a single mongrel instance.  Most don't get any traffic (no one 
reads my blog :).

And I was thinking, I could host a couple of more sites/projects without 
worrying about ram if I could find a way have all my mongrels be off until 
a request came in... then apache (or some other server) could block until 
it could get mongrel started, then keep processing the request.

Then I could either kill off the mongrel later if no traffic was coming 
in.

Or perhaps mongrel itself could stay running, but unload (and free the 
ram) of rails until a request came in, then load it back up for awhile 
until traffic stopped and unload it...

So.. I guess I'm wondering if anyone's done anything like this or if it is 
possible and if so what the best way to go about it might be?  I'd be 
willing to help (if I can, but not sure how likely that is :)

It would be nice to have my little apps that get little traffic not suck 
up so much ram while idle..

-philip
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Anyway to dynamically start/stop mongrel based on web traffic?

2007-01-10 Thread Philip Hallstrom
 Philip Hallstrom wrote:
 Then I could either kill off the mongrel later if no traffic was coming
 in.

 Or perhaps mongrel itself could stay running, but unload (and free the
 ram) of rails until a request came in, then load it back up for awhile
 until traffic stopped and unload it...

 What you're talking about is inetd functionality for a rails process. If
 you're on a sane unix, you could probably make that happen. Take a look
 at /etc/inetd.conf, or your version thereof.

Kind of... my understanding of inetd though is that it listens on the 
port, accepts the connection, spawns the process and the process talks via 
stdin/out till done, then exits.

What I want is a front-end webserver that realizes mongrel isn't running, 
holds the connection while it starts it, then continues as normal.  I 
can kill the mongrel off later somehow...

Basically I want dynamically spawned FCGI processes, but I've used FCGI 
before which is why I'm now using mongrel :)

An ugly brute force would be to simply watch apache's logs for a 503 error 
and if seen start up mongrel, but that means one user is gonna get a 
broken page...

I don't know enough about mongrel/rails/ruby to know if mongrel can unload 
the majority of that 30mb it's using, but still keep on listening, but if 
someone (Zed? :) wanted to give me some pointers I'd love to give it a try 
:)

-philip
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Rails' send_file, Mongrel, and *gasp* memory

2006-12-21 Thread Philip Hallstrom
 I've had a right fun few days at work trying to figure out why our Rails
 app (which isn't under very heavy load) kept eating memory and bringing
 our server to our knees. Eventually I traced it to send_file (which was
 in a way a relief as it wasn't down to my coding ;) -- every time a user
 started downloading, the memory consumed by the app would jump, and
 wouldn't go down again, even when they had cancelled the download (I
 haven't tested whether the memory would still be consumed after they
 completed the download). This has become apparent recently as the app
 has been used for larger files (150MB and upwards). As a fix I've
 delegated file serving to lighttpd + mod_sec_download, not quite as
 convenient but probably better in the long run anyway.

 So the problem is solved, but I was just wondering why this happened in
 the first place; according to the Rails docs, send_file buffers the
 response in order to not tie up memory. However, this was clearly not
 happening -- is this possibly related to how Mongrel interacts with
 Rails? If so, I gave it a try under lighttpd and still had the problem,
 any idea why? I'm really just looking to understand the issue better as
 I hate to walk away from a problem without fully comprehending it :)

You don't say it, but are you using the sendfile gem?  There was a lot of 
talk about there being serious problems with the sendfile gem on various 
platforms to the point that Zed explicitly told people to stop using 
it

Just a thought.
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] RMagick=bad, ???=good

2006-12-15 Thread Philip Hallstrom
 I know that Zed has made mention of the fact that using RMagick with
 mongrel and rails is a bad thing. I'm currently using FlexImage (which
 in turn uses RMagick) on my application and really haven't had too
 many problems. We get a restart for memory usage every 8-10 hours on
 one mongrel of twelve running, but I'm not sure if that's an RMagick
 issue. Either way, I'd like to make my system better if I can.

 Right now I've got controllers that are using both send_data (sending
 image stored in the db, using RMagick to crop/resize before sending)
 and send_file (sending a static image on the site that needs to be
 sent inline). Image upload is being handled by FlexImage, which will
 save the image to the DB, resizing it to 640x480 before saving if it's
 too big.

 My question is, what then is the preferred method of doing image
 manipulation while running mongrel?
 Convert FlexImage to use mini-magick?
 Create a custom system to offload the image processing to another process?

 If someone can provide some insight or examples, it would be appreciated.

Just to add to what others have said there is also the GD2 library and if 
you're willing to shell out, netpbm.  Although I would imagine GD2 has the 
same potential for memory leaks as ImageMagick if I understand the issue 
correctly (that is ruby not knowing about memory allocated by the 
extension).

We use rmagick now, but don't upload that many images (admin interface 
only).  My last job (not Rails, but that doesn't matter) we shelled out to 
netpbm for a couple of reasons -- we were dealing with a lot of arcane 
formats (PCX with specific header formats) and because I'd run some tests 
converting/scaling images using GD, ImageMagick, and netpbm and netpbm 
seemed to do the best job and delivery the smallest file.

Now... that was about six years ago so things may certainly have changed.

-philip
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] mongrel served from a subdirectory

2006-11-30 Thread Philip Hallstrom
 Hello,
 I have setup mongrel successfully a few times now, but, each time I have
 used apaceh 2.2 and mod_proxy setup descibed on the mongrel site.
 However, I need to set up another app in a subdomain.  example.com/docserver
 instead of docserver.example.com.
 I have tried just adding  I have something like:

ProxyPass /docserver/ http://example.com:3001/
ProxyPassReverse /docserver/ http://example.com:3001
ProxyPreserveHost on

 The problem seems to be two fold.  First, the css, image and javascript
 links, are all broken.  Second all the generated links are to
 /controller/action instead of to docserver/controller/action.

 I tried putting RAILS_RELATIVE_URL_ROOT=/docserver/ in enviornment.rb, but
 that didn't help.

I haven't done it, but seems my memory is there is a --prefix option to 
mongrel that you need to set as well...

Check the mongrel site to see if there any docs on this...
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Uploading Large (100mb+) files

2006-11-28 Thread Philip Hallstrom
I don't know anything about the mongrel_upload_plugin... sorry...

We do our uploads through standard rails...  see their wiki or info...

On Tue, 28 Nov 2006, Rogelio Samour wrote:

 Philip: at this point I want to upload something... anything. I'm following
 the example on the mongrel_upload_plugin and though it says finished I don't
 see the file anywhere. I Turned on --debug and I can only see that it's at
 least getting the headers (content-type, etc) on the uploaded file... but
 nothing on the whereabouts.

 Like I mentioned before, I'm very green when it comes to mongrel... however
 I'm decently versed in sysadmin *nix stuff... apache and friends. I'm just
 needing a nudge in the right direction. :-)

 cheers,

 -rjs-

 On 11/28/06, Philip Hallstrom [EMAIL PROTECTED] wrote:
 
  I have an Apache 2.2.3 (mod_proxy_balancer) frontend server that does
  not have mongrel installed. It does proxy requests to several other
  mongrel-only servers (each running 2 mongrel processes). Each mongrel
  node has the same rails code-base and it's working perfectly.
 
  However, my question is when I add an upload file form... where is it
  going to physically put that file? I mean since it's hitting either one
  node or the other, so how does mongrel deal with that? and how or where
  do I tell it to accept large files (100mb+) ?
 
 Others have given good advice on how to do it, but wanted to say you don't
 need to do anything to get it to accept 100mb files.  We do that quite a
 bit and while it takes awhile works just fine.  It does tie up a mongrel
 process, but we're okay with that.
 
 
  I have read on having an upload-only mongrel process, but again how will
  all the other mongrels know to post the file to it or to a specific
  folder somewhere? Direction on this would be greatly appreciated!
 
  Thanks for your help on this. I searched the forum and didn't find
  anything specifically dealing with this. I have also checked the mongrel
  docs and most of the setups talk about mongrel_upload_progress plugin
  and/or the mongrel_cluster setup...(I may have missed something :-/)
 
 
  cheers,
 
  -rjs-
 
  p.s. mongrel ROCKS!
 
  ___
  Mongrel-users mailing list
  Mongrel-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/mongrel-users
 
 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users
 

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Uploading Large (100mb+) files

2006-11-28 Thread Philip Hallstrom
 If you use something like mongrel_upload_progress, the single-threadedness
 of Rails is no problem because Mongrel will intercept the upload and not
 hand it off to Rails until it's complete. That's what I'm doing at the
 moment, and my app runs just fine on one Mongrel.

I haven't used this plugin, but just gave it a quick read through... one 
thing I didn't see mentioned... can I skip the upload progress stuff and 
just get the benefits of it not blocking mongrel/rails?



 If you're running large file uploads, I would recommend looking into it
 anyway, because your users will surely want some kind of update about how
 their upload is going.

 Matt

 On 11/29/06, Vishnu Gopal [EMAIL PROTECTED] wrote:
 
 If you're using Rails with Mongrel, file upload currently sucks. If you
 have two mongrels running (say) and two users upload two large files, your
 entire app will be hung just serving those requests. This is because Rails
 can't run safely multi-threaded, and it's not Mongrel's fault.
 
 An upload only Mongrel could (and should) be written in a framework other
 than Rails. Both Camping and Merb are good choices. In this instance you
 don't need many mongrels since even 1 can simultaneously serve many file
 uploads. So you'll ideally have 1 server where you have one or more 
 mongrels
 running your file upload app, and use that to accept uploads. This is what
 we do at SlideShare: we have a custom Camping app to accept file uploads.
 
 Your frontend webserver or load balancer would redirect all requests to
 /upload (say) to your uploader mongrel running at it's own port. And all
 other requests can be served some other way. We do this through lighttpd
 proxying.
 
 HTH
 Vish
 
 On 11/28/06, Rogelio J. Samour [EMAIL PROTECTED] wrote:
 
  I have an Apache 2.2.3 (mod_proxy_balancer) frontend server that does
  not have mongrel installed. It does proxy requests to several other
  mongrel-only servers (each running 2 mongrel processes). Each mongrel
  node has the same rails code-base and it's working perfectly.
 
  However, my question is when I add an upload file form... where is it
  going to physically put that file? I mean since it's hitting either one
  node or the other, so how does mongrel deal with that? and how or where
  do I tell it to accept large files (100mb+) ?
 
  I have read on having an upload-only mongrel process, but again how will
  all the other mongrels know to post the file to it or to a specific
  folder somewhere? Direction on this would be greatly appreciated!
 
  Thanks for your help on this. I searched the forum and didn't find
  anything specifically dealing with this. I have also checked the mongrel
  docs and most of the setups talk about mongrel_upload_progress plugin
  and/or the mongrel_cluster setup...(I may have missed something :-/)
 
 
  cheers,
 
  -rjs-
 
  p.s. mongrel ROCKS!
 
  ___
  Mongrel-users mailing list
  Mongrel-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/mongrel-users
 
 
 
 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users
 
 


 -- 
 Matt White
 ---
 Thermal Creative
 http://blog.thermalcreative.com

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Determining ideal number of Mongrels for an app?

2006-11-28 Thread Philip Hallstrom
 On Tue, Nov 28, 2006 at 11:03:06AM -0600, Philip Hallstrom wrote:
 What's a rule of thumb for guesstimating how many
 Mongrels to use in a cluster for an app? I have an app
 that gets about 5000 unique visitors per day. I
 figured I'd give it plenty of Mongrels -- twenty to be
 specific. After running out of memory and hitting the
 swap periodically, I scaled it back to five and it
 still seems to serve up visitors fine. So, is there
 some super-secret math fomula I can use to determine
 the ideal number of Mongrels I should start in a
 cluster for an app?

 http://mongrel.rubyforge.org/docs/how_many_mongrels.html

 Just for reference, we get about 500,000 pages a day and run 4 mongrel
 processes... we've got about 20 servers[1], but 4 gives us the best
 performance.

 I'm curious - do you have 4 * 20 Mongrels or just 4? How many
 requests/sec does Rails report in your logs?

We have 4 mongrels per server.

Just did a quick grep on one of the servers log files and for about 6000 
requests we are averaging 38 reqs/sec with a standard deviation of 113.

If I throw out about 2700 requests that I know are slow ( 5 req/s mostly 
cause we can't cache them) the average goes to 65 reqs/sec.

Like I said, we only need those for a little bit every year... during the 
world series of poker.  People really like there poker :)

http://www.alexaholic.com/cardplayer.com+penny-arcade.com+basecamphq.com

-philip


___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Uploading Large (100mb+) files

2006-11-28 Thread Philip Hallstrom
 I have an Apache 2.2.3 (mod_proxy_balancer) frontend server that does
 not have mongrel installed. It does proxy requests to several other
 mongrel-only servers (each running 2 mongrel processes). Each mongrel
 node has the same rails code-base and it's working perfectly.

 However, my question is when I add an upload file form... where is it
 going to physically put that file? I mean since it's hitting either one
 node or the other, so how does mongrel deal with that? and how or where
 do I tell it to accept large files (100mb+) ?

 Others have given good advice on how to do it, but wanted to say you don't
 need to do anything to get it to accept 100mb files.  We do that quite a
 bit and while it takes awhile works just fine.  It does tie up a mongrel
 process, but we're okay with that.

 Quick clarification to what Philip said:  The actual upload doesn't 
 block mongrel since it's done in a thread before rails gets the uploaded 
 body.  Now, once Rails gets it the cgi.rb multipart mime processing is 
 run on the resulting file which can eat your CPU for about 20 
 seconds/100mb of file (based on my observations).

You lost me a bit... are you saying the actual upload doesn't block 
mongrel with or without the plugin?  And when you say mongrel do you 
really mean rails within mongrel or just mongrel?

I'm thinking you mean that uploads don't block *mongrel* ever, but without 
the plugin uploads block rails within mongrel which affectively blocks any 
other rails requests.

Yes?
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Uploading Large (100mb+) files

2006-11-28 Thread Philip Hallstrom
 On Tue, 28 Nov 2006 14:20:00 -0600 (CST)
 Philip Hallstrom [EMAIL PROTECTED] wrote:

 If you use something like mongrel_upload_progress, the single-threadedness
 of Rails is no problem because Mongrel will intercept the upload and not
 hand it off to Rails until it's complete. That's what I'm doing at the
 moment, and my app runs just fine on one Mongrel.

 I haven't used this plugin, but just gave it a quick read through... one
 thing I didn't see mentioned... can I skip the upload progress stuff and
 just get the benefits of it not blocking mongrel/rails?

 Yep, actually that's an incredibly trivial thing to do.  You'd probably 
 be better off just starting with a small handler that moved the files 
 where you wanted after the upload, and then expand it to your needs.

Yeah, you're right.  I grabbed the Rick's svn repo and ran his example in 
about 10 minutes...

That's pretty slick :)  Slick enough I might keep that progress bar :)

-philip
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] OSX requires sudo for using ports 1024

2006-11-16 Thread Philip Hallstrom
 I assume some of you have run into this error before when trying to run
 mongrel on port 80 (or another port  1024) in OSX:

 $ mongrel_rails start -p 80
 ** Starting Mongrel listening at 0.0.0.0:80
 /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel/tcphack.rb:12:in
 `initialize_without_backlog': Permission denied - bind(2) (Errno::EACCES)
   from 
 /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel/tcphack.rb:12:in
 `initialize'
   from 
 /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel.rb:536:in
 `initialize'
   from 
 /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel/configurator.rb:128:in
 `listener'
   from 
 /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/bin/mongrel_rails:96:in
 `cloaker_'
   from 
 /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel/configurator.rb:51:in
 `initialize'
   from 
 /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/bin/mongrel_rails:83:in
 `run'
   from 
 /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel/command.rb:211:in
 `run'
   from /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14
 /bin/mongrel_rails:235
   from /usr/local/bin/mongrel_rails:18

 Mongrel runs without sudo on all other ports  1024 otherwise. Anyone have
 the reason that these ports require sudo?

This is the way it is on all unixes...  ports under 1024 tend to be well 
known.  25 for smtp, 80 for http.  So the OS won't let you use that port 
unless you are root so that joe-random-user can't start up some subversive 
web server on that port...

-philip
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] [ADV] Mongrel: Serving, Deploying, and Extending Your Ruby Applications BOOK

2006-10-24 Thread Philip Hallstrom
Zed -

If I purchase the PDF version, are updates going to be available similar 
to the PP books?  I admit I'm not familiar OReilly's setup so if it's 
blatantly obvious on their site just let me know.

Thanks -philip

On Tue, 24 Oct 2006, Zed A. Shaw wrote:

 Time for some all time pimpage folks.

 Me and Matt Pelletier wrote a small PDF book on Mongrel entitled: Mongrel: 
 Serving, Deploying, and Extending Your Ruby Applications since we really 
 wanted you to know what it was about.  It's published by Addison Wesley 
 Professional, has just over 100 pages of goodness, and is available for 
 $14.99 at:

 http://safari.oreilly.com/0321483502

 The book covers all the major topics related to Mongrel, but does it in a 
 quick fast way so you can get the idea, get a working setup going, and then 
 do more research for advanced stuff.

 We also tried to make it funny as hell.  I'm sure many people will love it, 
 and a few will hate it for this reason. :-)

 A main thing this book covers is how to write your own Mongrel handlers, but 
 it also goes over security, deployment, how Mongrel works, and many other 
 topics.

 Let me know what you think of the book if you buy it.

 Thanks for your time!

 -- 
 Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
 http://www.zedshaw.com/
 http://safari.oreilly.com/0321483502 -- The Mongrel Book
 http://mongrel.rubyforge.org/
 http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.
 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Apache Re-Write and Directories

2006-10-03 Thread Philip Hallstrom
 Nicely done -- I'll add this to apache page!

Thanks :)  I don't think I thought of it though, but don't remember where 
i saw it..  in case it helps anyone else, here's my full apache config 
that lets rails/php play nice together

Of course, if you see any problems with this, be sure to let me know so I 
can fix it :)

VirtualHost *:80

   ServerName myserver.com
   DocumentRoot /path/to/my/app/public

   Directory /path/to/my/app/public
 Options FollowSymLinks
 AllowOverride None
 Order allow,deny
 Allow from all
   /Directory

   Proxy balancer://mongrel_cluster
 BalancerMember http://127.0.0.1:8805
   /Proxy

   RewriteEngine On

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d
   RewriteRule ^(.+[^/])$ $1/ [R]

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} \.php
   RewriteRule ^(.*)$ $1 [QSA,L]

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}/index.html -f
   RewriteRule ^(.*)$ $1/index.html [QSA,L]

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}/index.php -f
   RewriteRule ^(.*)$ $1/index.php [QSA,L]

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d
   RewriteRule ^(.*)[^/]$ $1/ [QSA,L]

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
   RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]

   AddOutputFilterByType DEFLATE text/html
   AddOutputFilterByType DEFLATE application/x-javascript
   AddOutputFilterByType DEFLATE text/css
   AddOutputFilterByType DEFLATE text/plain
   AddOutputFilterByType DEFLATE text/xml
   AddOutputFilterByType DEFLATE application/xml
   AddOutputFilterByType DEFLATE application/xhtml+xml

   BrowserMatch ^Mozilla/4 gzip-only-text/html
   BrowserMatch ^Mozilla/4.0[678] no-gzip
   BrowserMatch bMSIE !no-gzip !gzip-only-text/html

   php_value include_path /path/to/my/app/php:/usr/local/lib/php:.
   php_value auto_prepend_file /path/to/my/app/php/auto_prepend.php

   # this not only blocks access to .svn directories, but makes it appear
   # as though they aren't even there, not just that they are forbidden
   DirectoryMatch ^/.*/\.svn/
 ErrorDocument 403 /404.html
 Order allow,deny
 Deny from all
 Satisfy All
   /DirectoryMatch

/VirtualHost



 # if the directory exists, add trailing slash
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R]



 On 10/3/06, Philip Hallstrom [EMAIL PROTECTED] wrote:
 I am using the 'default' Apache 2.2 mod_rewrite rules suggested from the Web
 site and they are working.

 One thing related to static (non cluster directed) resources:

 If I have a directory in public called 'static', if I request it as follows:

 http://www.domain.com/static/  - then it works

 If I request it as:

 http://www.domain.com/static - then it does not work as it gets directed to
 the cluster.

 How can I change my rewrite rules to have both of the above URLs be served
 by the static resource via Apache, not by Mongrel?

 Add this to the beginning...

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R]




 Rewrite rules:

  RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
  RewriteCond %{SCRIPT_FILENAME} !maintenance.html
  RewriteRule ^.*$ /maintenance.html [L]
  # Rewrite index to check for static index.html
  RewriteRule ^/$ /index.html [QSA]
  # Rewrite to check for Rails cached pages with .html extentions
  RewriteRule ^([^.]+)$ $1.html [QSA]
  # All dynamic requests get sent to the cluster
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://cluster%{REQUEST_URI} [P,QSA,L]

 Thanks!!!

 Hunter


 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users



 -- 
 Charles Brian Quinn
 self-promotion: www.seebq.com
 highgroove studios: www.highgroove.com
 slingshot hosting: www.slingshothosting.com
 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] How do you use Mongrel?

2006-09-21 Thread Philip Hallstrom
 I'm working on the Mongrel book with Zed, and wanted to get some
 feedback from the core users (this list) about how they use Mongrel.
 That sounds a bit vague, but I'm interested in hearing things about
 frustrating problems / workaround, preferred configurations, if you
 have a particular way you set up / store your config files when
 developing / deploying an app, for those of you running multiple
 handlers, if you have had to deal with any subtle issues, if there
 were any gotchas you encountered along the way from the docs that
 could be fixed (in the docs) or improved, any tricks you figured out
 along the way, etc. Any info will be credited properly.

The only issue we've had is related to memcache connections not closing 
when you do a cluster:restart. See:

http://rubyforge.org/tracker/index.php?func=detailaid=5268group_id=1306atid=5145

Zed said this is a rails problem and I believe him.  I imagine if I spent 
some time looking at it some more I'd figure out how to close the memcache 
connections within rails, but at the time we simply made the decision to 
hard restart mongrel (and apache) when necessary.

Reason I mention this is the docs I was able to find about setting up 
memcache for use as fragment/session caching don't mention this as an 
issue, and it bit us...

Actually I guess there is one other issue we've noticed... on a heavily 
hit server, restarting just mongrel, apache seems to take a little while 
to find it again.  So we restart apache after restarting mongrel.

Super minor issues all things considered :-)  We were restarting 
lighttpd/fastcgi via cron, hourly...

-philip
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Ruby+Apache2.2+ProxyLoadBalance ...... +PHP??

2006-08-30 Thread Philip Hallstrom
 Hi,
 I just realice that I can't run php code anymore once I installed my dear
 mongrels (under an Apache Proxy Balancer).

 I'm just trying to run the clasic phpinfo() in the following file
 /var/rubyapp/public/phpinfo.php ... but instead of being executed the code
 is being displayed as plain text ... This is the ouput :))

   ?PHP phpinfo(); ?

 anyone can give a hint please on how to have Ruby and PHP code under
 Apache  Proxy  Balancer?

My httpd.conf looks like this (excluding the parts that bring in standard 
PHP stuff).  Works fine for us.  The only thing that doesn't work are URLs 
like: http://foo/path/to/phpscript.php/path/info/here.

   Proxy balancer://mongrel_cluster
 BalancerMember http://127.0.0.1:8805
   /Proxy

   RewriteEngine On

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d
   RewriteRule ^(.+[^/])$ $1/ [R]

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} \.php
   RewriteRule ^(.*)$ $1 [QSA,L]

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}/index.html -f
   RewriteRule ^(.*)$ $1/index.html [QSA,L]

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}/index.php -f
   RewriteRule ^(.*)$ $1/index.php [QSA,L]

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d
   RewriteRule ^(.*)[^/]$ $1/ [QSA,L]

   RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
   RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Mongrel browse problem

2006-08-29 Thread Philip Hallstrom

I wanted to show a Rails site to someone so I set up Mongrel and it ran fine,

This is my mongrel_cluster.yml,

port: ?80
environment: production
pid_file: log/mongrel.pid
servers: 4

Now, after going back to Apache/Tomcat I can't get the Mongrel site up and 
running again...?


Any suggestions?

(When I run Mongrel, I stop Apache first)


How long do you wait after stopping apache before staring mongrel?  I know 
some OS's won't let you connect/bind to the same port if it's just been 
released... and some OS's have an option to override that behavior... 
what happens if you change your port to 81 or something other than 80?___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Re: [Mongrel] Mongrel browse problem

2006-08-29 Thread Philip Hallstrom
I wanted to show a Rails site to someone so I set up Mongrel and it ran 
fine,


This is my mongrel_cluster.yml,

port: ?80
environment: production
pid_file: log/mongrel.pid
servers: 4

Now, after going back to Apache/Tomcat I can't get the Mongrel site up and 
running again...?


Any suggestions?

(When I run Mongrel, I stop Apache first)


How long do you wait after stopping apache before staring mongrel?  I know 
some OS's won't let you connect/bind to the same port if it's just been 
released... and some OS's have an option to override that behavior... what 
happens if you change your port to 81 or something other than 80?


I was trying to connect on the wrong port...my bad.  It should be 
www.mysite.com:3000


Do you know how I can make it so a user can browse 
http://www.mysite.com/railsemo w/o the 3000?


I know I can just start mongrel on port 80 and not use Apache, but I need my 
Tomcat/Apache sites up also.


I don't personally, but Zed always mentions the latest pre-release and the 
--prefix option and something else... search the lists... I'm sure you'll 
find it...


-philip___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Re: [Mongrel] SVN security hole explained

2006-08-25 Thread Philip Hallstrom
 I don't see why this is a huge security issue either.  At the worst
 someone can view your commit history by viewing the .svn/entries file.
 The password auth files are stored in the repository itself, not in
 the .svn directories in the working copy.

Maybe not huge, but that file gives you logins.  Which then helps attack 
in other ways... and it also let's them know you're running subversion and 
how... so gives them a host to attack perhaps...

2 more cents...


 Shane Vitarana
 shanesbrian.net

 On 8/25/06, carmen [EMAIL PROTECTED] wrote:
 This is a Subversion working copy administrative directory.
 Visit http://subversion.tigris.org/ for more information.

 is there actualy anything important in there? i mean if you authenticate 
 with SSH keys, and even if you dont, i dont think it caches passwords? and 
 it surely doesnt cache the entire history ora nything (like a .git dir) so 
 they wont be able to see all the embarassing oneline 'oops, working now' 
 commits..


 -daya

 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Optimal Configuration

2006-08-23 Thread Philip Hallstrom
 First off, ive just switched to using mongrel_cluster and pound - its
 working a treat! Its far far faster than fast-cgi: operations that took a
 few seconds on fcgi now are almost instant with mongrel. Excellent!

 However, I've been trying to decide how best to utilise my equipment most
 effectively. I have a dual pro 3Ghz Xenon with 2GB RAM, and the server will
 be running a few different applications - some rails, some php. Seeing as I
 was using lighty before I switched im keeping my PHP on lighty and proxying
 through pound but my rails apps are now on mongrel, but how many instances
 would deliver the best performance on what im running? I wasn't sure if
 mongrel got busy would it hog a lot of ram or something like that.

 What would people suggest from there own experiences?

http://rubyforge.org/pipermail/mongrel-users/2006-May/000200.html
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Multiple mongrels for one app

2006-08-22 Thread Philip Hallstrom
 This is my first post, so I'm not sure if it's been asked before, but
 I can't find an answer anywhere.

 If I have one rails application running, one processor I'm running it
 on, and mongrel is multi-threaded, why should I have more than one
 mongrel running?

 Everyone seems to agree on 3-5 mongrels per rails app, but why?

Performance... somewhere Zed has an article on how to benchmark things.. 
something along the lines of benchmark a blank static html page.  That's 
as fast as your server will go.  Then create a simple action that renders 
Hello as text say, with one mongrel.  Benchmark that.  Keep increasing 
the number of mongrels until you don't get any more performance 
improvements.

For us, it was 4.

-philip
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Multiple mongrels for one app

2006-08-22 Thread Philip Hallstrom

 http://rubyforge.org/pipermail/mongrel-users/2006-August/000930.html

 //jarkko

 So what happens when the mongrel gets more than one request at a time?
 When I run httpref against it, the mongrel process can serve up large
 number of rails pages before it gets bogged down.
 And when it does break, it says mongrel timed out this thread: too
 many open files.  So it must be doing some threading, even if rails
 isn't threadsafe.
 If it was 1 request per mongrel process, 1 process shouldn't be able
 to serve up very many per second.  httpref tells me its prettty fast
 though.

Search the lists... I don't remember the exact details but basically 
mongrel is threaded... right up till it hands the request off to rails, 
then it locks, does the rails request, gets the response, and goes back 
into threaded mode.

So technically you can't process more than 1 rails request at a time, but 
since many requests are way under a second you get the appearance that you 
can.

Or something like that :)
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] Telling Apache Not to Send a Sub-Directory to the Cluster

2006-08-10 Thread Philip Hallstrom
 Thanks, that's what I'm going for but just like you, not good enough to get
 there.

 Been messing with the docs for the past hour and no luck yet. I was hoping a
 guru could lend a hand.

Turn up the log level for rewrite and watch it... that helps a lot when 
futzing with those things...



 From: Philip Hallstrom [EMAIL PROTECTED]
 Reply-To: mongrel-users@rubyforge.org
 Date: Thu, 10 Aug 2006 12:56:28 -0500 (CDT)
 To: Mongrel mongrel-users@rubyforge.org
 Subject: Re: [Mongrel] Telling Apache Not to Send a Sub-Directory to the
 Cluster

 Howdy,

 I am using Apache 2.2 and Mongrel with great success.

 I have a mod_rewrite question and I am NO expert. I think it's really simple
 but I haven't nailed it. I was hoping someone here could help.

 I'm using Apache conf right out of the cluster example from the Mongrel
 site.

 I have a directory under my apps 'public' directory called 'sendto'. Files
 in that directory are accessible but I want to be able to provide a
 directory listing for when no specific file is requested.

 Right now, it seems that the requests to http://domain.com/sendto/ are being
 sent to the cluster.

 I am looking for a rewrite statement that basically tells Apache not to send
 that specific URL pattern to the cluster.

 Add a rewrite condition to the rule that sends things to the cluster
 saying that if the url matches this, that's false so bail...

 I'm not good enough to write out the rule on the fly, but the docs should
 get you there


 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] [WARNING] don't use ruby-sendfile

2006-08-03 Thread Philip Hallstrom
 Just curious, if you are really need the performance for static
 files, why not use an asset_host ?  i haven't personally used it, nor
 do I fully know what it does, but on a cursory, half-hazard glance, it
 appears you can serve up content from another web server (lightty,
 apache, etc.) here for all your other stuff:

 http://asset.yourapp.com/images/zed_rules.gif

 just tossin' it out there

Because sometimes you work with people who aren't good about using the 
various _tag method that make this work...  heh.

but yeah, it would help.


 On 8/3/06, Thomas Lockney [EMAIL PROTECTED] wrote:
 On 8/3/06, Sunder [EMAIL PROTECTED] wrote:
 Okay. So send file is bad and has been removed. Correct me if Iam wrong ,
 but if you have apache installed and proxying through it, you dont really
 need sendfile . is that assumption correct?

 It depends on how you set up the proxy. In general, no, everything
 will go through mongrel, you would have to either explicitly map only
 certain paths to mongrel (for anything that's not static) or
 explicitly exclude things that are static (can't recall how or even if
 this is possible with mod_proxy using filetypes, but you can always
 use mod_rewrite to do more complicated stuff).

 Thomas
 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users



 -- 
 Charles Brian Quinn
 self-promotion: www.seebq.com
 highgroove studios: www.highgroove.com
 slingshot hosting: www.slingshothosting.com
 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users