Hi Everyone, Just announcing a new release of the SCGI Rails Runner (SRR) version 0.3.1 with lots of docs for lots of platforms. Most of the docs were collected from people who figured out things on different platforms, and credit is given to them where I have it. The docs give information for: * Lighttpd * Apache2 on non-Win32 * Apache1 or Apache2 on Win32 including pre-compiled mod_scgi.so files for both servers (thanks to Curt Hibbs). The instructions also include a FAQ of common problems people have run into with a promise of "no explanations, only answers". Check out the stuff at: http://www.zedshaw.com/projects/scgi_rails/ And give me some feedback. Thanks! === Supported Platforms I''ve confirmed support for the following platforms: * Linux -- Arch, Debian, Gentoo * FreeBSD * Win32 * OSX With Lighttpd and Apache2 on all, and Apache1 on Win32. Please send me any other reports of platform/server combos. Zed A. Shaw http://www.zedshaw.com/
rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
2005-Sep-22 05:16 UTC
Re: [ANN] SCGI Rails Runner 0.3.1: Docs, Docs, Docs
W O W ! Zed A. Shaw said the following on 2005-09-22 00:44:> * Apache1 or Apache2 on Win32 including pre-compiled mod_scgi.so files > for both servers (thanks to Curt Hibbs).I confirm that things are VERY easy to setup... I''m on Win32/Apache 2.0.54 and I got this working in 5 minutes flat ! Thanks a bunch ! Bye ! François
On 9/22/05, rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> wrote:> W O W ! > > > Zed A. Shaw said the following on 2005-09-22 00:44: > > * Apache1 or Apache2 on Win32 including pre-compiled mod_scgi.so files > > for both servers (thanks to Curt Hibbs). > > I confirm that things are VERY easy to setup... I''m on Win32/Apache > 2.0.54 and I got this working in 5 minutes flat ! > > Thanks a bunch !Yes! Its a nice contrast to FastCGI on which I spent several days and still only got it partially working. Curt
rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org wrote:> W O W ! > > > Zed A. Shaw said the following on 2005-09-22 00:44: > >> * Apache1 or Apache2 on Win32 including pre-compiled mod_scgi.so files >> for both servers (thanks to Curt Hibbs). > > > I confirm that things are VERY easy to setup... I''m on Win32/Apache > 2.0.54 and I got this working in 5 minutes flat ! > > Thanks a bunch ! > > Bye ! > François > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >Yes much better than FCGI. John
Sweet, glad it worked. Can you give me an exact Apache and Windows version number so I can put it in a supported platform matrix? Thanks. On Thu, 22 Sep 2005 01:16:48 -0400 rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org wrote:> W O W ! > > > Zed A. Shaw said the following on 2005-09-22 00:44: > > * Apache1 or Apache2 on Win32 including pre-compiled mod_scgi.so > > files for both servers (thanks to Curt Hibbs). > > I confirm that things are VERY easy to setup... I''m on Win32/Apache > 2.0.54 and I got this working in 5 minutes flat ! > > Thanks a bunch ! > > Bye ! > François > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
François Beausoleil
2005-Sep-23 02:33 UTC
Re: [ANN] SCGI Rails Runner 0.3.1: Docs, Docs, Docs
Oh, yeah... So, $ ruby --version ruby 1.8.2 (2004-12-25) [i386-mswin32] Apache 2.0.54 on Win XP Pro SP2. One thing I did though, which I forgot to mention previously, I disabled the require_gem "rails" line in the scgi_rails script. I wanted to run my patched copy of Rails, not the default one. Bye ! François Zed A. Shaw said the following on 2005-09-22 18:28:> Sweet, glad it worked. Can you give me an exact Apache and Windows > version number so I can put it in a supported platform matrix?
rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org wrote:> I confirm that things are VERY easy to setup... I''m on Win32/Apache > 2.0.54 and I got this working in 5 minutes flat !I wonder if I''m missing something. I followed the instructions with Curt''s windows binaries. After a few changes, I was able to get it working for a single application. A couple of questions: 1. I''m on Windows. It looks like I need to run "ruby script\scgi_rails -D" and leave it running while I''m hitting the app. If that correct? I have FCGI working and I like that I don''t have to have a command window open with the Server process. Did I miss something about that in the instructions? 2. My current Apache/FCGI setup allows me to have two applications (at http:/myserver/app1 and http://myserver/app2), and works just fine. Is there a similar way to do this with SCGI? Would I need to have a separate port defined for each one? 3. I have "dispatch.fcgi" in my apps'' .htaccess files, and it works well. Do I need to do anything with them, or do I need to do away with them altogether? Thanks, H.B.
I''ve managed to get the SCGI Rails Runner running in a subdirectory; does this approach make sense? httpd.conf snippet (based on jkraemer''s original): SCGIMount /rails 127.0.0.1:9999 # matches locations with a dot following at least one more characters, that is, things like *,html, *.css, *.js, which should be delivered directly from the filesystem <LocationMatch \/rails.+\..+$> # don''t handle those with SCGI SCGIHandler Off </LocationMatch> routes.rb: ActionController::Routing::Routes.draw do |map| base_dir = "rails/" map.connect base_dir + '''', :controller => "admin" map.connect base_dir + '':controller/service.wsdl'', :action => ''wsdl'' # Install the default route as the lowest priority. map.connect base_dir + '':controller/:action/:id'' end With this setup I''ve got static files served up straight from apache (as long as they have a period in their name) and everything lives off http://example.com/rails Still going to try and see if there''s a better mod_rewrite approach to check if the file exists before bumping the request off to rails. $ apachectl -v Server version: Apache/2.0.53 Server built: Jul 26 2005 11:08:48 $ ruby -v ruby 1.8.2 (2004-12-25) [i386-linux] Paul.
Well, I *thought* I''d got it working but now the issue is that the asset_tag_helpers return absolute URLs for images, javascript and the like. Looking at the code it seems that the code doesn''t use routing at all or consider the current directory to work out the URL. Is there a global base_dir option I''m missing somewhere that should go into environment.rb or something? Paul. On 23/09/05, Paul Wright <wrighty-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve managed to get the SCGI Rails Runner running in a subdirectory; > does this approach make sense? > > httpd.conf snippet (based on jkraemer''s original): > SCGIMount /rails 127.0.0.1:9999 > # matches locations with a dot following at least one more characters, > that is, things like *,html, *.css, *.js, which should be delivered > directly from the filesystem > <LocationMatch \/rails.+\..+$> > # don''t handle those with SCGI > SCGIHandler Off > </LocationMatch> > > routes.rb: > ActionController::Routing::Routes.draw do |map| > base_dir = "rails/" > > map.connect base_dir + '''', :controller => "admin" > map.connect base_dir + '':controller/service.wsdl'', :action => ''wsdl'' > # Install the default route as the lowest priority. > map.connect base_dir + '':controller/:action/:id'' > end > > With this setup I''ve got static files served up straight from apache > (as long as they have a period in their name) and everything lives off > http://example.com/rails > > Still going to try and see if there''s a better mod_rewrite approach to > check if the file exists before bumping the request off to rails. > > $ apachectl -v > Server version: Apache/2.0.53 > Server built: Jul 26 2005 11:08:48 > $ ruby -v > ruby 1.8.2 (2004-12-25) [i386-linux] > > Paul. >
Hi H.B., Comments below.... On Thu, 22 Sep 2005 22:08:17 -0500 "H.B. Taylor" <HBTaylor-rphTv4pjVZMJGwgDXS7ZQA@public.gmane.org> wrote:> rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org wrote: > > > I confirm that things are VERY easy to setup... I''m on > > Win32/Apache 2.0.54 and I got this working in 5 minutes flat ! > > I wonder if I''m missing something. I followed the instructions with > Curt''s windows binaries. After a few changes, I was able to get it > working for a single application. > > A couple of questions: > > 1. I''m on Windows. It looks like I need to run "ruby script > \scgi_rails -D" and leave it running while I''m hitting the app. If > that correct? I have FCGI working and I like that I don''t have to > have a command window open with the Server process. Did I miss > something about that in the instructions? >Yes, this is a limitation of Ruby on Windows and my lack of knowledge of working on with Ruby on Windows. Basically, I want to have the scgi_rails run as a service. For now people have to start it in a command window until I figure this out.> 2. My current Apache/FCGI setup allows me to have two applications > (at http:/myserver/app1 and http://myserver/app2), and works just > fine. Is there a similar way to do this with SCGI? Would I need to > have a separate port defined for each one? >You can do this with virtual hosts and having an SCGI server on two different ports. Another options (for your setup with one host) is to use mod_rewrite to send /app1 to one backend, and /app2 to another. Either way, you run two SCGI runners on two different ports and tell Apache which one to use.> 3. I have "dispatch.fcgi" in my apps'' .htaccess files, and it works > well. Do I need to do anything with them, or do I need to do away > with them altogether?Those dispatch files aren''t needed anymore with SCGI. The SCGI methodology is that the web server and Rails server should be independent so that you can reconfigure them independently. This means the two services run separately and communicate, rather than being tightly coupled. I''ll see if I can do more work with win32. I''m actually curious how you got FCGI to work because everyone I''ve talked to can''t get it to work at all. Zed A. Shaw http://www.zedshaw.com/
I haven''t tried this approach yet, but the problem seems similar to what happens when you try to use apache''s alias directive to map a rails app to a subdirectory. I my previous research on trying to use alias I seem to remember something about having to use a "rewritebase" directive (or something like that). Try searching for "alias directive fastcgi rails". What you find may help you to solve the problem. Of course, when you do solve the problem, please share it with the rest of us. Curt On 9/23/05, Paul Wright <wrighty-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Well, I *thought* I''d got it working but now the issue is that the > asset_tag_helpers return absolute URLs for images, javascript and the > like. Looking at the code it seems that the code doesn''t use routing > at all or consider the current directory to work out the URL. > > Is there a global base_dir option I''m missing somewhere that should go > into environment.rb or something? > > Paul. > > On 23/09/05, Paul Wright <wrighty-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I''ve managed to get the SCGI Rails Runner running in a subdirectory; > > does this approach make sense? > > > > httpd.conf snippet (based on jkraemer''s original): > > SCGIMount /rails 127.0.0.1:9999 > > # matches locations with a dot following at least one more characters, > > that is, things like *,html, *.css, *.js, which should be delivered > > directly from the filesystem > > <LocationMatch \/rails.+\..+$> > > # don''t handle those with SCGI > > SCGIHandler Off > > </LocationMatch> > > > > routes.rb: > > ActionController::Routing::Routes.draw do |map| > > base_dir = "rails/" > > > > map.connect base_dir + '''', :controller => "admin" > > map.connect base_dir + '':controller/service.wsdl'', :action => ''wsdl'' > > # Install the default route as the lowest priority. > > map.connect base_dir + '':controller/:action/:id'' > > end > > > > With this setup I''ve got static files served up straight from apache > > (as long as they have a period in their name) and everything lives off > > http://example.com/rails > > > > Still going to try and see if there''s a better mod_rewrite approach to > > check if the file exists before bumping the request off to rails. > > > > $ apachectl -v > > Server version: Apache/2.0.53 > > Server built: Jul 26 2005 11:08:48 > > $ ruby -v > > ruby 1.8.2 (2004-12-25) [i386-linux] > > > > Paul. > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
For the record, I created a start_scgi.cmd file that contains the following: ruby script\scgi_rails start -p 9999 -e production -D I include the port option (even though 9999 is the default) to make it easy modify when I want a different port. Curt On 9/23/05, Zed A. Shaw <zedshaw-dd7LMGGEL7NBDgjK7y7TUQ@public.gmane.org> wrote:> Hi H.B., > > Comments below.... > > On Thu, 22 Sep 2005 22:08:17 -0500 > "H.B. Taylor" <HBTaylor-rphTv4pjVZMJGwgDXS7ZQA@public.gmane.org> wrote: > > > rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org wrote: > > > > > I confirm that things are VERY easy to setup... I''m on > > > Win32/Apache 2.0.54 and I got this working in 5 minutes flat ! > > > > I wonder if I''m missing something. I followed the instructions with > > Curt''s windows binaries. After a few changes, I was able to get it > > working for a single application. > > > > A couple of questions: > > > > 1. I''m on Windows. It looks like I need to run "ruby script > > \scgi_rails -D" and leave it running while I''m hitting the app. If > > that correct? I have FCGI working and I like that I don''t have to > > have a command window open with the Server process. Did I miss > > something about that in the instructions? > > > Yes, this is a limitation of Ruby on Windows and my lack of knowledge > of working on with Ruby on Windows. Basically, I want to have the > scgi_rails run as a service. For now people have to start it in a > command window until I figure this out. > > > 2. My current Apache/FCGI setup allows me to have two applications > > (at http:/myserver/app1 and http://myserver/app2), and works just > > fine. Is there a similar way to do this with SCGI? Would I need to > > have a separate port defined for each one? > > > You can do this with virtual hosts and having an SCGI server on two > different ports. Another options (for your setup with one host) is to > use mod_rewrite to send /app1 to one backend, and /app2 to another. > > Either way, you run two SCGI runners on two different ports and tell > Apache which one to use. > > > 3. I have "dispatch.fcgi" in my apps'' .htaccess files, and it works > > well. Do I need to do anything with them, or do I need to do away > > with them altogether? > > Those dispatch files aren''t needed anymore with SCGI. The SCGI > methodology is that the web server and Rails server should be > independent so that you can reconfigure them independently. This means > the two services run separately and communicate, rather than being > tightly coupled. > > I''ll see if I can do more work with win32. I''m actually curious how > you got FCGI to work because everyone I''ve talked to can''t get it to > work at all. > > Zed A. Shaw > http://www.zedshaw.com/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
> > > On 9/23/05, Zed A. Shaw <zedshaw-dd7LMGGEL7NBDgjK7y7TUQ@public.gmane.org> wrote:> Yes, this is a limitation of Ruby on Windows and my lack of knowledge > > of working on with Ruby on Windows. Basically, I want to have the > > scgi_rails run as a service. For now people have to start it in a > > command window until I figure this out.Not sure if this would do the trick, but I came across this a while back: http://raa.ruby-lang.org/project/win32-service (demo code here) http://rubyforge.org/projects/win32utils/ (download here) *Looks* like a person could make a Ruby Windows Service with the "Ruby-Services" package _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
After working on this on and off for the last couple of days I''ve finally got a hack together that lets me run my app under a sub-directory by mis-using ActionController::Base.asset_host. in environment.rb I now have this line: ActionController::Base.asset_host = "/rails" It ensures that all asset (static file) links are prefixed with "/rails" and then in the routes.rb I have the base_dir prefixed to all routes as before. I had started on a patch for ActionPack but I guess there''s not much interest in it (and it turns out it broke Routing somehow) but if someone could point me in the right direction I''d like to see this finished: http://dev.rubyonrails.com/ticket/2275 Paul. On 23/09/05, Paul Wright <wrighty-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Well, I *thought* I''d got it working but now the issue is that the > asset_tag_helpers return absolute URLs for images, javascript and the > like. Looking at the code it seems that the code doesn''t use routing > at all or consider the current directory to work out the URL. > > Is there a global base_dir option I''m missing somewhere that should go > into environment.rb or something? > > Paul. > > On 23/09/05, Paul Wright <wrighty-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I''ve managed to get the SCGI Rails Runner running in a subdirectory; > > does this approach make sense? > > > > httpd.conf snippet (based on jkraemer''s original): > > SCGIMount /rails 127.0.0.1:9999 > > # matches locations with a dot following at least one more characters, > > that is, things like *,html, *.css, *.js, which should be delivered > > directly from the filesystem > > <LocationMatch \/rails.+\..+$> > > # don''t handle those with SCGI > > SCGIHandler Off > > </LocationMatch> > > > > routes.rb: > > ActionController::Routing::Routes.draw do |map| > > base_dir = "rails/" > > > > map.connect base_dir + '''', :controller => "admin" > > map.connect base_dir + '':controller/service.wsdl'', :action => ''wsdl'' > > # Install the default route as the lowest priority. > > map.connect base_dir + '':controller/:action/:id'' > > end > > > > With this setup I''ve got static files served up straight from apache > > (as long as they have a period in their name) and everything lives off > > http://example.com/rails > > > > Still going to try and see if there''s a better mod_rewrite approach to > > check if the file exists before bumping the request off to rails. > > > > $ apachectl -v > > Server version: Apache/2.0.53 > > Server built: Jul 26 2005 11:08:48 > > $ ruby -v > > ruby 1.8.2 (2004-12-25) [i386-linux] > > > > Paul. > > >
Works fine so far on Freebsd 5.4, Apache 1.3.33. One thing that would be nice is an option similar to apache''s MaxRequestsPerChild for running rails in development mode. Chris _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 9/26/05, snacktime <snacktime-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Works fine so far on Freebsd 5.4, Apache 1.3.33. > > One thing that would be nice is an option similar to apache''s > MaxRequestsPerChild for running rails in development mode. > > Chris >Or actually just a script to generate and then read the status files would be good. I''ll need something like that anyways so I''ll post it once I get it finished. Chris _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails