I Would Really Like to Try RoR but


#1

it’s been a nightmare trying to set it up. I keep getting a an
Application Error message when I try to navigate to a url which should
be taken care of by my newly created controllers. For instance, I
wanted to test RoR out so I created a MyTest controller which should
allow me to navigate something like:

http://localhost/rubytest/MyTest

but it does not. I have no problem getting the initial ‘Welcome’
message located in the /public/ folder but anything else I try fails.

I have modified my http.conf file in Apache to add a virtual server for
my ruby app including adding the LoadModule directive for fastcgi.

I have modified the .htaccess file in the /public/ folder to change the
.cgi to .fcgi but nothing is making it work.

I think I may stick with PHP (takes all of 5 minutes to setup).

John


#2

Hi John,

The Apache setup for RoR can be a bit tedious and is one of the areas
that needs improvement. What operating system are you using? The
reason I ask is that for Mac there is Locomotive to get you up and
running quickly.

I have found that for Windows it is much easier to develop using
Webrick, by running the command ‘ruby script\server’ from the root of
your project. Your project will then be available at
http://localhost:3000.

Lighttpd is another route you could try that is easier to configure
than the Apache setup.

Good Luck,
Tom


#3

Hey John,

We could probably offer more help to you if we knew what platform you
were running on.

You should probably try using script/server first and checking the log
files.

Post a little more information and I am sure someone here can put you on
the right path.


Owen


#4

John S. <john.smith@…> writes:

it’s been a nightmare trying to set it up. I keep getting a an
Application Error message when I try to navigate to a url which should
be taken care of by my newly created controllers. For instance, I
[…]

I think I may stick with PHP (takes all of 5 minutes to setup).

+1 Agree. I don’t know what platform John is working with, but on
Windows/IIS
it is exceedingly difficult. There is a lot of info on the web for
setting up
a Rails environment under Windows 2003/IIS 6.0, but many of the sites
have
conflicting information on the process, or worse, things like “this is
broken
right now,” or “i’m not sure how to get this part to work.”

Those of us who do not have the luxury of a Unix setup, or even the
ability to
install a Windows version of Apache are pretty much out of luck.
Correct me if
I’m wrong but so far, there does not exist a document detailing the
setup of
Rails on a Windows 2k3/IIS6 production environment with the following
restrictions:

  • No Apache allowed
  • No InstantRails allowed
  • No Linux-in-a-Window allowed
  • No VMware/VirtualPC/emulation allowed

Basically, the only non-MS software allowed on the server is Ruby and
the Rails
libraries.

Any takers?

Lester


#5

Lighttpd is another route you could try that is easier to configure
than the Apache setup.

For Windows I’d highly suggest Instant Rails [1].

I personally use Darwin Ports [2] to compile my own version of ruby on
my Mac. Being a complete mac newb (having just switched from
windows), I was able to build my own Ruby, postgresql, fastcgi, and
lighttpd. If you must use Apache for whatever reason, I hear folks
are having success with SCGI [3]. Though I had little experience
setting up Apache beyond modifying .htaccess files, I was able to get
up and running in lighttpd fairly quickly.

Good luck with your new setup… Hopefully by v5.0 Rails will have a
painless setup story too :slight_smile:

  1. http://instantrails.rubyforge.org/.

http://wiki.rubyonrails.com/rails/pages/HowtoInstallOnOSXTigerUsingDarwinPorts
3. http://www.zedshaw.com/projects/scgi_rails/


rick
http://techno-weenie.net


#6

On Fri, 2005-12-16 at 21:01 +0100, John S. wrote:

I have modified my http.conf file in Apache to add a virtual server for
my ruby app including adding the LoadModule directive for fastcgi.

I have modified the .htaccess file in the /public/ folder to change the
.cgi to .fcgi but nothing is making it work.

I think I may stick with PHP (takes all of 5 minutes to setup).

John

John,

The first thing that comes to mind is that rails does some magic with
urls. If your controller is named MyTestController, and you have your
server set up to host rails in /rubytest, then the correct URL is:

http://localhost/rubytest/my_test

By default, it will pick that up as an action named index
(/my_test/index is equivalent) so your controller needs an index method
to handle that request.

  • Jamie

#7

Well thank you all for taking the time to reply, I will try to give you
guys a better idea of where I am at and what platform/settings I am
running.

I am using WindowsXP Pro with Apache 2.something and MySQL. I followed
the directions on this site:
http://wiki.rubyonrails.com/rails/pages/RailsOnWindows but they did not
seem to work. I did change all the settings to reflect my file
structure and such. And I agree with the post above (Lester) regarding
conflicting information. After the failed attempt with the above link I
tried googling but came across the same conundrum of competing
installation instructions (one will have you add something to the
http.conf file others will not).

And to Jamie. I will have to try what you indicated. I had been using
http://localhost/rubytest/mytest w/o the underscore as I was following
along with this ->
http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=2 <-
tutorial which did not have it. If this works then all my frustrations
were not the result of RoR but of a typo in a relatively old tutorial
(and I apologize if this is the case).

John


#8

on GNU, BSD and darwin boxes you can use this :

server.port = 8080
server.bind = “localhost”
server.event-handler = “freebsd-kqueue”
server.username = “www”
server.groupname = “www”
server.document-root = “path_to_public_dir”
server.errorlog = “path_to_server.log”
server.modules = ( “mod_rewrite”, “mod_fastcgi” )
server.indexfiles = ( “dispatch.fcgi”, “index.php”, “index.html”
)

rails stuff

server.error-handler-404 = “/dispatch.fcgi”
fastcgi.server = ( “.fcgi” =>
( “localhost” =>
( “socket” => “/tmp/dev.socket”,
“bin-path” => “path_to_dispatch.fcgi”,
“max-procs” => 5,
“min-procs” => 1,
“bin-environment” => ( “RAILS_ENV” => “development” )
)
)
)

mimetype mapping

mimetype.assign = (
“.pdf” => “application/pdf”,
“.gif” => “image/gif”,
“.jpg” => “image/jpeg”,
“.jpeg” => “image/jpeg”,
“.png” => “image/png”,
“.html” => “text/html”,
“.txt” => “text/plain”,
“.css” => “text/css”,
)

It’s a lighttpd.conf file I’ve found on the web and tweaked.

Note : it takes me 5 minutes to bring a rails host up. So I don’t
think your comparison is usefull. You just lack knowledge and
practice, Rails’s something new for you, you’ll learn.

For windows I think there is Instant Rails to try Rails out :
http://weblog.rubyonrails.com/articles/2005/10/14/instant-rails-ruby-rails-apache-and-mysql-package-for-windows

On 12/16/05, Tom D. removed_email_address@domain.invalid wrote:

http://localhost:3000.

be taken care of by my newly created controllers. For instance, I

Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Thom/ange
http://ange.librium.org


#9

This should pretty much work.
http://www.zedshaw.com/projects/scgi_rails/

Neither did I have much trouble getting fcgi to work on winxp + apache2.
Well… maybe i did have to go through much trouble, but i succeeded.
However I’m not sure what guide i used. I’ve bookmarked both
http://electricvisions.com/rails.html and
http://dema.ruby.com.br/articles/2005/08/23/taming-fastcgi-apache2-on-windows.

Anyway, nowadays I don’t bother using apache anymore. My target machine
is linux anyway, and radrails integration of webrick suits me well
enough for development.


#10

On Fri, 2005-12-16 at 23:00 +0100, John S. wrote:

And to Jamie. I will have to try what you indicated. I had been using
http://localhost/rubytest/mytest w/o the underscore as I was following
along with this ->
http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=2 <-
tutorial which did not have it. If this works then all my frustrations
were not the result of RoR but of a typo in a relatively old tutorial
(and I apologize if this is the case).

Heh, his links and screenshots disagree on what the URL should be, and
it wouldn’t surprise me if things have changed between whatever version
of Rails he’s using and the current version.

If you want to look at some of the magic transforms that rails does,
look up Inflector in the docs.

  • Jamie

#11

I’ll point you both to
http://wiki.rubyonrails.com/rails/pages/HowtoSetupIIS
It is possible to setup rails with windows with no apache/cygwin/unix
type things of anything.

I will say that setting up IIS to talk to rails is a process of trial
and error. There are a lot of little things that can go wrong, but it
does work. I’ve setup several environments with 2003 and IIS.

One thing to note. My final choice of production of env on windows was
Apache and FCGI. Setting this up is trivial compared to IIS, and seems
to be more well tested then the IIS setup.

-Nick


#12

Colin wrote:

This should pretty much work.
http://www.zedshaw.com/projects/scgi_rails/

Neither did I have much trouble getting fcgi to work on winxp + apache2.
Well… maybe i did have to go through much trouble, but i succeeded.
However I’m not sure what guide i used. I’ve bookmarked both
http://electricvisions.com/rails.html and
http://dema.ruby.com.br/articles/2005/08/23/taming-fastcgi-apache2-on-windows.

Anyway, nowadays I don’t bother using apache anymore. My target machine
is linux anyway, and radrails integration of webrick suits me well
enough for development.

Well I finally got RoR to work for the time being. I guess it was a
combonation of factors that triggered the issues I was having but I am
still not entirely sure what I did to make it work. I decided to do the
tutorial setup nearly verbatim rather than try to modify it to
accomodate my setup. I also used the url:
http://electricvisions.com/rails.html and ran the RubyForApache
installer they had (checking off fcgi only, however). Then I used the
above tip from Jamie to use my_test and not mytest and now everything
seems to work. BTW now when I use mytest I get a routing error and not
the application error.

One odd discrepancy I see between the tutorial posted here:
http://wiki.rubyonrails.com/rails/pages/Fast+CGI+and+Apache2+for+Windows+XP
is in regards to the note at the end indicating they had to add a w to
the /ruby/bin/ruby path in dispatch.fcgi. I did not have to do so.
Seems odd they would be different on superficially identical setups.

So again I thank everyone for their help, with a little coaxing I now
can try RoR out so I am happy.

If anyone wants a more thorough rundown of the exact things I did in
case they are receiving similar errors just let me know.

Thanks again,

John


#13

I’ve run Rails under IIS / sqlserver in production. The excercise
convinced all involved that:

  1. Rails is great
  2. IIS and windows in general bites donkey parts as a production
    environment to run Rails (as of a couple of months ago at least). It
    can be done, but it’s not pretty. We had to use C++ and the registry
    editor to set up the url rewriter, and that was just the start of it.
    We had scheduled tasks trashing Ruby processes every night. etc.
  3. springing a couple of grand for a new (linux) server would be
    totally worth it

we now have two webservers. The windows machine runs the database
(sqlserver has all the existing data in it). The Linux box runs Rails
applications. Setting up the iODBC brige to sqlserver was a pain, but
I’ve barely touched it since it was set up a couple of months ago;
everything Just Works now.

Apache may be ok; we had to support legacy ASP applications, and
didn’t go down that route. Implicit in the above is my recommendation
about Rails on IIS.

My advice is, if you can now or in the future, run it on one of the
platforms it was written primarily on and for.

cheers

D

On 12/17/05, John S. removed_email_address@domain.invalid wrote:

Anyway, nowadays I don’t bother using apache anymore. My target machine
above tip from Jamie to use my_test and not mytest and now everything
can try RoR out so I am happy.


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


cheers,
David L.


#14

You know, there are just some things that can’t be done. Imagine if
someone came to you and said, “Ok, you can build a boat out of
wood, but you can’t use nails, glue, straps, sealant, rudders or sails.
Go to it.” You’re just gonna build a sinking ship.

I find when such arbitrary restrictions are being made on a technology
solution it’s usually because of politics, fighting, and other
aspects of organizational culture typical of places that put more
emphasis on being right and less on evidence and cooperation. This
is especially true in government where you’re told you can’t use a
technology because it’s “not secure”, but then everyone uses telnet to
get to personnel data on the VAX.

Additionally, if these restrictions are placed by some psuedo-security
expert sysadmin type then I’m betting it’s a unilateral
decision by this one person to protect his little kingdom, and not based
on any set policy from management. If you were interested
in getting this resolved you should consider having your management
create an official security policy that outlines this very
restriction, get them to sign off on it, and then begin to enforce it on
all systems and personnel. You’ll very quickly find that the
same sysadmin who made these decisions is in direct
violation of this policy.

If this is a policy set by management, then an correctly written policy
should include provisions for an exceptional case policy so
that new technologies can be used and the organization doesn’t stagnate.
The need to adapt to changing technology is crucial,
especially when it’s possible that previously restricted technologies
could improve systems management and security.

Otherwise, you’re totally screwed. :slight_smile:

Zed A. Shaw

On Fri, Dec 16, 2005 at 08:47:14PM +0000, lester bangs wrote:

John S. <john.smith@…> writes: