Sometimes... stuff happens |
I am a father, husband, son, friend, software developer who loves Ruby, and an unemotional robot ( or at least that's what I've heard ). |
It seems like this is my exact work experience most of the time.
This is another game from the studio that brought us Canabalt. Try it out before it’s available in the app store. Tried it out quickly and it is yet again another simple, fun and very addicting experience.
professional beards.
…wanna show yours?
New Tron Legacy preview… amazing.
This one goes out to my family.
I’ve recently been trying to learn the ins and outs of Heroku as I find it to be a great platform for hosting my applications. A few weeks ago I did a presentation that reviewed Heroku’s service for Obtiva’s Geekfest. When showing off how easy it was to throw up a maintenance page someone inevitably asked “Can you customize it?” I said that I hadn’t tried it myself but I couldn’t imagine them not letting you, so here is what I found out…
Absolutely you can customize your maintenance page and I’ll show you how easy it was for me to update my business site to use it!
Regardless of what type of Ruby application you’re hosting (Rails, Sinatra, etc) you can do a custom maintenance page. Just create a “public/maintenance” directory and inside it you’ll be dealing with “index.html” Pretty simple right?! It’s just a plain HTML document. Here is what I came up with:
Nothing fancy there… now for some styling. Here is one of the gotchas I ran into. Instinctively I had added my styles to my normal application stylesheet. Unfortunately this did not work. When your maintenance page is active, all requests are redirected to this index page. This makes the request to grab your stylesheet redirected as well so no external styles. No biggie… there is not much to style, I’ll just do it inline.
Cool… there are my styles, but wait, my image is not showing up!? Well this is another case of a request being made that eventually gets rerouted because of the maintenance page. I ended up just throwing my maintenance image up on an external service so there will be no complications with this. Here is the final code:
Now all you have to do is issue the command
heroku maintenance:on # turns on maintenance page
When the maintenance page is turned on, all requests get routed to this page and this is what my visitors would see:

To stop the maintenance page and return request routing back to normal just issue:
heroku maintenance:off # turns off maintenance page
Overall this is a very simple process and hopefully is just a bit simpler now that I’ve worked out those couple of ‘gotchas’ for you. Please leave a comment or screenshot with your maintenance page. I’d love to see them!
MongoDB in your face! Well really in your browser but in your face sounded cooler. Hows that for a title!?
Thought this would be useful for those who want to try out Mongo before tomorrows ChicagoRuby meeting.