SwitchTower
I grabbed it from svn and started playing around last night. Today there's a manual on it. Nothing much to say except SwitchTower looks super, super sweet.
Combine that with migrations and FCGI scripts and wow, things just got simpler. Simpler is good.
I look forward to testing SwitchTower out on a few small projects in the next couple days, and then using it for the big one.
(announcement on "the big one" coming soonish)
Customizing disable_web for multiple sites
On Measure Map, we have two separate applications: the frontend that users log into and see their stats, and the tracker, where things about your blog are recorded. Links to tracker are sourced in users' blogs as Javascript, so they had better return valid Javascript code at all times, even when we take the application offline for maintenance.
Ok, so how do we override Switchtower's
disable_webtask to use a custom page? Here's one way. It assumes a custom page lives atconfig/templates/maintenance.rhtml.Remember when using the default
mod_rewriterules to support the maintenance page, you will redirect everything to this file, so you can't use any external stylesheet or image files unless you get tricky withmod_rewrite.Cool, so now we have our own maintenance page. Next problem; how to use separate files for our two applications? Here's a nice DRY version that's easy to extend to as many roles as you need.
With this in place, we simply create two files,
config/templates/maintenance.rhtmlfor the frontend, andconfig/templates/maintenance-tracker.rhtmlfor the tracker, and we're all set.