New tutorial: Westhost on Rails

I have been hosting on WestHost for a little over four years now with no major complaints and I also host the majority of my clients there. They offer a lot of options for very little money and are always adding new features to the accounts. Unfortunately, Ruby on Rails is not one of them… yet.

As I have begun working a bit more with Rails, I have been looking to get it installed on my server (as well as some of my clients’). One of the major half-truths of Rails evangelism is the ease of install, especially with a host running Apache 1.3. After doing a few rather painful installs myself for some new projects, I finally decided to document the process of installing Ruby on Rails at WestHost for my own knowledge and to help any others who may be trying to do the same. Hopefully, WestHost will soon start to offer Rails installs as part of their hosting packages, but, until then, I offer up this humble tutorial.

Update 2006-04-14: WestHost has announced that Rails will be available for install via the Site Manager some time this month, making my tutorial unnecessary.

13 Responses to “New tutorial: Westhost on Rails”

  1. Nate Parsons Says:

    Thank you so much for putting this together!!! I found it to be incredibly helpful in getting rails installed and rolling on my own westhost account! Thanks!!!

    November 20th, 2005 at 4:13 pm
  2. Steve Says:

    I’m getting an error when I do the ‘ruby script/server’ command. Has anyone seen this?

    [2005-11-26 21:22:07] WARN  TCPServer Error: Address already in use - bind(2)
    /usr/local/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
    from /usr/local/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners'
    from /usr/local/ruby/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners'
    from /usr/local/ruby/lib/ruby/1.8/webrick/server.rb:75:in `listen'
    from /usr/local/ruby/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
    from /usr/local/ruby/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/webrick_server.rb:61:in `dispatch'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/commands/servers/webrick.rb:59
    from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:214:in `require'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/commands/server.rb:28
    from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:214:in `require'
    from script/server:3
    November 26th, 2005 at 11:23 pm
  3. Aaron Says:

    I’m certainly not an expert, but it looks like the WEBrick server is trying to use a port that is already in use. Do you already have an instance of WEBrick running? If that’s not it, you can try seeing what else may be running on port 3000.

    November 27th, 2005 at 4:12 pm
  4. Ronak Patel Says:

    I have multiple domains pointing to different directories, with for example defaultdomain.com being the domain my westhost account was created with. It is in /var/www/html. Now I installed the demo in the tutorial under demo.anotherdomain.com.

    I have everything up and running fine. The only problem now is when I go to defaultdomain.com, I am shown the Ruby on Rails default page. All I want Ruby to point to is demo.anotherdomain.com, but it seems like it has taken over my default domain also.

    What can I do? Does it have something to do with the VirtualHosts in httpd.conf? Thanks!

    December 8th, 2005 at 4:20 pm
  5. Aaron Says:

    Without the full story (and access to your box), my best guess is that you installed your Rails app in /var/www/html/ which is why you are seeing it as the default. To accomplish what I think you want, it seems like you need to do the following

    • create a new directory for your Rails install (/var/www/rails or some such),
    • use the WestHost Site Manager to add the “demo” hostname to your “anotherdomain.com” DNS record,
    • point the “demo” hostname at the newly created directory (/var/www/rails), and then
    • fix your defaultdomain.com directory.
    December 8th, 2005 at 10:04 pm
  6. Ronak Patel Says:

    Hmm. Rails was already installed to another directory /var/www/demo. That directory is already pointing to demo.anotherdomain.com which was created with the Site Manager.

    December 8th, 2005 at 10:46 pm
  7. Ronak Patel Says:

    If I access www.defaultdomain.com, everything is fine. But if I access defaultdomain.com I get the Ruby page.

    Also, have you run into any problems after installing the mysql gem? My wordpress install is no longer connecting to the mysql database.

    On a side note, thanks for putting together an awesome tutorial!

    December 8th, 2005 at 11:07 pm
  8. Aaron Says:

    Take another look at your Domain Management tab in the Site Manager. There is a default directory for the domain (listed in the table at the bottom of the Domain Management page) and then you can click through to the domain itself via the top listing to modify the hostnames for that domain. My guess is that your domain and your www hostname are not pointing to the same place.

    As for your WordPress problem, I’m not sure what the issue is. There should be no conflict and I run WordPress and Rails together on the same box (this one) with no problems. I would check your database connection settings.

    December 9th, 2005 at 8:57 am
  9. Ronak Patel Says:

    The WordPress database problem has seemed to fix itself…

    I’ve triple checked my domain setup and I don’t see any problems. What’s odd is that “www.defaultdomain.com” works fine where as “defaultdomain.com” shows the ruby page. Additionally, this problem occurred after installing RoR and Fastcgi. I’ll keep looking around and going though httpd.conf. Maybe i’ll spot something. Thanks for your help!

    December 10th, 2005 at 10:34 pm
  10. Mark J Musante Says:

    Thank you for creating this Westhost on Rails tutorial. I just successfully set up my first rails development environment with your help. The only thing I needed to change was this line:

    AddHandler fastcgi-script fcg fcgi fpl

    For some reason, apache needed the . character before the suffixes:

    AddHandler fastcgi-script .fcg .fcgi .fpl

    Without them, my browser would sit forever loading the page, and the server logs showed a timeout response.

    Thanks again.

    December 22nd, 2005 at 8:55 am
  11. Roberto Mason Says:

    I have a question. What happens if you want to ruby to use a remote mysql server. At home I’m running MYSQL 4.1.12-1. I’ve been unable to connect to that server.

    March 29th, 2006 at 1:15 pm
  12. Aaron Says:

    I’m not sure I can really help you troubleshoot that one, but I would check to see if there is anything in your network setup/firewall/etc. that could be holding you back.

    I believe MySQL can be set up to limit connections to only those that originate from the local machine (localhost). I know it asks you if you want to allow remote access when you install MySQL at WestHost, but I’ve not played with it in my own installations. Pehaps that is the root of the problem?

    Beyond that, I don’t think I can help you, sorry.

    March 29th, 2006 at 1:36 pm
  13. Ben Says:

    RoR is now available to install from “Site Applications” in your site manager. Hooray. Now if only there was a guide on how to deploy a rails app on Westhost. Hint hint.

    May 16th, 2006 at 12:04 am