views:

1489

answers:

9

What is the best way to turn an average desktop PC into server for hosting a website using Ruby on Rails?

I am open to changing operating systems, buying parts if I need to, using whatever Database People recommend and any software.

Here are the approximate details of the computer:

The computer is an HP Desktop with 1.86GHz Duo Core CPU. Intel chipset. 1GB Ram, 200GB Hard Drive Runs on Windows XP

FYI, This is not a commercial project and this is not about saving money. I just want to pick up some new skills and I think it would be fun.

Thanks,

Jeremy

+4  A: 

While you can setup Rails on Windows, most people tend to use some flavor of Linux or BSD. The hardware you have should be more than enough for what you're asking it to do.

There are many tutorials on how to install the software you'll need. A typical stack would be Ruby, the Rails gem, MySQL (with ruby bindings and gem), Apache, and Passenger.

Slicehost, for example, has a good setup tutorial for Ubuntu. Depending on how much you want to learn about system administration, you can use a package manager to install (apt-get or aptitude on Ubuntu, for example), or compile from source.

Rails' default configuration is set up to use SQLite as the database, which requires basically no administration. If you make your site public and are getting more than a handful of users, MySQL or PostgreSQL is the next step.

Abie
+5  A: 

Just a suggestion, you could just use http://www.slicehost.com. You can buy a virtual machine with 256MB for $20/month but you build the machine from scratch after loading a base Linux distribution like Ubuntu. There are excellent instructions there on how set up your OS to do whatever you want to do.

If you really want to run a server on that machine you have though, thus saving $20/month, I would recommend installing some form of Linux. I would suggest Debian or Ubuntu. If you want to learn a bit more about some Linux fundamentals like building a kernel and tweaking .conf files (could be useful at some point) try a distribution like Gentoo. Basically download the ISO and boot it up.

If you just want to play with Ruby on Rails on that box, of course, just go to http://localhost. Furthermore, you don't even need to set up apache if you are just playing around... just use the web server built in to Rails. To be able to access that machine from anywhere in the world, if you have a static IP, get a domain name and point to that IP. If your IP is dynamic then use dyndns.org to get a dynamic host name. You can usually configure most routers to update sites like dyndns.org with your up-to-date dynamic IP.

dgrant
I found this very useful. FYI, I am not trying to save an entire 20 dollars a month. I want to try something new. Thanks for the help. Up vote for you. :)
J3r3myK
+1 for slicehost. I love em!
nezroy
I would go with linode. More ram/$, although they don't offer automatic backups yet.
Tiago
+2  A: 

Note that XP by design is limited to 10 concurrent open connections at once. This is so people need to buy the higher priced Server editions of Microsoft OSes for production servers. However, it should be fine if all you want to do is experiment.

First, you need an IP willing to give you a static IP (or get a dynamic DNS solution). DNS is what maps a URL to a IP address and a constantly changing IP address is going to give you a bunch of headaches.

Next, you need to purchase a domain and have it point to your IP. If your machine is behind a router, you need to go into the NAT settings in the router and have it forward port 80 to your machine.

Finally, you need to install some kind of web server on your local machine. If you want to work with rails, I recommend installing InstantRails which comes with the Apache web server and MySQL by default.

Once this is done, spin up InstantRails, load up a rails project and then visit your domain to see if it all works.

Shalmanese
You rock! This is very helpful. I gave you an up vote.
J3r3myK
I read that you can apply a patch to increase the number of open connections on XP. Is that true and does it work well?
J3r3myK
I believe you're talking about open TCP connections, which works. The other solution would be illegal IMO. If you want to learn something while having fun, I propose you install Slackware or any other linux distribution.
Spikolynn
A: 

On windows, first install xampp. http://www.apachefriends.org/en/xampp-windows.html (download and install: Installer 39 MB) This will install apache, php and mysql database.

Then you need to install ruby: http://peri.me/?p=73

By the end, you be running ruby on your home pc.

If you want someone other than you to access the content on the server, you would need to somehow tweek your router or computer's setting to allow access.

A: 

I like Shalmanese's answer but I would add that you need a firewall. If you have no hardware one, you need to configure your iptables in linux, which is lots of fun by itself :) Especially if you have to rebuild kernel first to have it work.

Spikolynn
A: 

you can find a lot of tutorials to setup "perfect servers" on various distros on how to forge Just search for "perfect server" on their site and you are good to go :)

Ionut Staicu
A: 

Public IP Address and a sort of Linux with Apache (Passenger or mongrel).

matiasinsaurralde
+1  A: 

EngineYard, one of the bigger Rails-based hosts, offers a VMWare image of their deployment platform that you can download from http://express.engineyard.com/

It will work the the free VMWare Player http://www.vmware.com/products/player/ which runs on WinXP.

This arrangement, which I've done several times for small and internal projects, gives you a full-featured Rails server with prebuilt deployment recipes (using the engineyard-eycap gem).

  • Download VMWare player
  • Download EngineYard Express

Boot your new server in VMWare Player and go to town.

The only hardware suggestion I'd make is to add more memory -- the VMWare image used 640mb by default and performs better with more, though it doesn't sound like performance is your concern.

What's particularly nice about this solution is that you can move to a commercial option (EngineYard Solo on Amazon EC2 or the full EngineYard offering) or roll your own with Slicehost, etc once you're comfortable with Rails. But this solution puts you in charge of the development side of things without needing to waste time on the server side.

John Paul Ashenfelter
A: 

You can run a Linux host in a virtual machine within your Windows desktop, using free software like Sun's VirtualBox or Microsoft's Virtual PC. I do this all the time to run development Linux servers for my environment, but it would work equally well for "quasi-production" hosts that you are just playing with.

nezroy