Running rails on a shared GoDaddy account (a.k.a. "Digital Masochism")
September 14th, 2007
Okay, I’ve been running a sample app on GoDaddy for approximately a little over year now. It started out as a quick way for a group of friends to identify movies in a picture….It was one of those time wasting things you do on a Friday….or Monday or whenever I guess. Since then, I had posted that I was able to get a rails app up and running on GoDaddy and provided a link to the sample app and it’s received a fair amount of traffic, but people are still trying to get it to work for them.
So here it is…Hitchhikers Guide To GoDaddy Rails!
First off, let’s create a new rails app
c:\sites>rails GoDaddyTest
Switch to the GoDaddyTest directory. Let’s edit the Dispatch.cgi and Dispatch.fcgi files in the public directory so that they point to the right ruby interpreter. Edit the first line of both files to read like so:
#!/usr/local/bin/ruby
Edit the .htaccess file in the public directory next. Find the line that reads
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
and change it to read
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
This makes GoDaddy use FCGI to run your app. Believe me, you’ll never ever ever want to use CGI on GoDaddy to run a rails app. EVER!
Exit back out of your editor and freeze rails in your app. This is pretty important because GoDaddy is running a very old version of rails.
c:\sites\GoDaddyTest>rake rails:freeze:edge TAG=rel_1-2-3
Lots of scrolling text will fly past you and your rails will be frozen to your app.
For simplicity’s sake, we’re not going to implement a database in this sample app. It’s pretty straight forward if you need a database, edit the database.yml file like so:
production: adapter: mysql database: xxxxxxxx username: xxxxxxxx password: xxxxxxx port: 3306 host: mysqlXXXX.secureserver.net
You can get your database host name from your GoDaddy control panel.
Back to our guide though….let’s create a controller now.
c:\sites\GoDaddyTest\ruby script\generate controller Say hello goodbye pardon
The ole’ say controller…..straight from every beginning rails tutorial :) At this point, you might want to run the local server and see that everything works as expected on your development machine.
Now to the meat of the post. Fire up your Firefox (you are using Firefox, right?) and log into the GoDaddy site. Navigate to your Hosting account page and verify that you have at least the Deluxe package and your on a Linux account. Rails will not work on the GoDaddy Windows servers.
From there, goto the CGI Admin app. Create a rails application directory. This only needs to be done once and you can put as many rails apps in that directory as you want to. Pick whatever name you want to like

Next we upload the site into a subdirectory of your rails app directory. In our example we’d upload into the ‘my_rails_apps’ directory. Start the ftp process and then go get a cup of coffee. Change the oil in your car. Get a haircut. By the time you get back, you should be able to watch the last file upload.
Now, go back to the CGI admin page and create a symbolic link. This creates a link in the root of your site so that people can access your site via url like http://www.mycoolsite.com/my_rails_app versus having to access it like http://www.mycoolsite.com/my_rails_app/my_rails_app

Go ahead….click that ‘Show Rails Applications’ link. If you’ve uploaded your app, it will automagically appear in the list. Select our application my_rails_apps/GoDaddyTest and give it a cool name like superbad. Now let’s try out the application. http://www.mydomain.com/superbad/ <—don’t forget the trailing slash!!

Success!!! Let’s break out the champagne! We’re going public! Now let’s check some of our actions. http://www.mydomain.com/superbad/say/hello

KAAAAAHHHHHHHHNNNNNNNNNNN!!!!!!! So put the champagne cork back in and let’s figure out what’s gone wrong. Actually, I know what’s gone wrong, but I’ll give you a few minutes to ponder it.
Okay, figured it out yet? Not yet? Don’t feel bad, having an average IQ isn’t the end of the world. It’s a permissions issue. Windows doesn’t like dealing with Unix permissions. Hopefully your ftp client allows you to change execute permissions. Navigate to the public directory of your rails app on the server. From our example, that would be /my_rails_apps/GoDaddyTest/public/. If you’re using FileZilla, which I am, you can set them pretty easy. Highlight dispatch.fcgi and right click.

Go ahead and set execute on all of the levels.

now, do the same for the dispatch.rb file, and if you’re particularly masochistic, do the same for dispatch.cgi. Back to the browser and check http://www.mydomain.com/superbad/say/hello

Woohoo! Uncork that champagne again, pat yourself on the back, pat the dog, pat Pat…..you’ve successfully deployed your application on one of the slowest Rails providers in the known universe.
After you play with it a while and decide that hey, my sites’ for senior citizens and this should be fast enough for them, experiment with setting up domain pointers so that you can access the site via http://www.myalternatedomain.com/say/hello
4 Responses to “Running rails on a shared GoDaddy account (a.k.a. "Digital Masochism")”
Sorry, comments are closed for this article.
September 21st, 2007 at 06:25 AM This is exactly what I was looking for. I have only one problem with the entire thing. Everything works correctly, my shebang lines are correct, I have Unix line endings, I transferred in ASCII mode, I am using dispatch.fcgi, all my files have the right permissions, my .htaccess files in both public and the one above it both are setup correctly, and I have no errors in my error log. Now having said that. My site won't render any of my pages. What's the deal?
September 21st, 2007 at 06:25 AM This is exactly what I was looking for. I have only one problem with the entire thing. Everything works correctly, my shebang lines are correct, I have Unix line endings, I transferred in ASCII mode, I am using dispatch.fcgi, all my files have the right permissions, my .htaccess files in both public and the one above it both are setup correctly, and I have no errors in my error log. Now having said that. My site won't render any of my pages. What's the deal? It's just a blank page on anything I try and load.
September 21st, 2007 at 01:52 PM Zach, usually a white screen means that dispatch.fcgi isn't being called. Try to load your web site while watching your fcgi processes. If you don't see the dispatch process spawning, you should check all the paths again. If you want, you can email me your .htaccess and dispatch.fcgi and I could maybe diagnose this. Also, you might want to try deploying a very simple app like the one above just to make sure there's nothing wrong with your godaddy account. marlon at mcmoyer dot com
May 13th, 2008 at 03:58 AM Hi Marlon, Would you be able to help me if I send you my htaccess and dispatch.fcgi? I am having the same issue, I get a blank page no matter what. Thanks!