Shared Hosting is Alright
; updated James Adam
I’ve had a Dreamhost account for a long time. Some of my friends and I started sharing one of their premium plans in around 2001 (you know, before virtual hosts and all that jazz) to save some cash (I was a penniless PhD student), but we wanted somewhere to host our perennially profound blawgs and generally piss around with the web.
So after reading Alex Payne’s response to a post on the DreamHost blog about Rails on shared hosting, while I don’t really have much to say about the points on the Dreamhost post (Ruby/Rails may or may not get faster, who can say), I think the thoughts about working in shared hosting environments are interesting.
Here’s the gist of Alex’ argument, I think:
Big kids need their own sandboxes to play in.
As a programmer who wants to get paid for my work, making an application that I sell to people who then install it on a shared hosting account doesn’t sound like a great way to make a living. If you’ll excuse a callous generalization, it’s a support nightmare for a down-market customer base. Plus, nobody but nerds (who don’t pay for software anyway) install their own web applications anymore. People use hosted services.
It is possible to use Rails effectively with shared hosting. I’ve done it. I’m doing it now. I have a couple of VPSes, and they’re good too, but this blog is (was; I’m no longer using Mephisto…) being served up via Dreamhost*. I’m not saying they are perfect, but I also don’t really believe that if the world would come to a shuddering halt were to lose access to what choice morsels of rubbish I choose to spout here.
Shared hosting exists to give people the ability to use server software without having to know a lot about dependencies, package management and toolchains. Certainly, it isn’t the most performant or reliable way to serve a web application, nor does it afford you all the flexibility of virtual hosting, but does that mean it’s worthless? Hardly.
You don’t need to be a nerd to want to play with Rails
I feel like we’re nearing a point in time where almost anyone can pick up the tools of our particular trade and start creating their own applications. And my, don’t we have really nice tools! Surely if a Ruby-Newbie who’s interested in scratching their own itch wants to play around with Rails, it’s in our interests as a community to foster that. And so it that means at least trying to make it easy for people to host their own applications on hosting that is both common and affordable, then why shouldn’t we be trying to assist?
Bigs kids might need their own sandboxes, but that doesn’t mean that you should only be allowed to play if you can afford your own sandpit.
Do As Rails Core Do?
David Hansson has said that none of the Rails contributors may use shared hosting, and that’s fine. Rails has always been about the contributors scratching their own itches. But I think the problem that Dreamhost are highlighting is that those core contributors have (directly or indirectly) made it clear that the “official” way you should deploy is on a dedicated server, using a combination of Mongrel and Apache/Lighttpd/Nginx. It’s like: that’s what all the high priests are doing, so if you’re not doing the same, there’s something wrong with you. Apparently the opinions from which Rails was summoned into existence not only include how you develop with it, but how you deploy it as well.
My point is simply this: you don’t always have to act according to the opinions of other people. You don’t even really need to agree with them. I didn’t agree with Rails Core about the engines plugin, but that’s fine, we’ve coexisted, and fed back where it was appropriate. The key is that if you want things to work better, you have to go do it yourself. David states that in his response reasonably well:
It’s not saying that shared hosting is bad or evil. It’s simply saying that the Rails contributors generally don’t use it. By extension, it’s not something that we are personally invested in solving as a traditional “scratch your own itch” type of development.
Incidentally, I find it remarkably refreshing that something which doesn’t fall on the “golden path” isn’t being automatically labelled as evil here. Anyway, back to the quote:
I’d love for Rails to be easy as pie to run in any environment. In that “more people could have fun learning Rails and deploying their first hobby application” kind of way. But I don’t need it in the sense that I’m going to put in the work, personally, to make it happen.
(…cut….)
I’d love to see someone tackle this challenge and would be more than happy to work with a group pursuing this to get their results into Rails or working with Rails the best way we can. Consider that an open, standing invitation.
Back to the point:
What I really find weird that people would respond to Dreamhost’s expression of pain as “What, shared hosting? That shit is WHACK! Real developers use VPS hosting, why are you even trying!”
Can we dial back on this brand of deeply passionate but equally-deeply uninformed knee-jerk reaction? Shared hosting might not the best way to deploy a critical application, but not every app is really that critical. And that’s OK.
How I Use Dreamhost
In case anyone’s interested, I do have a few things I do for the applications that I run on Dreamhost:
- Build your own ruby and install your own gems. You can install applications in your own home directory (try running ./configure –prefix=$HOME, in a nutshell). This puts you completely in control of the versions of Ruby and more importantly the gems that you application needs
- Put as much stuff in /vendor as possible. Try not to depend on the Rails gems that your shared host might provide, because you really don’t need to. Hell, try and unpack as many gems into your application’s vendor directory as you can.