Wednesday, July 30, 2008

Ubuntu Private Server

Although I've always dreamed big, having a GoDaddy private (dedicated) server can be expensive. Their lowest-end, cheapest server might have some pretty decent specs, but also at a whopping $63 per month with a two year contract. Although the disk space, bandwidth, and RAM all stack up well, it's much easier to get your own private server. A private server will often come with lower costs and several benefits, although you miss out on some things.

Things You Lose

  • Secure server location

  • Low chance of data loss

  • System rarely fails

  • Better network security

  • Higher power and bandwidth uptime


The tradeoffs, however, are enormous if you are on a budget. A personal dedicated server can offer lower monthly costs and tremendous long-run benefits. Plus, if you have enough skill, you can ensure that you don't lose many of the other benefits.

  • Higher beginning costs, because you have to buy the server.

  • You can always just geting something cheap to put Linux on.

  • Could use an old system lying around

  • Direct console access

  • Absolutely no limits to what you can put on there

  • Could get more bandwidth through a regular ISP

  • Lower monthly costs (merely to the ISP and for power)

  • Could make an equally secure network with enough talent

  • Could get a Universal Power Battery to keep uptime high



Wednesday, June 4, 2008

Setting up Fast CGI with GoDaddy (fcgi)

Using fastcgi on GoDaddy is paramount to getting any sort of performance with your rails application. If you're not using fast cgi, you will be waiting around 20-30 every time you hit your program with a request. Basically, nothing would work well. Changing your program's settings is as simple as modifying one line in your .htaccess file. First, go to application_name/public/.htaccess and open it in a text editor such at Notepad. Then, change the following line:
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
to
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

This will tell GoDaddy to send requests to Fast CGI, which is much faster. The first request your program gets may take up to 20 seconds, but subsequent requests come at expected speeds. Unfortunately, GoDaddy has the tendency to kill fcgi processes after about 5 minutes, and you might get the occasional error or the speed reduction at this time.

Ruby on Rails Location

One important thing to consider when trying to use Ruby on Rails with GoDaddy shared hosting is the fact that their ruby installation is not in the standard location. As a result, you will have to modify the shebang line to point to the correct spot. The default line is #!/user/bin/ruby, but you need to change this to #!/usr/local/bin/ruby to get any Ruby program to work with GoDaddy. You can find this line in the file application_name/public/dispatch.fcgi or /public/dispatch.cgi. You may want to poke around the /public folder for other places you may need to change it in.

Getting Ruby on Rails Setup

Getting Ruby on Rails setup with a GoDaddy shared hosting account is rather difficult. This blog should hopefully take you step-by-step through the installation process. Remember there are a dozen things that can break a GoDaddy rails setup, which makes installing on GoDaddy's shared servers a pain. Fortunately, though, their low prices can in many cases make up for the extra work, especially if it's a small, personal project with little-to-no budget.

Start by purchasing a GoDaddy shared hosting account, but you probably already have one. If you haven't, though, you'll have to ensure that you have a deluxe or premium account - the basic level accounts don't support cgi, perl, ruby, rails, or any of those things. You can buy three years with 20-30% off, totaling a little more than a mere $100. Remember, though, life would be a lot easier if you can afford your own server, a host that specializes in rails, or a virtual or dedicated server. I'm assuming you're already stuck with GoDaddy.

Thursday, May 29, 2008

Ever Wanted Just Ruby?

If you've ever needed just Ruby, without rails, there is a simple and effective way to do so with GoDaddy. All you need to do is to rename your program from (.rb) to (.cgi) and set Linux/Unix permissions on it to 0755 through your FTP client. This will allow your ruby program to be executed just like any php or perl cgi program on GoDaddy. Remember your first output still has to be something like

puts "content-type: text/html\n\n"