Forum: Ruby on Rails some notes about rails, apache, fastcgi and windows

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A9cdc0b24a1ee497ad749afab0ec5c30?d=identicon&s=25 Luigi Rizzo (luigi)
on 2005-12-28 19:37
(Received via mailing list)
hello.

i'd like to share some feelings of mine after a couple of *weeks*
intermittent attempts to have rails applications working on windows
(XP) with fastcgi performances under apache (2.0).

i'd say the software stack i'm using now will be fairly common as more
and more new rails developers will join the bandwagon.

what is stunning me is the fact that, even if i'm certainly not a
guru, i can't say i'm a computer illiterate, and notwithstanding this
i'm still struggling just to have an application of mine or, for
example typo, being deployed on the most convenient platform i've on
hand (i'm not saying it is the best or the greatest, i'm just say it
is the one i've on hand ...) after roughly two weeks of efforts.

i checked almost all posts and wiki entries on this subject, founding
several of them somewhat discording and, unfortunately not definitive.
as a matter of fact even if supposedly definitive articles do exists,
such as
http://scottstuff.net/blog/articles/2005/07/20/apa...
if you browse through the end of it you'll find other people still
struggling with the very same issues i'm still facing, yet unresolved
...

interestingly enough, i'm not even able to see typo (the rails-based
blog program) running successfully under a fcgi environment (i even
attempted to have lighttpd runs under windows in order to have typo
running, but that is another nightmare ...)--btw, it works ok under
webrick.

a final consideration: rails is great and fun to program, until you
are going to deploy it ... this segment of the stack really badly
needs to be documented, explained in details ("why is something
happening on this stack and not on this other one ..."), and
*effectively* covered for the vast majority of deployment cases,
otherwise rails will be, for the foreseeable future, just a promise in
half.

--luigi
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2005-12-28 19:43
(Received via mailing list)
On 12/28/05, Luigi Rizzo <luigi.rizzo@gmail.com> wrote:
> guru, i can't say i'm a computer illiterate, and notwithstanding this
> struggling with the very same issues i'm still facing, yet unresolved
> needs to be documented, explained in details ("why is something
> happening on this stack and not on this other one ..."), and
> *effectively* covered for the vast majority of deployment cases,
> otherwise rails will be, for the foreseeable future, just a promise in
> half.

Did you try SCGI + apache on windows?

http://www.zedshaw.com/projects/scgi_rails/

I believe InstantRails (the simple rails environment on windows) uses
that method by default.

--
rick
http://techno-weenie.net
350b7c39d2973b5ae483c65729a5bfcc?d=identicon&s=25 Morten (Guest)
on 2005-12-28 20:28
(Received via mailing list)
>
> Did you try SCGI + apache on windows?
>
> http://www.zedshaw.com/projects/scgi_rails/
>
> I believe InstantRails (the simple rails environment on windows) uses
> that method by default.

While SCGI is what FastCGI should strive to be in simplicity, it's
simply not ready for production.

Example, right now, I'm trying to reach an SCGI deployed application.
Apache gives me a 500 internal server error, and this in the error log:

[Wed Dec 28 20:13:20 2005] [error] [client 83.91.147.101] (500)Unknown
error 500: scgi: Unknown error 500: error reading response headers

There's nothing in scgi.log or production.log. For this reason only, I
don't see SCGI a viable alternative to FastCGI.

Br,

Morten
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 Nick Stuart (Guest)
on 2005-12-28 20:50
(Received via mailing list)
I don't know, getting rails up and running with Apache and windows
wasn't all the terrible for me (defiantly not as bad as hacking around
with IIS). But, here were my steps as well as I can remember. (this
was running on a 2003 box, but I'll go through it on my XP box at home
to make sure)

Install Ruby 1.82 through the window binary available.
add c:\ruby\bin to the path env
`gem install rails` from the command line
get the mod_fastcgi.dll and add it to the apache modules directory
add the following in the httpd.conf

LoadModule fastcgi_module modules/mod_fastcgi.dll

<IfModule mod_fastcgi.c>
    FastCgiServer "<path-to-app>/public/dispatch.fcgi" \
        -initial-env RAILS_ENV=production \
        -processes 4 -idle-timeout 60
</IfModule>

#i have it setup as a virtual server, the following directory entry is
for that
   <Directory "<path-to-app>/public">
        Options ExecCGI FollowSymLinks
        AllowOverride all
        Allow from all
        Order allow,deny
        AddHandler cgi-script .cgi
        AddHandler fastcgi-script .fcgi
    </Directory>

Install ruby for apache v 1.3.1
Get a copy of my app
MAKE SURE THAT THE PATH FOR THE RUBY EXE IS RIGHT AT THE TOP OF THE
DISPATCH.FCGI file! (very important and easy to miss)
Mine looks like #!C:/ruby/bin/rubyw

and I think thats it. No registry hacking or the like was invloved. I
was also able to upgrade rails from the 0.14.x versions to 1.0 with
out any issues (besides one bug that cropped up).

Like I said, this was on 2003, but can't imagine XP would be really
any different when trying to run apache, but I'll give it a go once I
get home.

-Nick
46710a442003bd7f8e0100b41e4cfe7c?d=identicon&s=25 Maurizio Balestrieri (Guest)
on 2005-12-28 21:38
(Received via mailing list)
Hello Nick, thanks for sharing your configuration.

I may possibly have forgot some steps, or not correctly executed some
instructions found in some posts or resources on the web. In a few
days I may give it another try.

My point though is that, based on the various resources I found
available on the web (wikis, web sites, emails), and based on repeated
issues raised about fcgi (like the infamous: "FastCGI: incomplete
headers (35 bytes) received from server") there doesn't seem (yet) to
be a clear definitive solution, working in *all* (most) circumstances,
or at least a clearly precise and detailed explanation of the
interactions between the required software components on the windows
platform for the rails+apache+fcgi stack, so to take the corrective
actions and solve the problem, rather than a brutal trial and error
approach.

--L
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 Nick Stuart (Guest)
on 2005-12-28 22:11
(Received via mailing list)
I'll agree that the steps needed to get Rails up and running on ANY
stack is lack luster at best. Just look at how many e-mails on this
list alone are about just getting stuff running!

With that being said, Rails is a new technology (they just hit 1.0)
and I personally don't expect it to be a walk in the park just yet
when it comes to doing certain things. I do expect it to run though,
with effort from my end, and so far its done that on anything I've
tried it on. (I've gotten it running on apache(linux/windows/OS X) and
under IIS)

Rails right now is still very narrow minded when it comes to what
platforms it runs on (and with what amount of effort each platform
needs). This is a reflection of how/why it was developed in the first
case, and will only change in time.

All in all, I haven't found Rails to be much more difficult then any
other web based framework of similar age. (never used it, but what was
PHP 1.0 like to setup?) And has anyone ever tried to get a J2EE stack
going? :)

Well thats my rant on the subject anyways. Like I said, I'll try to
get my home box up and running as soon as I can and will report on how
that goes, with the steps I took.

-Nick
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 Nick Stuart (Guest)
on 2005-12-29 02:52
(Received via mailing list)
Ok, so I went through the setup on my XP SP 2 machine here at home.

For the most part I followed
http://wiki.rubyonrails.com/rails/pages/HowToInsta...
to the letter, as I did with 2003 box. Once I type in the right
path(!) everything was up and running in about 20mins. I didn't have
ruby installed at all here, so it was all from the beginning.

I used:
 Ruby 1.8.2 Windows Installer
 `gem install rails --include dependencies`
 RubyForApache 1.3.1 (I forgot this at first, and it wasn't working so
well)
 mod_fastcgi-2.4.2.dll
 `rails test` to generate a silly little app.

One those are installed I made the changes to the httpd.conf as noted
on the wiki page. The one extra bit I added was the FastCGIServer part
I noted in my previous e-mail.

That was it. Granted my little test app doesn't connect to a database
or anything, but it should work for real apps too, and has for me.

Hope this helps somehow.
-Nick
A7db9ec803b5895ae5f916a74e2db329?d=identicon&s=25 Hunter's Lists (Guest)
on 2005-12-29 03:29
(Received via mailing list)
I really liked SCGI and would have switched to using it over FCGI but
we're
running Apache 2 on Linux and there is no good way to have Apache
connect to
the different instances of an SCGI cluster (I guess it works with
lighttpd)
so you are limited to one connection which killed our performance and
scalability.

Until Apache's mod_scgi knows how to connect to multiple SCGI listeners
and
dispatch requests properly, no go for us.
8c43ed7f065406bf171c0f3eb32cf615?d=identicon&s=25 Zed A. Shaw (Guest)
on 2005-12-29 04:47
(Received via mailing list)
Morten,

Considering other people have this configuration running do you think
you just might have your configuration wrong?  Why don't you send me
your apache config and I'll see if I can debug it.

BTW, I'd say SCGI is fairly ready for production if you use lighttpd.
If you need to use Apache then please place the blame properly on the
apache configuration and mod_scgi.  I've run several fairly high volume
sites using lighttpd and scgi with no problems.

Zed A. Shaw
http://www.zedshaw.com/


On Wed, 28 Dec 2005 20:26:16 +0100
A7db9ec803b5895ae5f916a74e2db329?d=identicon&s=25 Hunter's Lists (Guest)
on 2005-12-29 06:35
(Received via mailing list)
Zed,

Do you know if mod_scgi is being maintained?

I wonder what it would take to get it in shape for Apache?

I'd love to move over to SCGI.

Cheers.
350b7c39d2973b5ae483c65729a5bfcc?d=identicon&s=25 Morten (Guest)
on 2005-12-29 10:04
(Received via mailing list)
Hi Zed,

> Considering other people have this configuration running do you think
> you just might have your configuration wrong?  Why don't you send me
> your apache config and I'll see if I can debug it.

It's quite likely my installation, but with SCGI being so simple, I
don't see how I can get it wrong. Also, this works for the first period
of time after which it breaks:

<VirtualHost 213.150.40.246>
   ServerName weblog.tagticks.com
   DocumentRoot /home/tagticks/sites/weblog/typo-2.6.0/public/

   SCGIMount / 127.0.0.1:10001

   <LocationMatch "/(stylesheets|images|javascripts|favicon|robots).*$">
     SCGIHandler Off
   </LocationMatch>
</VirtualHost>


> BTW, I'd say SCGI is fairly ready for production if you use lighttpd.
> If you need to use Apache then please place the blame properly on the
> apache configuration and mod_scgi.  I've run several fairly high volume
> sites using lighttpd and scgi with no problems.

That's good to head. I really appreciate the way you've done SCGI. I
really appreciate Apache2. I think the issue is somewhere in between, a
theory of mine is that it's a hanging MySQL connection that's the root
cause. This is a vanilla Typo 2.6.0 installation that has been doing
nothing over night.

If lighty is the way to go, so be it. I just use Apache2 extensively for
other sites on that machine and would prefer to keep doing that.

Br,

Morten
350b7c39d2973b5ae483c65729a5bfcc?d=identicon&s=25 Morten (Guest)
on 2005-12-29 15:18
(Received via mailing list)
Hi Zed,

 > Considering other people have this configuration running do you think
 > you just might have your configuration wrong?  Why don't you send me
 > your apache config and I'll see if I can debug it.

It's quite likely my installation, but with SCGI being so simple, I
don't see how I can get it wrong. Also, this works for the first period
of time after which it breaks:

<VirtualHost 213.150.40.246>
   ServerName weblog.tagticks.com
   DocumentRoot /home/tagticks/sites/weblog/typo-2.6.0/public/

   SCGIMount / 127.0.0.1:10001

   <LocationMatch "/(stylesheets|images|javascripts|favicon|robots).*$">
     SCGIHandler Off
   </LocationMatch>
</VirtualHost>


 > BTW, I'd say SCGI is fairly ready for production if you use lighttpd.
 > If you need to use Apache then please place the blame properly on the
 > apache configuration and mod_scgi.  I've run several fairly high
volume
 > sites using lighttpd and scgi with no problems.


That's good to hear. I really appreciate the way you've done SCGI. I
really appreciate Apache2. I think the issue is somewhere in between, a
theory of mine is that it's a hanging MySQL connection that's the root
cause. This is a vanilla Typo 2.6.0 installation that has been doing
nothing over night.

If lighty is the way to go, so be it. I just use Apache2 extensively for
other sites on that machine and would prefer to keep doing that.

Br,

Morten
This topic is locked and can not be replied to.