Been a while since I've checked this place out, but I'm looking for some shared hosting providers that offer Ruby on Rails hosting. I know of a couple (TextDrive, Site5, GeekISP) that offer it, was hoping anyone here could give me recommendations if you've used any host for RoR apps. If you know whether they use Apache or lighttpd, and fastcgi with it, please let me know. Thanks
edit: At this point price isn't a main consideration, just looking for what solid hosts are available. If you've used a host and were really happy with them, throw the name out. No need to limit the hosts based on price just yet.
Are you saying that any shared hosting provider can also offer RoR? Makes sense, but most don't. I was hoping to get feedback from people who currently or in the past have run a RoR site with a shared host.
Also, anyone running a RoR site, I'd love it if you could post the link so I could check it out.
Ruby is not currently installed on the <hidden> servers, as I assume is the case for the majority of Linux hosting. To install Ruby, you'll need access to the shell for your account. The Unix shell is similar to the Command Prompt on Windows machines. You can access the shell through your CPanel interface by clicking the SSH/Shell Access link.
We'll start with a simple command to ask Ruby to tell us what version it is.
$ ruby -v
If you don't have Ruby installed you should see a message such as command not found. If you do have Ruby installed, then you can skip ahead.
The next step is to install Ruby. To do this we will download and compile Ruby from the source code. We'll install Ruby into a new directory named local, because we don't have permissions to install Ruby for all users on the server. We will follow this process for the other programs we'll need to install.
Our next step is to ask Ruby what version is installed.
$ ruby -v
Did that fail again? Don't worry, this is because we installed Ruby in a non-standard location, and the shell doesn't know to look in the new directory. To make the shell look in that directory, run the following command:
$ export PATH=$HOME/local/bin:$PATH
Now you should be able to ask Ruby for its version without receiving an error message. Of course, it would be a pain to run the preceding PATH command every time we connected to the server, so we'll create a new file named .bash_profile. In this file, you should add the now following line:
Now every time you connect to the server through the shell, your account will look in your local directory for Ruby.
Let's test this! Create a new file in your public_html directory named hello.cgi. The file should include the following lines:
The home directory for my account on <hidden> is /home/blowmage. You'll want to change /home/blowmage to the path to your account's home directory. If you do not, then the CGI won't know where to find Ruby and won't return. If you do you will see a message that displays Hello Ruby!, congratulations.
eruby interprets Ruby code that is embedded text file. Our interest is embedding Ruby code to a HTML file, much like Microsoft's Active Server Pages, Sun's Java Server Pages, and Zend's PHP. Again, this is suprisingly easy to do, as we simply enter these commands in at the shell:
We've installed, compiled, and copied the eruby executable file to our site's cgi-bin directory. Our site is now ready to use the executable to parse our HTML files for Ruby code and execute it. To do this, we need to assosciate our files with the CGI executable. Parsing our files for Ruby code does add some overhead, so we probably don't want to parse every single file, so we'll associate the file extension .rhtml with eruby. We make this association in the .htaccess file in the public_html directory by adding these lines:
If you don't have an .htaccess file in your public_html directory then simply create one. Let's test this! Create a new file in your public_html directory named hello.rhtml The file should include the following lines:
<% 5.times do %>
<% end %>
When you browse to the file you will see a message that displays Hello Hello Hello Hello Hello Ruby!, congratulations.
One of my requirements when looking for a blogging engine was to have the engine pull the content from the file system. I just wanted a very simple and lightweight framework. I also wanted to edit my content files manually, and not through some web-based WYSIWYG interface. I'm not distrustful of more complicated blogging engines, I use them on my other sites, but blowmage needed a different approach. I wanted to be much closer to the metal on this site.
I originally started out using blosxom, and I liked that approach very much. But I've never been much of a Perl hack, and I was faced with either learning more Perl or finding a different solution. Once I found Ruby I knew I had my language, and I just needed an engine. I thought about porting blosxom to Ruby, but I decided that I would do better with Rublog as my starting point. Rublog isn't 100% what I'd like it to be out of the box, but I find it very easy to change to my liking. I figure one of the tenants of Don't Repeat Yourself is not reinventing the wheel when you don't have to.
This may seem to fly in the face of the current Rails hype, (and I may indeed only be delaying the inevitable move to Rails) but until my hosting provider has more support for Rails I'm very happy with where I'm at with Rublog.
You start by downloading and uncompressing the Rublog source:
The next step is to copy the CGI script to your public_html directory. I've renamed it for reasons that I'll explain later. I also created a new directory to store all my blog entries. I find it best to not store these blog entries in the public_html directory, since you probably don't want folks to bypass the CGI script to get to the content.
$ cp rublog-1.0/rublog.cgi public_html/index.cgi
$ mkdir blog
Before you browse to /index.cgi and see the content, you need to change the CGI file to point to your local instance of Ruby. Be sure to change /home/blowmage to the path to your account's home directory:
The CGI will show you the Rublog documentation by default. Once you are comfortable with the way Rublog works, you should update the index.cgi script to look at the blog directory for the blog content:
BLOG_DIR = "/home/blowmage/blog"
You can now browse your site through the script: /index.cgi.
However, I hate seeing a CGI script in the URL. I feel this doesn't promote good URIs. If we could hide the CGI script then we are free to replace our site's implementation without breaking search engine results and people's bookmarks. Doing this is much easier than it sounds, and it involves our old friend the .htaccess file.
What we need to do is tell the .htaccess file to route all failed requests through our Rublog CGI script. This means that requests to existing resources such as other CGI scripts or HTML or image files will continue to be served. The requests for files that don't exist, such as the archive for the current year and month, are sent to the Rublog CGI where Rublog determines what to serve for that request. This is accomplished by adding the following rewrite rules to the .htaccess file.
Rublog is now installed and will respond to requests even if they are missing the script path. However, Rublog wasn't written with the expectation that we would want to hide the script path, and the script path is embedded throughout the Rublog code. I have made addidional changes to Rublog to hide the script path, but those are outside of the scope of this document.
It is possible to install and use Rails on <hidden>, but the performance will suffer. Rails is a large application, and not having mod_ruby and FastCGI installed hurts performance tremendously. Until they are supported by <hidden>, use at your own risk.
The first step to installing Rails is to install RubyGems. Truth be known, you probably want to install gems whether you install Rails or not. Installing gems is as easy as everything else:
Once gems is installed, installing Rails or any other gem is the easiest thing in the world:
gem install rails
That's it! There are a multitude of other sites that can help you configure Rails, but I've found the hardest part was installing Ruby. I hope this article has been of interest to you. If you have any suggestions or corrections drop me a line. With Ruby installed, you're on your way to become more productive and have more fun. Good luck!
[Quotes from a user who installed ROR on a shared hosting account!]
Last edited by David; 07-22-2005 at 06:06 AM.
David Web hosting by Fused — For businesses with more important things to do than worry about their hosting.
I've installed Ruby and Rails on a number of machines, that's not a problem.
But the whole point of me getting shared hosting is so that it's all taken care of for me, so I don't have to manage a server. I'm capable of managing a server, I just want to concentrate my efforts on developing sites for clients, rather than working on a server.
Even if it is possible for the client to intall, it then leaves the updating in the hands of the client themselves. We all know where that can lead when a serious vulnerability hits the shelves :/
I'm certain a lot of hosts that will be offering rails, will also be doing so with the fast cgi apache mod. Plus, before considering following the above steps, you should probably make sure to contact your provider to ensure they allow for you to install such software on your account.