The importance of a staging environment

Full disclosure, I don’t actually have a staging server for my personal projects. I develop locally in a very similar environment as my production server and any time I have to do something major, like upgrading the OS or upgrading software between major revisions, I always do a dry run with a disposible cloud server instance or a virtual machine.

That all being said, I wrote a blog post last December on how to upgrade PHP from 5.3 to 5.5 on Ubuntu 12.04 LTS. It’s been one of my most trafficked posts on PHP Avenue, is one of the most frequently shared and hits a trifecta by also being the most commented on post on the blog. All of those comments revealed a very scary truth, there are a lot of people out there that fly by the seat of pants and perform major system upgrades without a safety net. No staging server to test on, or the very least, a throw away server instance to do a dry run with.

I’m not losing any sleep over it, but it has weighed on my mind that perhaps my post didn’t include enough of a warning about the importance of backups and staging servers and not trying to do blind upgrades to a server unless you have the expertise to troubleshoot your way out of them if/when everything goes horribly awry. At the end of the day, it’s the reader’s responsibility to not make bad decisions regarding their production server(s).

The majority of the issues that have been reported back to me have been regarding third-party modules. Perhaps they needed to be recompiled or perhaps they are old and unmaintained and will never work with the new setup. I don’t mind trying to help, but I think it’s unrealistic to expect someone else to know all of the nuances of your environment. All of the issues with third-party Apache modules have been modules that I’ve never even heard of. I did mention in the post that I run nginx and not Apache, one of my commenters actually acknowledged that and took the post with a grain of salt since he was in fact running Apache. The rest, who knows what happened.

So the moral of the story is to be smart as well as proactive before doing major upgrades on your production servers, especially if they are revenue generating. A small bit of research could save you a night or even days of headaches. Worst case scenario, you could save yourself from downtime for you as well as your users. Remember kids, not everything you read on the interwebs is true, and just because the author of a blog post ran into minimal issues doesn’t mean any and everything won’t go wrong for you.

In the future, I will be including disclaimers, a YMMV blurb and big, bold, possibly blinking, red warnings about the content of blog posts like that 😉

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.

If you found this article helpful, please consider buying me a coffee.