
Basic Information
Demos and Tutorials
Ruby on Rails Hosting |
Many have them installed. Not many have a clue how to support them. Learn more >> |
Top Picks>> HostingRails Overall Best Option >> DreamHost Tons of space/bandwidth >> A2Hosting Great Uptime & Live Help >> RailsPlayground Great Reliability & Support |
What is Ruby on Rails?[back to top]
|
Why develop with Ruby on Rails?[back to top]If you've ever been frustrated by spending more time on the syntax of a particular language than on developing the actual content of your web application, then you should look into Rails. Actually, its better than that. Rails allows you to write less code and get more done in less time. Period. Many think that Rails is a new "buzz" just because of its integrated AJAX functions and object-oriented database handling. But after developing one Rails app you'll realize that this little framework does much more - it forces a developer to write neater code, segment work-flow, and focus on the implementation of new ideas to get the job done better and faster. We can talk all day, but see for yourself. Not only is this site (RailsHosting.org) a tiny example of a Rails app, but you can also check out a huge number of other sites using Rails. You can also observe some neat demos we're working on here, as well as the demos on Thomas Fuch's site. |
What can you develop with Rails?[back to top]Well, if you haven't experienced it already, you can essentially write your own cookie-cutter Web 2.0 app (full of all the AJAXy community goodness) more robustly and in much less time (and lines of code) than with any other language or framework. That is, any database-driven application that you want to fill with all the hottest plugins like Google Maps API and Flickr and such can be done relatively easily. People are busting out with new plugins for Rails everyday. Plus, it really is a joy to code in Ruby with the Rails framework; you'll think to yourself, "why didn't someone come up with years ago? It would have saved me a lot of time." |
Why is a good Rails host hard to find?[back to top]The short answer is because it is costly and a huge pain. It is difficult to operate a hosting company that has the latest Ruby and Rails software installed across your server fleet, to make updates quickly, to answer support questions intelligently about a relatively new framework, to provide good and full documentation for Rails apps, and to maintain reliable uptime on your servers. Most hosting companies are used to operating with PHP/Perl/etc.. and aren't used to the problems with Ruby/Rails - which they are being forced to install because Rails is so popular and people are crashing servers with custom installs. At its core, Rails is designed to be served up in a dedicated environment and runs best with cached ruby, models, pages, etc... sitting in memory ready to spit out data to requesting browsers. This is why Mongrel is so dang popular (for good reason!) as well as good ol' FastCGI and SCGI. They make sites load and run faster because they utilize server RAM. So you can see why trying to serve Rails in a huge shared environment is tough: holding hundreds of persistent FastCGI or Mongrel processes in RAM is impossible. Shared hosting companies usually pull off the Apache/FastCGI stack by simply killing off dispatch.fcgi processes every minute or so and praying that no client actually uses the bandwidth he/she signed up for. Thus, there's no way you can pack as many clients onto a server like you can with PHP/Perl/etc,,. Loads would go nuts. Servers would crash. Clients would not be happy. So, if a hosting company takes the financial hit and doesn't crowd their servers and keeps Fastcgi processes killed - they can serve up Rails OK in a more traditional hosting environment. - - - - OK - now that you have an idea about why it is so difficult to serve up Rails, check out what would be the right hosting option for your situation as well as our Rails hosting reviews to find yourself a reliable Rails host and get your app live. |
10 Things to look for in a hosting company that 'supports' Rails[back to top]In addition to the things you'd normally look for in a host, if you're going to be running a Rails app go with a company that offers:
Currently, the only hosts we're aware of that meet all ten of these are HostingRails.com (who claims they will have mod_rails Hosting soon) and RailsPlayground.com, which is why we've choosen these companies for a majority of our critical applications. Many other Rails hosts, however, usually have 5-8 of these points, with numbers 3,4,5,8, and 10 being the most common to lack. |
AJAX Live Searching[back to top]Our goal here and in the following demo sections is to give you a small glimpse of the kinds of AJAX and JavaScript effects that can be integrated easily into Ruby on Rails apps as well as to give a short tutorial on how to actually implement them on your on site. For starters, type something (e.g. hither, John 3:16, etc..) into the box below and we'll show you the first couple of verses where that string shows up in the good ol' King James Bible (out of 31,102 verses) ![]() ![]() View (index.rhtml):
You'll notice that we absolute positioned the indicator gif (you'd have to plug in your coords) - which we prefer because it doesn't make the whole
page jump (i.e. the necessary 'display: none' removes the element from the page flow).
Controller (your_controller.rb):
With the observe_field function the data is passed via the XMLHttpRequest() function as raw post, so
you can capture it and do whatever you'd like with it before sending results to the search view.
View (search.rhtml):
And that's it. The resulting HTML will be passed into your element of choice for the viewer to see instantly.
|
Draggable Elements[back to top]
![]()
![]()
The above scrabble tiles are draggable. The "A" and the "I" will return to their home position after you try to move them, and all the others will stay where you place them. Note the cool fade/opacity effect (e.g. drag over the rail bar on the left) - and you can even click once to lock a tile before you click again to place it. The code in Rails is easy, just assign an element to be draggable and optionally specify if you want it to return home. For draggable elements that leave home, the code is:
and for those that return home:
|
Draggable AJAX comments window[back to top]
This demo is actually pretty simple to build in Rails. The window makes use of the script.aculo.us JavaScript effects for opening and closing - and the prototype.js library for updating comments via AJAX. Essentially what's happening here is we've placed an absolute positioned DIV underneath the anchor tag and used the Effect.BlindDown('element_id') and Effect.BlindUp('element_id') functions to open and close the DIV (required three nested divs to work correctly). Furthermore, to make the DIV draggable by only the top bar, we used:
to tell the element to be 'handled' by the element id 'demo_comments_handle' - which is a <td> element within the comments DIV.
For the preview we just mimicked the code for the comments window, and for comment updating via AJAX we used the form_remote_tag in the view and told it what to do while loading and after the loading was complete.
and in the controller and searching view we simply handled the input and displayed resulting HTML exactly
how we wanted to (see the Live Searching and Updating Div demos
for more details about how to do this).
If you read the AJAX updating list section in the Pragmatic Programmer's Agile Web Development with Rails book, it tells you how to do this using partial rendering - but the way we showed you (though it requires more code and is not the "best" way) was easier for us to conceptualize and implement at the time. Though now we have the entire comment box streamlined via partial rendering now so they can be added anywhere on this page (or on the site). If you have any questions or comments about this demo, please use the demo window itself. :) |
Scriptaculous JavaScript Effects[back to top]Here is a small demo of some of the simple JavaScript effects that come incorporated with Rails: Grow | Shrink | Fade | Appear | Puff | Squish
Below is the code which generated this little demo. Do you see where and why Hide and Show are used?
There are a ton more cool effects that we'll add here soon, but for now we'll defer you to the demos at Thomas Fuch's site, if you're interested. Thomas and his gang have coded up a bunch of neat effects that are included with Rails automatically. |
AJAX updating DIVs[back to top]If you jump up to the Rails hosting directory on this page and click on a column header, that column will be sorted. Click again and it will be sorted the opposite way (ASC or DESC). The code for this is relatively simple, instead of a normal link you just use a:
and make the view of the :action exactly how you want the updated div to look (exactly like the live search demo above).
While the info is being retrieved
an indicator gif (whatever you want) will display, and once the data is loaded into the DIV, the gif will disappear.
Pretty cool, huh? AJAX made easy. |
Deploying a Rails App with DreamHost[back to top]Greetings everyone. Our experience has taught us that getting an app up and running online with FastCGI enabled on a shared host is not easy. Many developers have run through this tutorial from scratch and we have received a lot of positive feedback from those who have successfully used it to deploy their applications online with DreamHost. If you decide to sign up for a plan with this hosting company (which we'd recommend), please consider using their promo code 50OFFRAILS - which instantly gives you $50.00 off any of their plans (i.e. starting at ~$5/month hosting for 20GB+ space and 1TB+ monthly bandwidth) and helps us out with hosting costs. Thanks. Ok - this tutorial assumes that you have a working Rails app on your local machine and wish to have it up and running on your DreamHost server with FastCGI in production mode. Here we go: As soon as your username and password are set you’ll log into their control panel which will look something like this.
Click on the "Domains" tab and look for the following
Click on the "Add New Domain / Sub-Domain" and then you’ll see something like this (a slightly older pic, but you get the idea):
It is important that FastCGI is selected. You may also use a subdomain and load your app there if you don’t want it hogging your site. We’ll tell you how to set the web directory root to your public folder later. OK, go to Goodies > mySQL and you’ll see the following (again, they've spruced up their mySQL so it will look a bit different):
Enter in all your info and make note of it. Login to your FTP/SSH domain (ours was slauson.dreamhost.com) via your favorite SSH program (we use SSH Secure Shell, but openSSH is free if you're looking for one) and get to the command line to generate your rails app (note: if your user does not have SSH enabled you can do so by going to the users -> manage users -> edit window).
You don’t need to generate the scaffolds, controllers, or models here if you have them on your local box. Ok, at this point we would recommend going to the config folder on your local machine and setting up some *.online versions of the database.yml, routes.rb, and the environment.rb. Even though once you upload them to the server you'll remove the .online part to replace the existing files, we found that using this method helped keep my configurations for local development and online production organized.
The 'production' part of your database.yml.online should look like this:
Note that we got rid of the socket line used for connecting to a local mySQL database (DreamHost uses remote mySQL servers). We’ll also give you a tip about your environment.rb file – add the following lines to the end of the file to allow yourself to send emails later from your DreamHost server.
In your environment.rb file it is also important to uncomment the following line:
Please Note: NEVER run your Rails app with FastCGI in development mode on a shared host (or anywhere) -
this will always lead to memory leaks. DreamHost does have a watchdog for this - but don't test it!
And in your routes.rb set the default route to the name of your main controller (you will see that all you need to do it uncomment this line and add in your controller name).
OK, at this point you can dump all your mySQL data online to your database domain that you set above (it should be ready by now). Then FTP your entire app directory to replace the one that was built on the server. Now you can open the config folder and upload in your online versions of database.yml, environment.rb, and routes.rb files (remember to remove the .online part). Next, upload your images, styles, and javascripts to the appropriate folders in the public directory. Make sure you public folder files stay CHMOD 755 ish and don't get too high or low (this is, believe it or not, a common error point). Then make sure your .htaccess file has the little ‘f’ to make your app FastCGI and upload it:
You must also DELETE the index.html file in your public folder. Your route.rb will now send requests to your main controller.
OK, at this point you can point your browser to www.domain.com/your_rails_app/public and you should see your rails app running fast and nice. If not, double check everything above. If it still doesn't work, feel free to email us at info _at_ railshosting.org and we'd be happy to help you out. It is very important to note that in production mode with FastCGI much of your application data is cached and held in memory. This means that Rails is 'always on' and ready to feed a browser with code. Thus, if you make any changes to your app (database, controllers, views, models, config, etc...) you'll need to run via the command line:
You won't be able to kill other user's processes (as you'll see) - but yours should be shut down after this. You can also try:
...but we believe as of a couple of months ago DreamHost disabled users from doing this (our own observations, please let us know if you see otherwise).
Ok Last thing is make your public folder the root web directory. If your a shell symlink master (see below) you know how to do this, but for everyone else you can do this by going back to the DreamHost control panel and making your way to Domains -> Manage Domains and click "edit" next to your Rails app domain (again, sorry for the slightly old pic).
change the web directory path to your public folder and that's it. Wait about 10 mins, point your browser to your www.domain.com, and you’re all set. We actually recommend that you become a shell/symlink master, with Dreamhost we often create our own Rails app folders in my root and then can easily symlink to a test/preview domain ([~]$ ln -s ~/myapp/public ~/www.thetestpreviewdoamin.com ), make sure things are working, then symlink to our live domain ([~]$ rm ~/www.thetestpreviewdoamin.com [~]$ ln -s ~/myapp/public ~/www.thelivedoamin.com ). It just makes things a little easier and this helps you if you ever go with other hosts that give you SSH/Shell access. |
What is the right plan/stack for you?[back to top]First of all - you should be doing all of your developing on your local machine. Never run your app in development mode (especially with FastCGI!) in a shared hosting environment because it hogs system resources like crazy. If your Rails app is:
|
Rails Hosting Coupons & Promo Codes[back to top]
If anyone knows of other coupons or promo codes for Rails hosting, please e-mail us at info _at_ railshosting.org, thanks! |
Ruby on Rails Hosting Reviews[back to top]You should probably read our list of Ten things to look for in a Rails Host before you read any of these reviews so you know the general scale we use to rank and evaluate hosts. Know that our top two Ruby on Rails Hositng choices (HostingRails.com and RailsPlayground.com) offer affordable plans with Mongrel clusters behind mod_proxy_balancer (or Pound) on Apache2.2 servers, which we'd highly recommend. DreamHost ReviewReview of www.dreamhost.com and the company's ability to host and support Ruby on Rails applicationsWe'll start with DreamHost because they are probably one of the largest and cheapest hosts that do a good job serving Rails. Tip: use their promo code 50OFFRAILS to get $50.00 USD off any of their plans at signup. We've been hosting Rails applications with DreamHost for over two years now and would highly recommend them for low-budget, low-to-medium-traffic apps that need a huge amount of space and bandwidth to operate. They are also great for beginners who want to experiment. The company itself is run out of a datacenter in California (which is located in the same building as the MySpace.com guys and the hosting company iPowerWeb). They've been in operation since 1996 and have stood the test of time for keeping servers up and running and customers happy. When we first stumbled upon DreamHost we were blown away. A factor of 10 more disk space and bandwidth than the other hosts? 97-day full money-back guarantee? There must have been some catch? And yes there was (we found after hours of reading up on the host); Apparently DreamHost was once a dream of a host, but as a result they have expanded big time and are now facing the problem that all hosting companies face 5-10 years into their successful business plans - old equipment, overwhelming problems, and the question "is it really worth fixing it?" We suspect that in 2005 DreamHost lost the fast-paced growth that they saw in previous years. However, they seemed to turn things around in 2006 with a ton of new equipment and, after surviving the crazy California power outages that left their building dead a couple of times in Summer 2006, they've learned their lesson. From all the notifications and newsletters we've read, they seem like guys who actually love what they do and professionals who can get the job done at the end of the day. To make a long story short, we went with DreamHost and have been hosting an array of test sites and production sites with them and things are going well. They serve a good purpose. And fear not about uptime, typing in 'uptime' right now (as of this writing on 2008-03-07) shows us:
and we've seen greater than 99.9% uptime overall.
Thus, we highly recommend DreamHost and have even posted on this page a Rails QuickStart Guide for DreamHost customers to help developers get their Rails apps up and running with FastCGI in minutes. Personally, the deciding factors for us came down to a promo code (use 50OFFRAILS) and the 97-day guarantee, so the final cost was about $5 a month and if things got bad we could always bail and get our money back. Site5 ReviewReview of www.site5.com and the company's ability to host and support Ruby on Rails applicationsSite5's datacenter is in New Jersey and they are operating almost 200 shared servers. They are probably one of the fastest growing companies on the Net, have a slick new website, and have hired a team of Rails engineers to build Rails apps behind the scenes for them and for their customers. (a good sign). However, our personal experience with Site5 was horrible. Yes they answered support questions fast but they overstuffed our server (they actually admitted this to us) so we had daily downtime. Lame. More info about Site5.com coming Soon... TextDrive ReviewReview of www.textdrive.com and the company's ability to host and support Ruby on Rails applicationsTextDrive is the self-proclaimed 'Official Rails Host' and are undoubtedly smart about what they're doing. Its difficult to say bad things about a company that gives so much of their time, energy, and money toward advancing the development of Rails - but to be honest for a shared environment you can get more hosting, better uptime, and faster support for at least half the price. More info about TextDrive.com coming Soon... HostingRails ReviewReview of www.hostingrails.com and the company's ability to host and support Ruby on Rails applicationsHostingRails is an excellent hosting company that focuses specifically on Rails - biggest bonus is that they sell dedicated memory and Mongrel hosting setups for less than $10 USD / mo. You can get your app speeding along there by ordering a Mongrel cluster proxyed behind Apache2 with mod_proxy_balancer, which is awesome because that's what the main Ruby on Rails website uses. Being as curious as we are we purchased a "Business plan" account for this site (RailsHosting.org) and things are running great - ten times faster than the FastCGI setup we had with our previous host. They've been in operation since the beginning of 2006 and provide high-quality 24/7 support for Rails (i.e. they actually offer to deploy your Rails app for you) and the oppurtunity for mod_rails hosting coming soon. They have nice documentation for Rails apps - which was a huge perk for us. Their datacenter is in Dallas, Tx - and the company has excellent options for you to scale up, even to VPS and dedicated servers. More info about HostingRails.com coming Soon... RailsPlaygroud ReviewReview of www.railsplayground.com and the company's ability to host and support Ruby on Rails applicationsRailsPlaygound has been rockn' the Rails scene since 2005 and has a strong base of extremely happy clients. We're one of them. We've been hosting some of our larger projects on their dedicated servers and they have done an excellent job with support and network uptime. We know their other hosting is solid as well - you really can't go wrong with these guys. More reviews are on the way... |
Live Rails Hosting Search Engine[back to top]What are you looking for? (e.g. PostgreSQL) |
Ruby on Rails Hosting Directory[back to top]****** ******
Plan Duration:
1 Year
2 Years
1 Month
Optional Column >
|
| mySQL Databases |
| Multi-Domain Hosting |
| Money-Back Guarantee |
| FTP Accounts |
| Email Accounts |
| Uptime Guarantee |
| Setup Fees |