Rails on GoDaddy

I decided to play with Ruby on Rails a little more and was just reminded of the painful process to get Rails working at GoDaddy.

First, you can have Java or Rails, but not both. But as I posted earlier, Java is near useless at GoDaddy anyway.

So, the key steps to getting your Ruby on Rails app deployed at GoDaddy are:

Setup at GoDaddy:
1. Log in to the GoDaddy Hosting Control Center
2. Make sure Java is disabled (under Language Options). If it is enabled, you can't deploy a Rails application. Change the setting to none (and you'll need to wait 24 hours for your site(s) to be moved to a new server).
3. Log into the CGI control panel and create a Rails application directory.
4. Create a symbolic link to your newly created rails directory.

Local Edits:
1. Freeze your gems: `rake rails:freeze:gems`
2. Edit your dispatch.* files to reference #!/usr/local/bin/ruby

Upload:
1. Upload your rails application to the rails directory.
2. Chmod the dispatch.* files to 755 (in FileZilla, right click and select File Attributes).
3. Wait. GoDaddy won't recognized new .htaccess files for about an hour, so go do something else and come back later.

Test:
1. Test your app. Hopefully it works. If not, good luck. A couple things you can try:
1a. Enable your Error Log in the hosting control panel, wait an hour, try again and view your log file in the CGI control panel.
1b. Download the /log/production.log log file.
2. Change to FastCGI. Update your .htaccess file and change the dispatch.cgi reference to dispatch.fcgi.

I omitted the DB setup. You'll need to create a database using the control panel and update your database.yml file with the appropriate information.

It isn't great, but if you already have GoDaddy hosting, it is workable.

8 comments:

  1. the godaddy DB's run really well with Rails since they are on separate servers unlike most shared plans. But they serve your app up reaaaaallly slloooooooow when it first loads. PLUS it was a royal pain to get SVN working right.

    I'd go with asmallorange.com if you want to play around. even the $5 a month plan can host a small rails app. svn is set up already, and the are really cool about installing any gems you may need.

    ReplyDelete
  2. I'm a rails noob, trying to install my first (practice) app onto my go daddy server - I have got it to the point where it at least shows the RoR welcome screen, but I have no idea how to access the development environment (so i can freeze gems, run rake etc). I have a 'deluxe hosting account', but it isn't on a virtual dedicated server or anything, so as far as I know I can't connect remotely... or can I? Any help would be great, or have I missed the point completely? Thanks in advance for any help you might be able to provide.

    ReplyDelete
  3. You can't actually DO anything at GoDaddy with Rails. To freeze gems, you need to do that in your local development environment and then FTP everything up to GoDaddy.

    ReplyDelete
  4. Thanks Eric, I had a feeling that was the case

    ReplyDelete
  5. All great information. This has been the most useful information I have been able to find about getting started with Rails at Godaddy as they were of little help to me.

    I do have a couple of questions though that may expose my lack of knowledge, but I am hoping that they are easy to answer.

    1. I understand that I can't "log in" to run scripts, so then how do I do start script/server to run the application? And what webserver is running at Godaddy by default?

    2. How do I perform db:migrate and such for upgrades?

    Any help here would be greatly appreciated.

    ~Brad

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. 1. They run Apache, and they have it is configured based on your .htaccess files. The servers are 'always' running so there are no issues, but you can control the cgi processes using the script control panel.

    2. I'm not sure. I think I just did a backup from MySQL and ran the restore script using their db access tool.

    ReplyDelete
  8. Can anyone provide a sample running app. I've followed all the advice of both GoDaddy and all the articles, and can't even get an index.html file to show up from within my public directory. GoDaddy says that they've checked the server and it's working, so I must have a bad script file.

    ReplyDelete