People regularly ask me where to host their websites. This is pretty much what I tell everybody.
RackSpace Is The Best
Unless You Don’t Want To Pay For Managed Hosting
Or You Want Ruby on Rails Support
An entry level server at RackSpace will cost you about $500/month. If you can afford a managed, dedicated server, and your are working with PHP host with RackSpace. I have several servers with RackSpace and have been working with them now for over 5 years. The service, support, and reliability are fantastic unless you intend to host Ruby on Rails applications. RackSpace does not “officially support” Rails. When you are talking to the sales department they say they will help with Rails issues even though it’s not officially supported. My experience is that you are totally on your own with Ruby on Rails at Rackspace.
RimuHosting Is The Best For Non-Managed Servers
The Best VPS, Semi-Dedicated and Dedicated Servers
So if you want to run Rails apps or you don’t need a managed dedicated server, host with RimuHosting. This blog is hosted at RimuHosting and for the past 2 years I have had both VPS accounts and Dedicated servers there. The uptime, performance and reliability has been extremely good although not quite flawless. There was one time when one of my semi-dedicated VPS accounts was unavailable for about an hour and it was not a scheduled maintenance period. Even with that one blip in the service, my overall experience has been excellent and I highly recommend RimuHosting if you want a VPS account or a non-managed dedicated server. The support is extremely fast and helpful – albeit via email only. I prefer email though, as long as it’s attended to promptly. In your customer control panel, you can see the status of your support ticket, how long it has been since you have submitted it, whether or not anyone is working on it, etc. It really is better than phone service in my opinion.
HostICan
The Best Shared Hosting Package I’ve Ever Seen
If you just want a low cost shared hosting account, I have never seen a package that is better than the BaseHost package with HostICan. It is $6.95/month and you get 2,000 GB – yes about 2 Terabytes of data storage. You can host 2 different domain names and get a free domain name for life when you sign up. The free domain name is at least worth the cost of one month of hosting each year. They offer a 99.9% uptime guarantee. If you want a WordPress blog, the WordPress software is already there and ready to go. So this is great account to have if you want to host your own blog. You can even get SSH access but that adds a little to your monthly cost. They no longer support Ruby on Rails. But, if your building Rails apps, get a VPS account at RimuHosting.
I often use this when implementing a simple login screen for a password protected section of my application. In a Zend Framework application you can implement a preDispatch() function in a Zend_Controller_Action which will run before an action is dispatched. This lets you setup your filter to check to see if the visitor is logged in or not. If the visitor is not logged in, you can redirect them to the login screen of your application.
Setting Up Exceptions For preDispatch
If your login screen is managed by a different controller, the setup described above is fine. If, however, your login screen is managed by an action in the same controller as the protected actions, you will want to allow unauthenticated access to the login screen. To do this, we need to exclude certain actions from the authentication check. Ruby on Rails let’s you define :except => :actionName to allow certain actions to skip the before_filter. With the Zend Framework, we have to implement that functionality on our own… but it’s easy.
What Action Is Being Called?
To set up your preDispatch function to skip checking to see if a user is logged in for certain actions you need to know which action is being called. You do that like this…
$action = $this->_request->getActionName();
Example Code
Now all you have to do is see if the action that is being called is one of the actions that you want to skip. I set up a private function called verify() to check whether or not the visitor is logged in. If the user is not logged in, I forward them to the loginAction() function. Since an unauthenticated user needs to be able to access the login screeen, we tell the preDispatch() function not to verify visitors requesting the login action. My controller ends up looking someting like this.
class AccountController extends Zend_Controller_Action {
function preDispatch() {
// Discover what action is being requested
$action = $this->_request->getActionName();
// Create a list of actions which allow unauthenticated access
$exclusions = array("login");
if(!in_array($action, $exclusions)) {
$this->verify();
}
}
/**
* Check to see if the visitor is logged in. If not, send to loginAction
*/
private function verifty() {
$auth = Zend_Auth::getInstance();
if(!$auth->hasIdentity()) {
$this->_forward("login");
}
}
function loginAction() {
// Display your login screen
}
// Continue the rest of your class...
}
I was trying out a plugin in my Ruby on Rails application and decided not to use it. Apparently, when I installed the plugin, a reference to it was added to my subversion repository. Since the reference was not to a working directory, my capistrano deployments got debackled and died. Here is how you can remove external repositories from subversion.
If you get a message like this one when you are working with subversion:
Fetching external item into 'vendor/plugins/...'
Change directories so that you are in the root of your Rails application and issue the following command:
svn propedit svn:externals vendor/plugins
A list of the external plugins will appear in your default editor. Mine is vim. Delete the link that you no longer want, save the file and commit your changes.
I have been developing PHP applications professionally for over 7 years. About a year ago, I decided to try developing some Ruby on Rails applications. My main Ruby on Rails projects have included an e-commerce site QuietHeadphones.com and an online application for synchronizing medical records with USB thumb drives. Of course, I have also worked with the Ruby on Rails blogging engine Mephisto which is what runs this website. So while I have worked with PHP for more time than I have worked with Ruby on Rails, I have worked with Ruby on Rails long enough to have noticed some significant differences between the two languages. My comparison is going to focus on the language differences between PHP and Ruby and not as much on the Rails framework.
Read the rest of this entry »
I’ve been asked several times how I have my Ruby on Rails development environment set up. The most frequently misunderstood aspect of a Rails development environment is that you do not have to have your Subversion repository physically located on the same server as your deployed application. The only requirement is that all the pieces of your development environment puzzle need to be able to access one another over the internet. So, here’s how I have myself setup. It works on both linux (Ubuntu) and Windows XP.
Read the rest of this entry »
If you are using ISPConfig to manage the virtual hosts on your web server, you will notice that there is no way to separate SSL vs non-SSL Apache directives using the standard web interface. This is a problem if you are writing Ruby on Rails applications and proxying requests through Apache to a Mongrel cluster because Mongrel won’t know what type of requests it is receiving. Being behind the proxy, Mongrel doesn’t know if the original requests are coming via HTTP or HTTPS. The solution is to add RequestHeader set X_FORWARDED_PROTO ‘https’ as a line in your Apache virtual host configuration for the SSL virtual host. I will tell you how to get ISPConfig to handle that for you. I will also show how to get GoDaddy.com ssl certificates working and how our Apache 2.0 randomized proxy balancer works.
Read the rest of this entry »