SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot Dionysis's Avatar
    Join Date
    Jan 2004
    Location
    Socal
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ruby... how to setup and run.

    Hello,
    I've recently setup an apache server on my desktop with PHP, MySQL and PHPmyAdmin and it all works fine.

    I also setup Ruby on Rails and it uses its own HTTP server, WEBrick.

    1) How do i setup ruby to run as mod_ruby on apache? I've searched forums and google a bit but havn't found anything.

    2) Using WEBrick, how do i access xxx.rb files? . If i go to 127.0.0.1:3000/xxx.rb it gives an error because i'm not using the proper Rails framework (or something). For example, with apache i just go to 127.0.0.1/phpfiles/xxx.php to run a script, how do i do the same w/ ruby?

    3) Just a confirmation -- Ruby is more of a language than just for the internet? From my understanding, PHP is a web-based language but Ruby can do more than that? i'm not really clear on this. I looked through my c:/ruby directory and I'm trying to figure out how this all works...

    Any comments would be appreciated, i'm really a newbie

  2. #2
    SitePoint Zealot Dionysis's Avatar
    Join Date
    Jan 2004
    Location
    Socal
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Today I found mod_ruby but their install instructions just said

    == Installation

    (1) Type `./configure.rb' to create Makefile.
    (Type `./configure.rb --help' to get a help message.)

    (2) Type `make' to compile mod_ruby.

    (3) Type `make install' to install files.

    (4) Edit `httpd.conf'. (see examples/httpd.conf.)

    (5) Restart Apache.
    where do i type this?

    I tried IRB and regular windows command prompt. neither worked.

  3. #3
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    The installation instructions for mod_ruby that you posted look like they are for Linux.

    You need to find Windows instructions.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    FYI:

    You shoudn't be using mod_ruby for Rails apps. It's unstable and will eat small children alive.

    http://wiki.rubyonrails.com/rails/show/mod_ruby

    FastCGI is the perfered way of interfacing Rails with Apache.

  5. #5
    SitePoint Zealot Dionysis's Avatar
    Join Date
    Jan 2004
    Location
    Socal
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, for rails i was going to use WEBrick.
    for general ruby development i wanted to use mod_ruby.

    does that sound like a good way to go?

  6. #6
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dionysis
    well, for rails i was going to use WEBrick.
    for general ruby development i wanted to use mod_ruby.

    does that sound like a good way to go?
    What are you using for a production enviroment?

  7. #7
    SitePoint Zealot Dionysis's Avatar
    Join Date
    Jan 2004
    Location
    Socal
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    uhh.. context . does that count?

    maybe you can help me out here, i'm not too familiar with that stuff.

  8. #8
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, for development, you want to use Webrick, for production work, aviod apache, and use Lighttpd and fastcgi. Look into setting up the proxy modules if you have to run Apache as well as Lighttpd. For most cases, you can ditch Apache and use Lighttpd.

    Basically, rails has two main modes, Development, and Production. You can change this in ./config/database.yml if my brain serves me right. Basically production mode uses some clever cache tricks to speed things up, and hides any complex errors in your apps so there is no security compromises. Development modes make give you more detaild error messages.

    For general ruby development you don't need a webserver at all. Ruby is not like PHP, it's not tied to a specific task. However, if you are looking at GUI apps, you wanna look at some of the GUI libraries out there. Some will say Python is better for GUI apps as it compiles more, and is a tad faster, and it's fairly similar to Ruby on the surface.

  9. #9
    SitePoint Member
    Join Date
    Aug 2002
    Location
    London
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MiiJaySung
    Basically, rails has two main modes, Development, and Production. You can change this in ./config/database.yml if my brain serves me right. Basically production mode uses some clever cache tricks to speed things up, and hides any complex errors in your apps so there is no security compromises. Development modes make give you more detaild error messages.
    Very close, I think you mixed up the database configurations for the different contexts testing, development and production with the actual place where you can set the environment for production/development.

    If you're using lighttpd you'll want to set this in your lighttpd.conf for you application, or httpd.conf (or an include file if you're using a vhost setup).
    Of course the quick way is to change the line in the file config/environment.rb which reads

    Code:
     RAILS_ENV  = ENV['RAILS_ENV'] || 'development'
    Change the 'development' bit to 'production'. However I don't recommend this as it can make deploying applications one step more involved, if you can, try to set the appropriate environment variable in your web server conf.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •