Hello, I have tried to setup Ruby-on-rails on my debian Linux machine and can not get it to run. Maybe someone can help. The following was installed already: - apache2 2.0.54 (and PHP5) - Postgresql 8.1 Now, having the ''unstable'' branch in my /etc/apt/sources.list I did: apt-get install libapache2-mod-ruby and Apache reports a "mod_ruby/1.2.4 Ruby/1.8.4" successfully. Then: apt-get install rails that finished without errors (installing ruby 1.8.3 on the way). What follows gave me a deja-vu of Lotus Domino: Lots of helpful people writing lots of helpful hints in lots of places, nicely linked to other helpful sites - but no one willing to take over the responsibility for a complete, consistent documentation. In detail: This site: http://wiki.rubyonrails.com/rails/pages/Tutorial gives an "Apache configuration example for Apache 2" that I put into my apache2.conf (debian equivalent to httpd.conf). Also I configured mod_ruby according to http://wiki.modruby.net/en/?InstallGuide This seems to configure apache to accept .rbx files as ruby-executables, right? (I later changed that to .rb without success.) Now rails was installed to /usr/share/rails - in order to access this from my DocumentRoot /var/www/ I moved that to /var/www/ruby/rails Then apache2.conf was set up with: <Directory /var/www/ruby/> Options ExecCGI SymLinksIfOwnerMatch AddHandler cgi-script .cgi ... </Directory> The tutorial nows says ''Go to http://rails/ .. and check that you get the “Congratulations, you’re on Rails!” screen.'' You guessed right, that didn''t come up (my path being myhost://ruby/rails). Now I don''t see what script (index.rb? where?) should bring up this message. So I stepped back from getting rails to work and decided to see mod_ruby work at first: On http://www.rubycentral.com/book/web.html I found a simple "hello world" script and put that into /var/www/ruby/index.rb - but this brings up just the source code, the same with an index.rbx . At this point I would believe apache expected something like a: ''AddType application .. .rb'' (or .rbx ..) in a place like /etc/apache2/mods-enabled/ruby.conf . Now ruby.load exists there and works as we have seen (LoadModule ruby_module ..) - but not ruby.conf. Should this be added manually (alternatively in apache2.conf)? Or does rails (on Debian) have a different way to configure apache2 to understand what to do with .rb (or whatever ruby-)files? Or maybe the Debian ''rails'' package is not meant to be installed together with mod_ruby and works only with fast-CGI? Thanks for hints ! // Bernd -- Posted via http://www.ruby-forum.com/.
Hi! Are you new to rails? So , why don''t ou first use WebBrick to develop, and after this try to setup apache with ruby? Theres no configuration point to /usr/share/rails . You first need to create an rails application, running the command # cd /var/www # rails ruby (or another name that you want) This installs rails to you on /var/www/ruby. After this, you can try and go to http://localhost/ruby . I hope it works, sometimes you need to install more packages. But if you just want to play with rails, at directory /var/www/ruby run # ./script/server Then go to http://localhost:3000 , and you will see the welcome page of rails. Then, you can start to play! After, when you really go use apache, you will want to use fastcgi, that is really better than mod_ruby. I hope this helps you, filipe Em Qua, 2005-12-14 às 23:59 +0100, Bernd vdB escreveu:> Hello, > I have tried to setup Ruby-on-rails on my debian Linux machine and can > not get it to run. Maybe someone can help. > > The following was installed already: > > - apache2 2.0.54 (and PHP5) > - Postgresql 8.1 > > Now, having the ''unstable'' branch in my /etc/apt/sources.list I did: > > apt-get install libapache2-mod-ruby > > and Apache reports a "mod_ruby/1.2.4 Ruby/1.8.4" successfully. Then: > > apt-get install rails > > that finished without errors (installing ruby 1.8.3 on the way). > > What follows gave me a deja-vu of Lotus Domino: Lots of helpful people > writing lots of helpful hints in lots of places, nicely linked to other > helpful sites - but no one willing to take over the responsibility for a > complete, consistent documentation. In detail: > > This site: http://wiki.rubyonrails.com/rails/pages/Tutorial gives an > "Apache configuration example for Apache 2" that I put into my > apache2.conf (debian equivalent to httpd.conf). > Also I configured mod_ruby according to > http://wiki.modruby.net/en/?InstallGuide > > This seems to configure apache to accept .rbx files as ruby-executables, > right? (I later changed that to .rb without success.) > > Now rails was installed to /usr/share/rails - in order to access this > from my DocumentRoot /var/www/ I moved that to /var/www/ruby/rails > Then apache2.conf was set up with: > <Directory /var/www/ruby/> > Options ExecCGI SymLinksIfOwnerMatch > AddHandler cgi-script .cgi > ... > </Directory> > > The tutorial nows says ''Go to http://rails/ .. and check that you get > the “Congratulations, you’re on Rails!” screen.'' > You guessed right, that didn''t come up (my path being > myhost://ruby/rails). > Now I don''t see what script (index.rb? where?) should bring up this > message. > So I stepped back from getting rails to work and decided to see mod_ruby > work at first: On > http://www.rubycentral.com/book/web.html > I found a simple "hello world" script and put that into > /var/www/ruby/index.rb - but this brings up just the source code, the > same with an index.rbx . > > At this point I would believe apache expected something like a: > ''AddType application .. .rb'' (or .rbx ..) > in a place like /etc/apache2/mods-enabled/ruby.conf . > Now ruby.load exists there and works as we have seen (LoadModule > ruby_module ..) - but not ruby.conf. > Should this be added manually (alternatively in apache2.conf)? > Or does rails (on Debian) have a different way to configure apache2 to > understand what to do with .rb (or whatever ruby-)files? > Or maybe the Debian ''rails'' package is not meant to be installed > together with mod_ruby and works only with fast-CGI? > > Thanks for hints ! > // Bernd >
On Wed, 2005-12-14 at 23:59 +0100, Bernd vdB wrote:> Hello, > I have tried to setup Ruby-on-rails on my debian Linux machine and can > not get it to run. Maybe someone can help.*snip* debian, which we know and love, has a completely different package system than other linux distros, as I am sure you know. This means that the traditional means of installing rails through ruby-gems (ruby''s package system) will not work out-of-the-box. Furthermore I am unsure if you can enable rails solely through mod_ruby, I think you need to drop into apt-get first. On my Ubuntu (Warty) system I had to apt-get a bunch of other packages, like libyaml-ruby and libzlib-ruby before I could get gems installed. I managed to get gems installed and rails installed but rails is now complaining when I try to build it. People on this list have advised that I compile ruby from scratch instead. That seems unnecessary, but perhaps the only route. I will try to stay in touch and maybe we can find and develop some more resources for debian / ubuntu types who are insterested in ruby and rails, since rails is popular and so is debian. Regards, Jeremiah -- ------ Jeremiah Foster jeremiah-plrWv6UuuhSN7grqwE105A@public.gmane.org
Christophe Vigny
2005-Dec-15 09:46 UTC
Re: Install problems: R-o-R on Debian with mod_ruby
Hi, Filipe Lautert wrote: ...> Are you new to rails? So , why don''t ou first use WebBrick to develop, > and after this try to setup apache with ruby?I have no doubt that r-o-r is a powerful web-app framework. What I evaluate now is precisely the way to set it up, maintain and use it on a live webserver, based on apache and mod_ruby.> > Theres no configuration point to /usr/share/rails . You first need to > create an rails application, running the command > ... > # rails ruby (or another name that you want)Great, this worked (created a couple of subdirs/files under ruby/)> This installs rails to you on /var/www/ruby. After this, you can try and > go to http://localhost/ruby .This gives a 500 server error (as mentioned on the mod_ruby site). Because, once again, there is no index.rb or something like it in /ruby - so I tried: http://myhost/ruby/public/ Which brings a: Application error - Rails application failed to start properly Looks like at least some sort of ruby code hab been activated - but no, it''s just a different errorDocument 500 out of .htaccess ... Anybody out there with mod_ruby experience?> ... if you just want to play with rails, at directory /var/www/ruby run > # ./script/server > > Then go to http://localhost:3000 , and you will see the welcome page of > rails. Then, you can start to play!This works, so it''s a webserver running on ruby, right? Nice, but I would like to get apache/mod_ruby working ..> After, when you really go use apache, you will want to use fastcgi, that > is really better than mod_ruby.Why? mod_ruby is going to start faster than (any) CGI, that''s why it is considered first choice for life web-apps. At least this is the wisdom for perl, python etc. Any references about this question? -- Posted via http://www.ruby-forum.com/.
Jeremiah Foster wrote: ...> debian, which we know and love, has a completely different package > system than other linux distros, as I am sure you know.Sure. Still, the maintainer of the debian rails package should have had some idea of what he is doing.> This means that > the traditional means of installing rails through ruby-gems (ruby''s > package system) will not work out-of-the-box.Fine, I didn''t even try this.> Furthermore I am unsure if > you can enable rails solely through mod_ruby, I think you need to drop > into apt-get first.Please read my post. After ''apt-get mod_ruby'' I did ''apt-get rails'' - without errors.> ... maybe we can find and develop some more > resources for debian / ubuntu types who are insterested in ruby and > rails, since rails is popular and so is debian.The debian rails package exists - what is missing is a complete documentation for it - i.e. considering fastCGI as well as mod_ruby variants. -- Posted via http://www.ruby-forum.com/.
Christophe Vigny wrote:> .. here how to setup ror on a debian 3.1 : > ... > dowload ruby gem. > run setup.rb > > gem install rake --include-dependencies --http-proxy ourproxy > ... > apt-get install libapache2-mod-fastcgi > ... > fastcgi.conf : > ...Ok, so you opted for a completely different setup. Unfortunately, this doesn''t help me. -- Posted via http://www.ruby-forum.com/.
> Why? mod_ruby is going to start faster than (any) CGI, that''s why it > is > considered first choice for life web-apps. At least this is the wisdom > for perl, python etc. Any references about this question?Well, was just a sugestion. You can take a look at http://blog.shugo.net/articles/2005/08/04/mod_ruby-vs-fastcgi-on-rails , This can help to take a decision. filipe
Jeremiah Foster
2005-Dec-15 12:58 UTC
Re: Re: Install problems: R-o-R on Debian with mod_ruby
On Thu, 2005-12-15 at 12:09 +0100, Bernd vdB wrote:> Jeremiah Foster wrote: > ... > > debian, which we know and love, has a completely different package > > system than other linux distros, as I am sure you know. > > Sure. Still, the maintainer of the debian rails package should have had > some idea of what he is doing.Of course they know what they are doing. Because you can''t get it to work do not blame the maintainer.> > This means that > > the traditional means of installing rails through ruby-gems (ruby''s > > package system) will not work out-of-the-box. > > Fine, I didn''t even try this.Well . . .maybe you should. I think you are really confusing rails with mod_ruby. Look more closely at both packages to discern the differences.> > Furthermore I am unsure if > > you can enable rails solely through mod_ruby, I think you need to drop > > into apt-get first. > > Please read my post. > After ''apt-get mod_ruby'' I did ''apt-get rails'' - without errors.The point is why did you do that?> > > ... maybe we can find and develop some more > > resources for debian / ubuntu types who are insterested in ruby and > > rails, since rails is popular and so is debian. > > The debian rails package exists - what is missing is a complete > documentation for it - i.e. considering fastCGI as well as mod_ruby > variants.Maybe you can write that. -- ------ Jeremiah Foster jeremiah-plrWv6UuuhSN7grqwE105A@public.gmane.org
Hello Jeremiah, sorry I did not mean to insult anybody - but basically I am looking for someone who knows about mod_ruby and r-o-r and not for a discussion on my posting style. Jeremiah Foster wrote:> ... Because you can''t get it to work do not blame the maintainer.I am not blaming him, just asking (someone) for explanation how this is supposed to work.>> > .. ruby-gems (ruby''s package system) ... >> >> Fine, I didn''t even try this. > > Well . . .maybe you should.No, a ruby package manager will not solve the problem that is connected to mod_ruby.>> Please read my post. >> After ''apt-get mod_ruby'' I did ''apt-get rails'' - without errors. > > The point is why did you do that?No, this is not the point of this thread. But, once again: I did it because I want to find out about r-o-r-with-mod_ruby.>> ... - what is missing is a complete documentation for it - ... > > Maybe you can write that.Yes, after I understand how it''s meant to work. This is why I was asking here. -- Posted via http://www.ruby-forum.com/.
Ken Bowley
2005-Dec-15 15:22 UTC
Re: Re: Re: Install problems: R-o-R on Debian with mod_ruby
Hello Bernd, It''s not that there is a lack of documentation, it seems to be that you are refusing to look at it. After creating your rails app with something like `rails [myapp]`, read the README file that is created, and use the example for apache to help you configure apache for your rails app. The main thing is that you want apache to point at the `public` directory in your rails app. One you have this working, you can edit the .htaccess file in the public directory to choose which dispatcher you would like to use (cgi, fastcgi, or mod_ruby). I hope this helps. Ken...
Bernd vdB
2005-Dec-15 16:24 UTC
Re: Re: Re: Install problems: R-o-R on Debian with mod_ruby
Ken Bowley wrote: ...> It''s not that there is a lack of documentation, it seems to be that you > are refusing to look at it.Hm, sorry, but I read everything that I found on the issue. But I found no details about the combination of r-o-r and mod_ruby. Thats why I''m asking here.> After creating your rails app with something like `rails [myapp]`, read > the README file that is created, and use the example for apache to help > you configure apache for your rails app. The main thing is that you > want apache to point at the `public` directory in your rails app.I read that and did everything ok, as far as I can see. Still, going to http://myhost/ruby brings a 500 Error - the one that is mentioned here: http://wiki.modruby.net/en/?InstallGuide Only the solution from there (''RedirectMatch ..'') is not applicable because an ''index.rb'' does not exist in /ruby or elsewhere. Is there a test.rb or something similar somewhere in the r-o-r tree?> One you have this working, you can edit the .htaccess file in the public > directory to choose which dispatcher you would like to use (cgi, > fastcgi, or mod_ruby).Ok, what would I write into that for mod_ruby ? Thanks ! // Bernd -- Posted via http://www.ruby-forum.com/.
Ken Bowley
2005-Dec-15 17:00 UTC
Re: Re: Re: Re: Install problems: R-o-R on Debian with mod_ruby
On Thu, 15 Dec 2005, Bernd vdB wrote:> I read that and did everything ok, as far as I can see. > Still, going to http://myhost/ruby brings a 500 Error - the one that is > mentioned here: > http://wiki.modruby.net/en/?InstallGuide > > Only the solution from there (''RedirectMatch ..'') is not applicable > because an ''index.rb'' does not exist in /ruby or elsewhere. > > Is there a test.rb or something similar somewhere in the r-o-r tree?If you look in the public/.htaccess file, you will see a line that looks like this: RewriteRule ^(.*)$ dispatch.cgi [QSA,L] .. change this to look like this: RewriteRule ^(.*)$ dispatch.rb [QSA,L] As a disclaimer, I don''t use mod_ruby with rails. I do run Debian (sid and testing) with apache and apache2 on different machines, but use fastcgi. I also use webrick for local development before deploying on an apache server. Let me know if this still doesn''t work for you, and I will see if I can set up rails with mod_ruby on my development machine to confirm that it works. Ken...
Ezra Zygmuntowicz
2005-Dec-15 17:33 UTC
Re: mod_ruby ? / Re: Install problems: R-o-R on Debian ..
On Dec 15, 2005, at 2:59 AM, Bernd vdB wrote:> Hi, > Filipe Lautert wrote: > ... >> Are you new to rails? So , why don''t ou first use WebBrick to >> develop, >> and after this try to setup apache with ruby? > > I have no doubt that r-o-r is a powerful web-app framework. > What I evaluate now is precisely the way to set it up, maintain and > use > it on a live webserver, based on apache and mod_ruby. > >> >> Theres no configuration point to /usr/share/rails . You first need to >> create an rails application, running the command >> ... >> # rails ruby (or another name that you want) > > Great, this worked (created a couple of subdirs/files under ruby/) > >> This installs rails to you on /var/www/ruby. After this, you can >> try and >> go to http://localhost/ruby . > > This gives a 500 server error (as mentioned on the mod_ruby site). > Because, once again, there is no index.rb or something like it in / > ruby > - so I tried: > http://myhost/ruby/public/ > > Which brings a: > Application error - Rails application failed to start properly > > Looks like at least some sort of ruby code hab been activated - but > no, > it''s just a different errorDocument 500 out of .htaccess ... > > Anybody out there with mod_ruby experience? > > >> ... if you just want to play with rails, at directory /var/www/ >> ruby run >> # ./script/server >> >> Then go to http://localhost:3000 , and you will see the welcome >> page of >> rails. Then, you can start to play! > > This works, so it''s a webserver running on ruby, right? > Nice, but I would like to get apache/mod_ruby working .. > >> After, when you really go use apache, you will want to use >> fastcgi, that >> is really better than mod_ruby. > > Why? mod_ruby is going to start faster than (any) CGI, that''s why > it is > considered first choice for life web-apps. At least this is the wisdom > for perl, python etc. Any references about this question?The main drawback of mod_ruby is that you cannot run 2 rails apps on the same server under mod_ruby. Rails is not exactly thread safe and mod_ruby uses one global ruby interpreter for processing requests it seems. So if you have 2 rails apps they start to infringe on each other. The preferred way to run rails applications and what they are optimized for is fastCGI. It may take a little bit longer to start up the fcgi processes when the webserver is rebooted, but fcgi runs your rails apps from persistent memory. meaning that the whole framework is loaded into memory already and requests can be processed very fast. I have set up mod_ruby and eruby before with apache before rails was out. I can tell you from personal experience that fastcgi is the way to go. FOrget about mod_ruby unless you just want to server plain ruby pages or eruby pages without rails. I don''t know of anyone that is running rails in a mod_ruby environment. FastCGI or SCGI are really the only viable options at this point. Although I have heard that the author of mod_ruby is trying to make it a viable option which would be nice, but it hasn''t happened yet. Also I and many others prefer to run our rails apps under lighttpd/ fastcgi as lighttpd is faster then apache. If you must keep apache you can set up a vhost that will proxy the requests through to a local lighttpd server running your rails app on a higher port. Good luck with whatever setup you decide to go with. But some friendly advice is to now waste your time trying to run rails under mod_ruby until a newer version comes out that addresses these issues. FastCGI is a tried and true way to run rails and it is the defacto standard. Cheers- -Ezra Zygmuntowicz Yakima Herald-Republic WebMaster http://yakimaherald.com 509-577-7732 ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org
Bernd vdB
2005-Dec-16 15:51 UTC
Re: Re: Re: Re: Install problems: R-o-R on Debian with mod_r
Hello Ken, you wrote:>> ... >> Is there a test.rb or something similar somewhere in the r-o-r tree? > > If you look in the public/.htaccess file, .. > .. change this to look like this: > > RewriteRule ^(.*)$ dispatch.rb [QSA,L]I did this, but http://myhost/ruby/public still produces the 500 Error.> As a disclaimer, I don''t use mod_ruby with rails. I ... use > fastcgi. I also use webrick for local development ...Ok, I understand Webrick IS the test for a rails installation and there is no (other) test.rb or similar script for that purpose. Thanks for your offer to debug my setup further, but after what Ezra wrote I decided to stop fighting the r-o-r-mod_ruby windmills ... So I just did: apt-get remove libapache2-mod-ruby apt-get remove rails .. cleaned my apach2.conf - and will start again next week on the ruby-fastCGI track. Should there be any problems with that I will pop up here again. Thanks for the hints everybody. // Bernd -- Posted via http://www.ruby-forum.com/.