Hi -- (First time posting to the list...) I''m trying out Rails on my Mac (OS X Panther, 1.6 G5). It seems... kinda slow? I''ve even run it with FastCGI and the response time is still painfully slow. Is this just me? Is mod_ruby any better than FastCGI? Or is it rails? Thanks in advance! -- joshua
On Fri, 2005-03-04 at 14:41 -0600, Joshua Wehner wrote:> Hi -- > > (First time posting to the list...) > > I''m trying out Rails on my Mac (OS X Panther, 1.6 G5). It seems... > kinda slow? I''ve even run it with FastCGI and the response time is > still painfully slow. > > Is this just me? Is mod_ruby any better than FastCGI? Or is it rails?What are you considering slow? Have you looked at the logs to see what is taking up time? Are you sure you ended up using fast-cgi? -- Steven Critchfield <critch-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org>
If I had to wager a guess, I would guess that you have the wrong fastcgi installed. Here is a quote from http://wiki.rubyonrails.com/rails/show/FastCGI (bottom) : "Make sure you are running the C-based fcgi driver. Especially after you update Ruby you usually have to recompile all C-based extensions. However fcgi ships with a totally broken Ruby-based version which silently takes over. If you have odd problems on your FastCGI page, like pages which only load half and finish 15 seconds later, just reinstall fcgi with gem install fcgi" On Fri, 4 Mar 2005 14:41:58 -0600, Joshua Wehner <joshua-AnsgPkSrJBbs2Lz0fTdYFQ@public.gmane.org> wrote:> Hi -- > > (First time posting to the list...) > > I''m trying out Rails on my Mac (OS X Panther, 1.6 G5). It seems... > kinda slow? I''ve even run it with FastCGI and the response time is > still painfully slow. > > Is this just me? Is mod_ruby any better than FastCGI? Or is it rails? > > Thanks in advance! > > -- joshua > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On Mar 4, 2005, at 2:50 PM, Belorion wrote:> If I had to wager a guess, I would guess that you have the wrong > fastcgi installed. Here is a quote from > http://wiki.rubyonrails.com/rails/show/FastCGI (bottom) : > > "Make sure you are running the C-based fcgi driver. Especially after > you update Ruby you usually have to recompile all C-based extensions. > However fcgi ships with a totally broken Ruby-based version which > silently takes over. If you have odd problems on your FastCGI page, > like pages which only load half and finish 15 seconds later, just > reinstall fcgi with > > gem install fcgi"Ah. I was working from these instructions: http://wiki.rubyonrails.com/rails/show/FastCGI%20on%20OS%20X I ran ''gem install fcgi'' again, just to be sure. After, I noticed that these lines in the above doc didn''t match my .htaccess file:> Edit the .htaccess file in your_rails_app/public. Change the row > > RewriteBase /dispatch.cgi > > to > > RewriteBase /dispatch.fcgiI have *no* RewriteBase line in .htaccess. I do have:> RewriteRule ^(.*)$ /dispatch.cgi?$1 [QSA,L]Changing that to> RewriteRule ^(.*)$ /dispatch.fcgi?$1 [QSA,L]Did the trick. Much faster now. Thanks! -- Joshua
On Fri, 4 Mar 2005 14:50:17 -0600, Belorion <belorion-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> gem install fcgi"What am I doing wrong? # gem install fcgi Attempting local installation of ''fcgi'' Local gem file not found: fcgi*.gem Attempting remote installation of ''fcgi'' Updating Gem source index for: http://gems.rubyforge.org Building native extensions. This could take a while... ERROR: While executing gem ... (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5 for inspection. ruby extconf.rb install fcgi\nchecking for fcgiapp.h... no Results logged to /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/gem_make.out The file it mentions says only this: ruby extconf.rb install fcgi checking for fcgiapp.h... no I''m attempting to set up RoR with lighttpd, I have lighttpd configured properly, but the error message I get indicates that I''m missing the fcgi module. What gives? -- One Guy With A Camera http://rbpark.ath.cx
you need to install fastcgi first On Fri, 4 Mar 2005 14:35:15 -0700, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Fri, 4 Mar 2005 14:50:17 -0600, Belorion <belorion-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > gem install fcgi" > > What am I doing wrong? > > # gem install fcgi > Attempting local installation of ''fcgi'' > Local gem file not found: fcgi*.gem > Attempting remote installation of ''fcgi'' > Updating Gem source index for: http://gems.rubyforge.org > Building native extensions. This could take a while... > ERROR: While executing gem ... (RuntimeError) > ERROR: Failed to build gem native extension. > Gem files will remain installed in > /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5 for inspection. > ruby extconf.rb install fcgi\nchecking for fcgiapp.h... no > > Results logged to /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/gem_make.out > > The file it mentions says only this: > > ruby extconf.rb install fcgi > checking for fcgiapp.h... no > > I''m attempting to set up RoR with lighttpd, I have lighttpd configured > properly, but the error message I get indicates that I''m missing the > fcgi module. > > What gives? > > -- > One Guy With A Camera > http://rbpark.ath.cx > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Tobi http://www.snowdevil.ca - Snowboards that don''t suck http://www.hieraki.org - Open source book authoring http://blog.leetsoft.com - Technical weblog
Specifically, you need to install the FastCGI developer kit. On Fri, 4 Mar 2005 16:53:37 -0500, Tobias Luetke <tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> you need to install fastcgi first > > > On Fri, 4 Mar 2005 14:35:15 -0700, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On Fri, 4 Mar 2005 14:50:17 -0600, Belorion <belorion-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > gem install fcgi" > > > > What am I doing wrong? > > > > # gem install fcgi > > Attempting local installation of ''fcgi'' > > Local gem file not found: fcgi*.gem > > Attempting remote installation of ''fcgi'' > > Updating Gem source index for: http://gems.rubyforge.org > > Building native extensions. This could take a while... > > ERROR: While executing gem ... (RuntimeError) > > ERROR: Failed to build gem native extension. > > Gem files will remain installed in > > /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5 for inspection. > > ruby extconf.rb install fcgi\nchecking for fcgiapp.h... no > > > > Results logged to /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/gem_make.out > > > > The file it mentions says only this: > > > > ruby extconf.rb install fcgi > > checking for fcgiapp.h... no > > > > I''m attempting to set up RoR with lighttpd, I have lighttpd configured > > properly, but the error message I get indicates that I''m missing the > > fcgi module. > > > > What gives? > > > > -- > > One Guy With A Camera > > http://rbpark.ath.cx > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > -- > Tobi > http://www.snowdevil.ca - Snowboards that don''t suck > http://www.hieraki.org - Open source book authoring > http://blog.leetsoft.com - Technical weblog > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On Fri, 4 Mar 2005 14:58:46 -0700, Ben Schumacher <benschumacher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Specifically, you need to install the FastCGI developer kit.Thanks to everybody who responded, I''ll try that. It''s kind of overwhelming for me, not only am I learning a new programming language, and a new web framework, I''m also learning databases and lighttpd all for the first time, it''s a bit much. I''m trying to go in baby steps for now -- I''ve got a good handle on the database side, and I''m learning lots about rails, WEBrick makes it easy. I''m putting off learning about lighttpd until I''ve got a good handle on the rails side. -- One Guy With A Camera http://rbpark.ath.cx
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1> Specifically, you need to install the FastCGI developer kit. > >>> /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5 for inspection. >>> ruby extconf.rb install fcgi\nchecking for fcgiapp.h... no >>> >>>And you''ll likely need to point the gem to the developer kit gem install fcgi -- --with-fcgi-include=/usr/local/include - --with-fcgi-lib=/usr/local/lib - - J -----BEGIN PGP SIGNATURE----- Version: PGP 8.1 iQA/AwUBQimKR1UyB+ajXkCLEQKaMwCeMtUvn8G5ANSGIJsS5pHQreahBxkAoOsL 2xONzA39g7pyBdJ37cemrBng =Qaqv -----END PGP SIGNATURE-----
* Jason Hoffman <jason-xKtDo/uLHBtl57MIdRCFDg@public.gmane.org> [0331 10:31]:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > > Specifically, you need to install the FastCGI developer kit. > > > >>> /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5 for inspection. > >>> ruby extconf.rb install fcgi\nchecking for fcgiapp.h... no > >>> > >>> > > And you''ll likely need to point the gem to the developer kit > > gem install fcgi -- --with-fcgi-include=/usr/local/include > - --with-fcgi-lib=/usr/local/libThank you! I''ve been trying to figure out how to get extconf.rb arguments into gem for ages.. one nitpick - you can replace this with: gem install fcgi -- --with-fcgi-dir=/usr/local -- ''Everybody I know who is right always agrees with ME.'' -- Rev Lady Mal Rasputin :: Jack of All Trades - Master of Nuns
Dick Davies schrieb:> Thank you! I''ve been trying to figure out how to get extconf.rb arguments > into gem for ages.. > > one nitpick - you can replace this with: > > gem install fcgi -- --with-fcgi-dir=/usr/localMy setup isn''t slow (DebianOnColinux, lighttpd, fcgi), but just out of curiosity I did that and now I get: /usr/lib/ruby/1.8/fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' for FCGI:Class (NoMethodError) from /home/simplepages/rails/public/dispatch.fcgi:9 What could that be? When I gem uninstall fcgi everything works again. Sascha
Well thats why webrick is bundeled...> It''s kind of overwhelming for me, not only am I learning a new > programming language, and a new web framework, I''m also learning > databases and lighttpd all for the first time, it''s a bit much.-- Tobi http://www.snowdevil.ca - Snowboards that don''t suck http://www.hieraki.org - Open source book authoring http://blog.leetsoft.com - Technical weblog
* Sascha Ebach <se-eFwX6J65rk9VioaHkBSlcw02NpfuEekPhC4ANOJQIlc@public.gmane.org> [0309 13:09]:> Dick Davies schrieb: > >Thank you! I''ve been trying to figure out how to get extconf.rb arguments > >into gem for ages.. > > > >one nitpick - you can replace this with: > > > > gem install fcgi -- --with-fcgi-dir=/usr/local > > My setup isn''t slow (DebianOnColinux, lighttpd, fcgi), but just out of > curiosity I did that and now I get: > > /usr/lib/ruby/1.8/fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' > for FCGI:Class (NoMethodError) > from /home/simplepages/rails/public/dispatch.fcgi:9 > > What could that be? When I gem uninstall fcgi everything works again.Wierd, worked for me (freebsd). at a guess , is_cgi? is defined in the .so and that didn''t get built properly by the gem command (fcgi.rb has a few methods written in ruby, it requires a native library with the same name which contains native code). Try the longer option - if that helps I''d like ice cream with my humble pie please :) -- ''In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move.'' -- The Guide Rasputin :: Jack of All Trades - Master of Nuns
Dick Davies schrieb:> * Sascha Ebach <se-eFwX6J65rk9VioaHkBSlcw02NpfuEekPhC4ANOJQIlc@public.gmane.org> [0309 13:09]: > >>Dick Davies schrieb: >> >>>Thank you! I''ve been trying to figure out how to get extconf.rb arguments >>>into gem for ages.. >>> >>>one nitpick - you can replace this with: >>> >>>gem install fcgi -- --with-fcgi-dir=/usr/local >> >>My setup isn''t slow (DebianOnColinux, lighttpd, fcgi), but just out of >>curiosity I did that and now I get: >> >>/usr/lib/ruby/1.8/fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' >>for FCGI:Class (NoMethodError) >> from /home/simplepages/rails/public/dispatch.fcgi:9 >> >>What could that be? When I gem uninstall fcgi everything works again. > > > Wierd, worked for me (freebsd). > > at a guess , is_cgi? is defined in the .so and that didn''t get built properly > by the gem command (fcgi.rb has a few methods written in ruby, it requires a > native library with the same name which contains native code). > > Try the longer option - if that helps I''d like ice cream with my humble > pie please :)I get this output when compiling. I there anything wrong with it? $ gem install fcgi -- --with-fcgi-dir=/usr Config file /root/.gemrc does not exist Attempting local installation of ''fcgi'' Local gem file not found: fcgi*.gem Attempting remote installation of ''fcgi'' Updating Gem source index for: http://gems.rubyforge.org Building native extensions. This could take a while... Makefile:105: warning: overriding commands for target `/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/.'' Makefile:103: warning: ignoring old commands for target `/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/.'' fcgi.c: In function `fcgi_s_accept'': fcgi.c:74: warning: statement with no effect Makefile:105: warning: overriding commands for target `/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/.'' Makefile:103: warning: ignoring old commands for target `/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/.'' ruby extconf.rb install fcgi -- --with-fcgi-dir=/usr checking for fcgiapp.h... yes checking for FCGX_Accept() in -lfcgi... yes creating Makefile make gcc -fPIC -Wall -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -I. -DHAVE_FCGIAPP_H -I/usr/include -c fcgi.c gcc -shared -L"/usr/lib" -L"/usr/lib" -o fcgi.so fcgi.o -lruby1.8 -lfcgi -lpthread -ldl -lcrypt -lm -lc make install install -c -p -m 0644 ./lib/fcgi.rb /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/. Successfully installed fcgi, version 0.8.5 Installing RDoc documentation for fcgi-0.8.5... No definition for fcgi_s_accept No definition for fcgi_s_each No definition for fcgi_s_each No definition for fcgi_s_iscgi No definition for fcgi_in No definition for fcgi_out No definition for fcgi_err No definition for fcgi_env No definition for fcgi_finish No definition for fcgi_stream_putc No definition for fcgi_stream_write No definition for fcgi_stream_print No definition for fcgi_stream_printf No definition for fcgi_stream_puts No definition for fcgi_stream_addstr No definition for fcgi_stream_flush No definition for fcgi_stream_getc No definition for fcgi_stream_ungetc No definition for fcgi_stream_gets No definition for fcgi_stream_read No definition for fcgi_stream_eof No definition for fcgi_stream_eof No definition for fcgi_stream_close No definition for fcgi_stream_closed No definition for fcgi_stream_binmode No definition for fcgi_stream_isatty No definition for fcgi_stream_isatty No definition for fcgi_stream_sync No definition for fcgi_stream_setsync Sascha
On Sun, 06 Mar 2005 15:23:46 +0100, Sascha Ebach <se-eFwX6J65rk9VioaHkBSlcw02NpfuEekPhC4ANOJQIlc@public.gmane.org> wrote:> I get this output when compiling. I there anything wrong with it?I get the same. I expect it is because we only installed the main fastcgi package, and not the "developer kit" that other people mentioned. The problem is, what is the developer kit? It was hard enough to find the fastcgi tarball on their poorly organized website, I don''t see any reference to a developer kit. -- One Guy With A Camera http://rbpark.ath.cx
On Mar 7, 2005, at 12:15 PM, Rob Park wrote:> On Sun, 06 Mar 2005 15:23:46 +0100, Sascha Ebach > <se-eFwX6J65rk9VioaHkBSlcw02NpfuEekPhC4ANOJQIlc@public.gmane.org> wrote: >> I get this output when compiling. I there anything wrong with it? > > I get the same. I expect it is because we only installed the main > fastcgi package, and not the "developer kit" that other people > mentioned. The problem is, what is the developer kit? It was hard > enough to find the fastcgi tarball on their poorly organized website, > I don''t see any reference to a developer kit.Have a look at <http://www.fastcgi.com/#TheDevKit>. Granted, it''s "below the fold" but I wouldn''t say it was hard to find. Regards, Mark Rowe <http://bdash.net.nz/>
On Sun, 6 Mar 2005 16:15:23 -0700, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sun, 06 Mar 2005 15:23:46 +0100, Sascha Ebach > <se-eFwX6J65rk9VioaHkBSlcw02NpfuEekPhC4ANOJQIlc@public.gmane.org> wrote: > > I get this output when compiling. I there anything wrong with it? > > I get the same. I expect it is because we only installed the main > fastcgi package, and not the "developer kit" that other people > mentioned. The problem is, what is the developer kit? It was hard > enough to find the fastcgi tarball on their poorly organized website, > I don''t see any reference to a developer kit.Oh, my mistake. The development kit IS what I downloaded, I just didn''t realize since I found a link to it from the FAQ, didn''t scroll down enough on the front page to see "Development Kit". Ok, so I''ve got the development kit compiled and installed... and I''m getting the above mentioned error. Reading the error more closely, it says "successfully installed", all that "no definition" stuff seems to be a problem with rdoc. Hopefully that doesn''t matter, I''m gonna go have a look and see if it''s actually installed and working or not. -- One Guy With A Camera http://rbpark.ath.cx
On Sun, 6 Mar 2005 16:28:43 -0700, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Reading the error more closely, it says "successfully installed", all > that "no definition" stuff seems to be a problem with rdoc. Hopefully > that doesn''t matter, I''m gonna go have a look and see if it''s actually > installed and working or not.No such luck for me. I''m following the instructions listed at http://bougyman.com/miscfiles/RailsonDebian.html for configuring lighttpd, and all that happens is that when I rught lighttpd, it prints these errors: /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' for FCGI:Class (NoMethodError) from /home/www/cedscreening/public/dispatch.fcgi:9 /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' for FCGI:Class (NoMethodError) from /home/www/cedscreening/public/dispatch.fcgi:9 /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' for FCGI:Class (NoMethodError) from /home/www/cedscreening/public/dispatch.fcgi:9 /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' for FCGI:Class (NoMethodError) from /home/www/cedscreening/public/dispatch.fcgi:9 And trying to access the site just loads until it times out, nothing happens. Not sure what that error means, I glanced over that file and is_cgi? is most definitely a defined method, right near the beginning of the file. -- One Guy With A Camera http://rbpark.ath.cx
On Sun, 6 Mar 2005 16:55:29 -0700, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> And trying to access the site just loads until it times out, nothing > happens. Not sure what that error means, I glanced over that file and > is_cgi? is most definitely a defined method, right near the beginning > of the file.Ok, I''ve played around with this a little more, and the only progress that I can report is that I''ve got rails working successfully in CGI, but not FastCGI. To get rails working in regular CGi in lighttpd, I had to have it load "mod_cgi", and I had to add this line to the config: server.error-handler-404 = "/dispatch.cgi" I was having problems using mod_rewrite to accomplish this, not sure what the problem was, but lighttpd seemed to throw itself into some kind of infinite loop (all I know is that lighttpd would display a directory listing correctly if I commented out the rewrite rules, and then it would basically suck up ALL my CPU indefinitely when I uncommented it). Having rails as the 404 handler is nice because it means I can put files into public/ and lighttpd will actually serve them instead of displaying a rails error (nothing quite like being told that rails can''t find the Image.jpgController). Ok, so at this point rails is working in lighttpd through regular CGI. This is progress (it shows that lighttpd is at least installed and working properly). In normal CGI, lighttpd was taking 2-3 seconds per page request. Not terrible, but this is on my big, beefy desktop system. The server that it''s going to "go live" on has much less CPU and RAM, so I''m assuming it''d only get slower. Not acceptable for a production system. To install FastCGI, I did this: 1. I downloaded, compiled, and installed http://fastcgi.com/dist/fcgi-2.4.0.tar.gz It installed successfully and with no errors. 2. I tried commands like "gem install fcgi", "gem install fcgi -- --with-fcgi-dir=/usr/local" and a couple other variations, and they all had exactly the same result, the message that fcgi was installed successfully, followed by a bunch of rdoc errors (somebody else posted the error, I won''t repeat it because it''s kinda long). 3. I changed dispatch.fcgi to have this: require ''rubygems'' require_gem ''fcgi'' As per the instructions at http://wiki.rubyonrails.com/rails/show/FastCGI+on+unix+linux+bsd 4. Modified my lighttpd config to load mod_fastcgi, and added in this config: fastcgi.server = ( ".fcgi" => ( "localhost" => ( "socket" => "/tmp/rails.socket", "bin-path" => "/path/to/public/dispatch.fcgi" ) ), ".fcgi" => ( "localhost" => ( "socket" => "/tmp/rails1.socket", "bin-path" => "/path/to/public/dispatch.fcgi" ) ), ".fcgi" => ( "localhost" => ( "socket" => "/tmp/rails2.socket", "bin-path" => "/path/to/public/dispatch.fcgi" ) ), ".fcgi" => ( "localhost" => ( "socket" => "/tmp/rails3.socket", "bin-path" => "/path/to/public/dispatch.fcgi" ) ), ".fcgi" => ( "localhost" => ( "socket" => "/tmp/rails4.socket", "bin-path" => "/path/to/public/dispatch.fcgi" ) ) ) As per the instructions at http://bougyman.com/miscfiles/RailsonDebian.html , and then I changed the 404 handler from dispatch.cgi to dispatch.fcgi. Upon starting lighttpd, I got these errors: $ lighttpd -D -f lighttpd.conf /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' for FCGI:Class (NoMethodError) from /home/www/cedscreening/public/dispatch.fcgi:10 /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' for FCGI:Class (NoMethodError) from /home/www/cedscreening/public/dispatch.fcgi:10 /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' for FCGI:Class (NoMethodError) from /home/www/cedscreening/public/dispatch.fcgi:10 /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': undefined method `is_cgi?'' for FCGI:Class (NoMethodError) from /home/www/cedscreening/public/dispatch.fcgi:10 And when I try to load a page, it just sits there indefinitely, never loading. I''ve left it for up to a minute and nothing at all happens. So I''m officially stumped. That ''is_cgi?'' method is defined in the same file as the ''each_cgi'' method, if ruby can see one I can''t imagine why it can''t see the other. -- One Guy With A Camera http://rbpark.ath.cx
Rob Park schrieb:> On Sun, 6 Mar 2005 16:55:29 -0700, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>And trying to access the site just loads until it times out, nothing >>happens. Not sure what that error means, I glanced over that file and >>is_cgi? is most definitely a defined method, right near the beginning >>of the file. > > > Ok, I''ve played around with this a little more, and the only progress > that I can report is that I''ve got rails working successfully in CGI, > but not FastCGI. > > To get rails working in regular CGi in lighttpd, I had to have it load > "mod_cgi", and I had to add this line to the config: > > server.error-handler-404 = "/dispatch.cgi" > > I was having problems using mod_rewrite to accomplish this, not sure > what the problem was, but lighttpd seemed to throw itself into some > kind of infinite loop (all I know is that lighttpd would display a > directory listing correctly if I commented out the rewrite rules, and > then it would basically suck up ALL my CPU indefinitely when I > uncommented it). Having rails as the 404 handler is nice because it > means I can put files into public/ and lighttpd will actually serve > them instead of displaying a rails error (nothing quite like being > told that rails can''t find the Image.jpgController).I experienced the exact same thing when trying to use this.> Ok, so at this point rails is working in lighttpd through regular CGI. > This is progress (it shows that lighttpd is at least installed and > working properly). In normal CGI, lighttpd was taking 2-3 seconds per > page request. Not terrible, but this is on my big, beefy desktop > system. The server that it''s going to "go live" on has much less CPU > and RAM, so I''m assuming it''d only get slower. Not acceptable for a > production system. > > To install FastCGI, I did this: > > 1. I downloaded, compiled, and installed > http://fastcgi.com/dist/fcgi-2.4.0.tar.gz It installed successfully > and with no errors. > > 2. I tried commands like "gem install fcgi", "gem install fcgi -- > --with-fcgi-dir=/usr/local" and a couple other variations, and they > all had exactly the same result, the message that fcgi was installed > successfully, followed by a bunch of rdoc errors (somebody else posted > the error, I won''t repeat it because it''s kinda long). > > 3. I changed dispatch.fcgi to have this: > > require ''rubygems'' > require_gem ''fcgi'' > > As per the instructions at > http://wiki.rubyonrails.com/rails/show/FastCGI+on+unix+linux+bsd > > 4. Modified my lighttpd config to load mod_fastcgi, and added in this config: > > fastcgi.server = ( > ".fcgi" => ( "localhost" => ( > "socket" => "/tmp/rails.socket", > "bin-path" => "/path/to/public/dispatch.fcgi" ) ), > ".fcgi" => ( "localhost" => ( > "socket" => "/tmp/rails1.socket", > "bin-path" => "/path/to/public/dispatch.fcgi" ) ), > ".fcgi" => ( "localhost" => ( > "socket" => "/tmp/rails2.socket", > "bin-path" => "/path/to/public/dispatch.fcgi" ) ), > ".fcgi" => ( "localhost" => ( > "socket" => "/tmp/rails3.socket", > "bin-path" => "/path/to/public/dispatch.fcgi" ) ), > ".fcgi" => ( "localhost" => ( > "socket" => "/tmp/rails4.socket", > "bin-path" => "/path/to/public/dispatch.fcgi" ) ) > ) > > As per the instructions at > http://bougyman.com/miscfiles/RailsonDebian.html , and then I changed > the 404 handler from dispatch.cgi to dispatch.fcgi. > > Upon starting lighttpd, I got these errors: > > $ lighttpd -D -f lighttpd.conf > /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': > undefined method `is_cgi?'' for FCGI:Class (NoMethodError) > from /home/www/cedscreening/public/dispatch.fcgi:10 > /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': > undefined method `is_cgi?'' for FCGI:Class (NoMethodError) > from /home/www/cedscreening/public/dispatch.fcgi:10 > /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': > undefined method `is_cgi?'' for FCGI:Class (NoMethodError) > from /home/www/cedscreening/public/dispatch.fcgi:10 > /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.5/./fcgi.rb:593:in `each_cgi'': > undefined method `is_cgi?'' for FCGI:Class (NoMethodError) > from /home/www/cedscreening/public/dispatch.fcgi:10 > > And when I try to load a page, it just sits there indefinitely, never > loading. I''ve left it for up to a minute and nothing at all happens. > > So I''m officially stumped. That ''is_cgi?'' method is defined in the > same file as the ''each_cgi'' method, if ruby can see one I can''t > imagine why it can''t see the other. >This is indeed funny, maybe we should open a ticket. I got the same results. Although I am running fcgi and it is plenty fast for dev purposes. I am not sure if I have some c based fcgi installed anyway. Sascha
On Mon, 07 Mar 2005 07:08:20 +0100, Sascha Ebach <se-eFwX6J65rk9VioaHkBSlcw02NpfuEekPhC4ANOJQIlc@public.gmane.org> wrote:> This is indeed funny, maybe we should open a ticket. I got the same > results. Although I am running fcgi and it is plenty fast for dev > purposes. I am not sure if I have some c based fcgi installed anyway.I''m not sure if a ticket is necessary. I think it''s something we''re doing wrong, as many other people report easy success with rails/lighttpd/fastcgi. I''m going to attempt to set this up on my server. Perhaps there is some problem with Fedora, some package I''m missing (like when I was first starting out with rails and I was missing the irb package which broke _everything_), hopefully it will work on debian, which is what my server runs. If it works on my server, then we can try to examine the differences and find out what''s going wrong. -- One Guy With A Camera http://rbpark.ath.cx
Rob Park schrieb:> On Mon, 07 Mar 2005 07:08:20 +0100, Sascha Ebach > <se-eFwX6J65rk9VioaHkBSlcw02NpfuEekPhC4ANOJQIlc@public.gmane.org> wrote: > >>This is indeed funny, maybe we should open a ticket. I got the same >>results. Although I am running fcgi and it is plenty fast for dev >>purposes. I am not sure if I have some c based fcgi installed anyway. > > > I''m not sure if a ticket is necessary. I think it''s something we''re > doing wrong, as many other people report easy success with > rails/lighttpd/fastcgi. > > I''m going to attempt to set this up on my server. Perhaps there is > some problem with Fedora, some package I''m missing (like when I was > first starting out with rails and I was missing the irb package which > broke _everything_), hopefully it will work on debian, which is what > my server runs. If it works on my server, then we can try to examine > the differences and find out what''s going wrong.I use debian, albeit in Colinux. This shouldn''t be a problem though. Let me know your next test results. Sascha
On Mon, 07 Mar 2005 08:36:25 +0100, Sascha Ebach <se-eFwX6J65rk9VioaHkBSlcw02NpfuEekPhC4ANOJQIlc@public.gmane.org> wrote:> I use debian, albeit in Colinux. This shouldn''t be a problem though. Let > me know your next test results.Well, I''m still in the middle of setting it up on my server. It''s now past 5AM, so I concede that I''m too tired to think straight and in the morning when I look at my setup, I''ll be missing something obvious and I''ll kick myself. Anyway, at this point, all I''m trying to do is get rails up in regular CGI. From what I can tell by the error messages, lighttpd is configured correctly and is correctly launching rails, but rails can''t connect to the database properly. For the longest time I was getting the "make sure the database is accepting connections on port 5432" error (or whatever), but now I''ve progressed to this error: FATAL: no pg_hba.conf entry for host "[my server''s ip]", user "rbpark", database "ceds_dev", SSL off Of course, that''s easy enough to fix, I could add an entry in pg_hba.conf to allow me. But that''s not the correct solution... because I didn''t have to do that in my local setup. I''ve checked over the config files thoroughly, and everything is exactly the same. Postgres is listening on port 5432, trusts all local connections, etc. Worked fine on my desktop box, but for some reason not on the server. This indicates to me that rails is attempting to connect to the db through the public-facing network interface, not through the local loopback (eg, it''s trying to connect to my IP address instead of to 127.0.0.1. I''m not sure why rails would do this and I''m too tired to think about it further, so the rest of my rails/lighttpd/fastcgi adventures will have to wait for tomorrow. One good sign though is that debian has a package for libfcgi-dev and libfcgi-ruby1.8, fedora didn''t. Those ought to be more reliable than whatever junk I compiled myself on my fedora box. Blah. -- One Guy With A Camera http://rbpark.ath.cx
On Mon, 7 Mar 2005 05:23:34 -0700, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Well, I''m still in the middle of setting it up on my server. It''s now > past 5AM, so I concede that I''m too tired to think straight and in the > morning when I look at my setup, I''ll be missing something obvious and > I''ll kick myself.LOL, was I ever right. Yeah, I got it working now. The problem I was having last night is that my debian server was somehow missing it''s /etc/hosts file, so when rails attempted to connect to the database on "localhost", it wasn''t connecting to 127.0.0.1, it was connecting to my server''s actual IP. Postgres saw this as a remote connection and rejected it. So, I added a localhost entry to /etc/hosts, and then I managed to get rails working in regular CGI on my debian server, piece of cake, but slooow.> One good sign though is that debian has a package for libfcgi-dev and > libfcgi-ruby1.8, fedora didn''t. Those ought to be more reliable than > whatever junk I compiled myself on my fedora box. Blah.And shortly after setting up rails in CGI, I got it working in FastCGI. I''m not really sure what the problem was in the first place, other than "FastCGI is severely broken on Fedora". To get a working fastcgi setup on debian, all I had to do was: 1. compile & install lighttpd 2. make sure the debian packages libfcgi-dev, libfcgi-ruby1.8, and libfcgi0 are installed. 3. Since lighttpd comes with it''s own mod_fastcgi, this is basically all you need to get it working on debian, and it all just works together with magical happy goodness. 4. Of course, lighttpd needs to be correctly configured, but this isn''t hard. These websites both helped a lot: http://bougyman.com/miscfiles/RailsonDebian.html (but when it tells you to download a file, don''t use the provided link, as it links directly to an old file... instead, just go to the website for that project and attempt to manually download the newest version). http://wiki.rubyonrails.com/rails/show/Lighttpd (for more general information about the lighttpd config file, less debian specifics). Hope this helps. Oh, if you''re interested, you can see my rails project here: http://cedscreening.ca:81/ (this is using rails 0.10.1, lighttpd 1.3.12, and fastcgi 2.4.0) compare to: http://cedscreening.ca/ (this is apache 1.3.x serving static files with a bit of SSI, which the rails project above was modelled after -- they''re meant to look identical). I''m not fully satisfied with the speed of fastcgi. It _is_ significantly faster than regular CGI, but it still feels a little sluggish on the server. I guess I could help that along by caching pages, and when I finally take down apache and "go live" with lighttpd that''ll help. -- One Guy With A Camera http://rbpark.ath.cx
On Mon, 7 Mar 2005 15:16:19 -0700, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m not fully satisfied with the speed of fastcgi. It _is_ > significantly faster than regular CGI, but it still feels a little > sluggish on the server. I guess I could help that along by caching > pages, and when I finally take down apache and "go live" with lighttpd > that''ll help.Oh, I take that back, fastcgi is plenty fast. The problem is that my server is crap ;) I checked my rails app from the computers at work, it was very snappy, loading in less than a second for each page. So the real problems is just that my server isn''t very powerful to begin with. My server has enough trouble just running apache, doing lighttpd and apache at the same time is a bit much for it. So once I get everything* working in rails, I''m going to ditch apache outright, then everything will be nice and snappy as my server can devote all it''s resources to lighttpd/fastcgi. (* I have two domains hosted on my server, one has been successfully converted to rails and is waiting to go live, the other one I haven''t started yet). -- One Guy With A Camera http://rbpark.ath.cx