Is SwitchPipe the solution for Rails shared hosting?

Posted by larrywright

Peter Cooper (who I interviewed recently ) has just announced SwitchPipe, which aims to make deploying and hosting Rails (and other frameworks, such as Django) applications easy. From the site:

Introduction / Overview

SwitchPipe is a proof of concept “Web application server” developed in Ruby. More accurately, it’s a Web application process manager and request dispatcher / proxy. Backend HTTP-speaking applications (Web applications) do not run directly within SwitchPipe, but are loaded into their own processes making SwitchPipe language and framework agnostic.

SwitchPipe takes control of, and manages, the backend application processes, including loading and proxying to multiple instances of each application in a round-robin style configuration. As an administrator, you can define the maximum number of backend processes to run for each app, along with other settings so that you do not exceeded preferred resource limits. SwitchPipe quickly removes processes that “break” or otherwise outlive their welcome. For example, you can let SwitchPipe kill any backend processes that have not been accessed for, say, 20 seconds. This makes hosting many multiple Rails applications, for example, a quick and non-memory demanding process, ideal for shared hosting environments.

...

SwitchPipe’s goal is to be:

  • super easy to configure
  • the easiest way to deploy multiple HTTP-talking backend applications
  • painless in terms of management; no hand-holding of different applications is needed
  • a permanent daemon that can handle configuration changes in backend apps “on the fly”
  • a reliable solution on Linux and OS/X (and anything POSIX compatible, ideally)

I haven’t spent much time with SwitchPipe yet, but if it lives up to Peter’s claims this will dramatically simplify hosting Rails/Django/Camping/whatever applications.

What’s interesting to note is that this originated with Peter’s widely read article on why such a thing was needed. Unlike a lot of other people who have complained loudly about the state of Rails on shared hosting environments, Peter put his time and talents towards creating a solution which he then released within 3 weeks. This is definitely something we need more of.

So what are your thoughts? Is this the solution we’ve been waiting for?

Rails Snippets - 11/29

Posted by larrywright

Holy Shmoly, Ruby 1.9 smokes Python away!

Initial performance numbers would seem to indicate that Ruby 1.9 (due by Christmas) will be lots faster.

Quoted-Printable: My .irbrc

If you spend a lot of time in IRB (most of us probably do), it’s worth taking the time to learn how to customize it. This is a good start.

Faker

Nice clean library to generate fake data. The home page says it’s a port of Perl’s Data::Faker library, which I’d never even heard of.

Book Review: Practical Rails Social Networking Sites

Posted by larrywright

Summary

Rails Social Networking Sites walks you through the process of building a Web 2.0 social networking site (something like MySpace), called Rails Coders that includes the features you would expect in that sort of site:

  • User signup and management (based on restful_authentication)
  • Content management
  • Blogging (with web services)
  • Markup languages like Textile and Liquid
  • Mashups using Google Maps and Flickr
  • photo management (attachment_fu and RMagick)
  • Tagging

This book is not, of course, about building social networking sites, though that does serve as the exercise in the book. It’s about going beyond the basics with Ruby on Rails, and building something useful.

Rails Social Networking Sites is targeted at developers who have some experience with developing Rails applications. That said, you don’t need much. If you have read one of the other books on Rails or developed a couple of play applications, you’ll be fine.

Pros

There’s a lot to like about this book. It’s well written, and covers a broad range of useful topics. Here’s the things I really liked:

  • It covers useful topics in the context of a real-world application. Most of the Rails books out there (at least the ones I own or have looked through) cover the basics of Rails, and maybe a few additional plugins. Anyone building a real-world application will need to scour the internet for help with the other plugins available to do things like handle file uploads, user authentication, and the like. While this book doesn’t cover everything you could possible want to do, it covers a lot.
  • There is a very big emphasis on testing. It’s not TDD (see my note in the cons below), but in every chapter you will be shown how to build something, and then how to test what you built.
  • It’s current. The application is built in a RESTful style, and there is frequent mention of the changes/deprecations coming in the Rails 2.0 release.

Cons

There’s really very little wrong with this book. It appears to have been technical reviewed thoroughly, and as a result I didn’t find any glaring technical errors. That said, there are a few things about the book that I took some issue with:

  • The book frequently references blog posts as resources. This seems like a bad practice to me, as these urls tend to have a short lifespan. It’s very likely that many of these urls will be dead links within a year or so. To be fair, this is a book covering a rapidly moving technology, and it’s likely to be largely out of date in 18-24 months. Therefore, this may not be much of an issue. Still, it might be a better idea to link to the book’s website instead.
  • While the book does give ample coverage to testing (more than most books), it would have been nice if the testing was done Test First, rather than bolted on after the fact

All in all, these are really minor points.

Conclusion

Overall, I really liked this book, and I believe it will be very useful to anyone developing with Ruby on Rails. Whether you’re on your first application or you’ve been developing for a while, you will find useful information in Rails Social Networking Sites.

Disclaimer: I received a free copy of this book from the publisher in exchange for a review. There were no conditions other than that, but in the interest of full disclosure, now you know.

Rails Snippets - 11/13

Posted by larrywright

RESTFul OpenID Authentication

A plugin to do OpenID authentication in Rails, in a RESTful way.

Off the Rails – An alternative Rails stack

Competition is good. Merb and the like provide that competition to Rails. This article runs through an alternative to the Rails stack. It’s always good to keep an eye on what else is out there.

Rands in Repose: The Nerd Handbook

Ok, this is a bonus link. Not at all Rails related, but relevent to you if you’re reading this. Rands nails the Nerd. I mean, really nails it.

Rails Snippets - 11/7

Posted by larrywright

Troubleshooting Ruby Processes: Leveraging System Tools when the Usual Ruby Tricks Stop Working

A new book from O’Reilly on troubleshooting Ruby (and Rails) apps. From the overview:

This short cut introduces key system diagnostic tools to Ruby developers creating and deploying web applications. When programmers develop a Ruby application they commonly experience complex problems which require some understanding of the underlying operating system to be solved. Difficult to diagnose, these problems can make the difference between a project’s failure or success. This short cut demonstrates how to leverage system tools available on Mac OS X, Linux, Solaris, BSD or any other Unix flavor. You will learn how to leverage the raw power of tools such as lsof, strace or gdb to resolve problems that are difficult to diagnose with the standard Ruby development tools. You will also find concrete examples that illustrate how these tools solve real-life problems in Ruby development. This expertise will prove especially relevant during the deployment phase of your application. In this way, should your production Mongrel cluster freeze and stop serving HTTP requests, it will not take you 2 days to figure out why!

Sitepoint: Preparing for Rails 2.0

A nice, if a bit short, article on some of the changes that are coming in Rails 2.0. This is focused on what you will need to change in your application.

Creating a Ruby Weblog in 10 Minutes

This is a beginner tutorial, specific to using Netbeans 6.0. I’ve not played much with the Rails support in Netbeans, but it looks impressive so far.

Rails Snippets - 11/2

Posted by larrywright

New in Rails: Request Profiler

Jeremy Kemper recently committed a request profiler to Rails. It lets you make a request to a URL repeatedly, and then see an HTML or text report of where your code is spending it’s time. This looks very handy.

Building Tempo With Rails – Part I

A walkthrough of building an app with Rails, which includes feature definition, using Piston to manage plugins, and Restful Authentication. Nice.

Rails Snippets - 10/31

Posted by larrywright

The Halloween Edition

Obvious Code: Creating a simple news publishing system in Rails 2.0

One of the first tutorials I’ve seen that focuses on Rails 2.0.

Deploy a Ruby on Rails app on EC2 in five minutes

This would seem to make deploying a Rails app on Amazon’s EC2 very simple:

EC2 on Rails is an Ubuntu Linux server image for Amazon’s EC2 hosting service that’s ready to run a standard Ruby on Rails application with little or no customization. It’s a Ruby on Rails virtual appliance. If you have an EC2 account and a public keypair you’re five minutes away from deploying your Rails app.

Rails Snippets

Posted by larrywright

A collection of Rails links

Using Paypal with Rails

This is a nice step-by-step article on integrating PayPal with your Rails application, using ActiveMerchant.

Rails 2.0 Features: Multiple Views

I’ve only skimmed over the new features in the upcoming 2.0 release of Rails, but this looks like one of the nicest features. This is a good explanation of how it works and why it’s useful.

Mongrel 1.0.3 is out

A bugfix release of Mongrel is out. Looks like 1.1 is due soon, and it looks interesting:

“Mongrel 1.1 is coming real soon now with JRuby support and a few other things.”

Emacs on Rails

Being a bit of an Emacs junky, I’m not sure how I missed this. Looks mature, and very functional, and almost TextMate-like. The link has a nice flash video of Emacs on Rails in action.

Free Rails book from Sitepoint

Sitepoint’s book “Build Your Own Ruby on Rails Web Applications” is now free, at least for the next month. I’ve only skimmed it, but it looks like a decent introduction, and the price is certainly right.