Back when I first got littleredrails.com (my original domain name), my intention was to utilize a technology known as Ruby on Rails. Over the next few months, due to situations out of my control, I realized I was not going to be able to use the site for my original purposes. Eventually, I decided to record my online dating experiences and that is how this site reached its current state.
I was looking through some old documents recently and found steps I had created for myself in getting everything to work with GoDaddy (something that I found rather difficult). While this is way off-topic from my normal dating posts, I thought it might be helpful to provide the information here for anyone else struggling with the GoDaddy/Ruby on Rails combination.
One last thing before I get into the steps: I have no clue whether or not these steps will work any longer. It’s been about a over year since I wrote this and thing may have changed greatly then. Hopefully, the process has been more streamlined and these steps are no longer needed.
- On the Hosting Manager Control Panel, choose CGI Admin
- Create a Rails App directory. Leave this window open.
- On the Hosting Manager Control Panel, MySQL and select create a new database. Remember: the user name you enter will be the name of the created database.
NOTE: I’d suggest performing your database creation early on in the process. I ended up waiting on my database to exit a pending status for some time. While waiting wasn’t horrible, I was anxious to continue working.
- Download FileZilla. This is optional but the FTP steps listed here are using FileZilla.
- Connect to your site with FileZilla and copy all files located in your rails app directory. I skipped the log and tmp directory and just created these directories manually since I didn’t want to upload their contents.
- Go back to the CGI Admin window and create a symbolic link:
- In the second box click Show Rails Apps
- Select the rails app and enter a link name, such as “church” or “blog” (without the quotes). You will now be able to use website/link to access the pages.
NOTE: You cannot have a symbolic link with the same name as a directory. This caused me problems because I wanted my symbolic link to match the name of my application. What I did to get around this was I renamed my actual rails app directory and then created my symbolic link with that name. In other words, I changed the app directory from x to y and then created a symbolic link of x. This was a personal preference and not required by any means.
- If you don’t have a text editor that can do Unix line returns (or aren’t sure if you do) take the steps below. You may want to follow these anyway if you are not using a Rails IDE.
- Download and install RadRails
- Open RadRails and on the navigation pane (on the left) right-click and select New > Rails Project.
- Enter the name of the project (the same as the app)
- Uncheck “use default location” and browse to your application folder. For example, I entered
- Uncheck the Generate Skeleton option and the Create WEBrick server option (assuming you already have a rails project to deploy, these options are unnecessary).
- Click Finish
- On the toolbar, select Window -> Preferences.
- Expand the general tree and then select the Workspace node.
- Change the new text file line delimiter from Default to Unix and click OK.
- Open the dispatch.cgi with your UNIX line-ending-friendly text editor and replace the first line with #!/usr/local/bin/ruby
NOTE: On the GoDaddy help page they say to replace this line with #!/usr/local/bin/ruby/ (trailing slash). When I tried this, my application would fail to load (this is as of 8/8/06) so I removed the trailing slash and things worked fine. Some experimentation may be required.
- Follow the previous step with the dispatch.fcgi and the dispatch.rb files. I’ve not found anything that states this is necessary with the dispatch.rb but I’m updating it just in case.
NOTE: Editing files requires Unix line returns which is why RadRails was suggested. If you use an editor that uses Windows line returns you will get an error something like:
The application failing to start”.
- Upload the updated dispatch.cgi, dispatch.fcgi and dispatch.rb to the rails application public directory.
- Right click on each of these files and choose file attributes. Be sure the numeric value for each is 755.
- Go back to the MySQL option in the Hosting Manager control panel. Click the edit button and write down the name of your SQL server. It will be something like mysql123.secureserver.net
- Edit your app_name/config/database.yml to contain the following:
Be sure to upload this file once changed.
- At this point, you should be able to test your rails application by browsing to yourwebsite.com/symbolic_folder/controller/action (or whatever, depending on your routes). You can also browse to yourwebsite.com/app_name/public/controller/action if not using a symbolic link. While this will likely fail due to missing data the type of error you get can give you an idea of if you’re almost there. If you get an error about not being able to start the rails application then you have problems. If you get a general Rails Application error (the 500.html I think) or no error at all, you’re looking good.
- At a command line, run: mysqldump development_db > textfile.txt. This will place all data from your development environment into a text file.
- Under the Hosting Manager Control Panel, choose MySQL and then OpenManager for your database and log in.
NOTE:For the life of me, I could not get logged in under FireFox. Perhaps this is some restrictive setting I’ve accidentally set – I’ve not yet been able to determine the cause. I switched to IE and was able to log in – just something to keep in mind if you’re running FireFox.
- Click databases and then on the next screen click your database.
- Click on the SQL link and then copy and paste your exported SQL into the web form. I had a very large amount of data (I was importing the King James Bible) and found I needed to break my SQL scripts into about 6 runs to get everything in. Depending on the size of your data one run may be all that is require. I was doing around 5,000 inserts at a time so it can handle a good-sized load (but be patient). I tried doing all my data in one shot but the page timed-out.
- Once your data has been imported try out your site again (mywebsite.com/symbolic_link/controller/action). I was very pleased with what I saw: excluding images I was storing in blobs which I did not import, all the pages appear as expected.
Gotchas I ran into:
To really get to a point where I could get all this to work, I needed to create a new, basically empty, rails application (just ran rails testapp). The problem I was running in to was I kept getting distracted by little things related to my development application not, in 20/20 hindsight, issues related to setting up the rails app on GoDaddy.
I was never able to get this to work. Whenever switching to FastCGI (as described here), my rails app stops working all together. The page would try to load for a minute or two then just stop. That said, I’ve read of others having success.
I had some images in my public directory locally (development) and had coded these images into my layouts with just plain HTML. This caused problems when I moved to GoDaddy because the web server in this case is running one level above my rails_app folder so the src for the images was incorrect. The most correct thing to correct this (I think) is to use the rails image_tag helper. However, another way around this is to create a images directory on your GoDaddy root and place the images in there (giving public read rights to the directory).
Web Page Performance
Now, as mentioned above, I had never gotten FastCGI to work. That said, I was satisfied with the web site performance without it…but only due to my needs. My rails pages were loading in about a second in a half. That’s way slower than static pages but for my purposes (personal web site, testing of church web site, other non-critical things) it was acceptable. If you want to do anything serious, you would either need to make sure FastCGI is working or select someone more dedicated to Ruby on Rails.
While fooling around with my .htaccess file in attempts to get FastCGI working, my pages stopped applying their stylesheets. I’m not sure how I broke it, but there is a line in the .htaccess file (around line 28) that needs to be inserted if using a symbolic link. Add this line if you are having problems:
This is actually documented in the comments of the .htaccess file.
There were many frustrating points and some of the documentation leaves much to be desired. GoDaddy’s help documentation does address several of the issues. It’s just that other help documentation contains step-by-step instructions whereas the Rails documentation is more of a generalized “if you have this problem do this”. I was satisfied with the performance but have heard that this can be dependent on your shared-server load so maybe I was just really lucky. I’ve read several “horror stories” of people trying to set-up Rails on GoDaddy where they are now moving to either TextDrive or Dreamhost. Some issues like not being able to route the root web page to a controller, will make GoDaddy a poor option for the pure Ruby on Rails developer. If you’re looking for something to fool around with using Ruby on Rails with options for changing to different technologies in the future, GoDaddy will work fine. However, if you’re looking for a full-blown Rails solution with no plans to use anything but Rails, you’ll want to look into another option (or wait for GoDaddy’s Rails implementation to mature some if you are the very, very patient type of person).
Finally, as I mentioned in the beginning of this article, it has been a very long time since I’ve worked through these steps. If something is factually incorrect or just not clear, please leave a comment!
Howto – Get GoDaddy Rollin’ on Rails
GoDaddy Troubleshooting Guide (Ruby on Rails)
Update May 2010: A quick note that I’ve moved away from GoDaddy to HostGator so I won’t be able to verify anything in this post going forward. I am very happy with my move and if you’re interested in the differences see this write-up on why I moved to HostGator.