Straight to Production.

I work for realestate.com.au and recently we launched a new section of our site called Share. Previously, it used to exist on a physical data centre as a Perl application but now exists as a Rails app in the cloud using AWS. The re-platform was achieved in mere 7 weeks and was a direct result of the hack day culture at realestate.com.au. But thats not what I am, at this moment, going to talk about.

One of the features of the re-platform was the build pipeline that we constructed. A suite of tests which led to building an RPM; which gets deployed to an EC2 out of which we bake an AMI which then forms the basis of our active and inactive production environments. But the main beauty of this pipeline was that a commit from the development environment (which in our case is our/my laptop) goes straight to the inactive production. And since anyone, and I mean anyone in the team can switch inactive to active, there is a very real chance that a commit made now goes straight to production. This has not been done anywhere in my company up until now and as far as I know, anywhere in Australia. The only other company I know that does that is Etsy (and they do it extremely well).

This aspect of development was certainly new to me. And this definitely produced a new way of working for me. The immediate affect it has is that I immediately began thinking of what was covered by good tests and how much. Seems simple doesn’t it! This can only be a good thing. No person should live behind the walled garden of tests written by someone else. A feature of our development is that every time work on a feature is done, and we do handover to a person doing QA, not only do we handover the completion of the feature, but also have to show the coverage of tests and have to justify the tests.

Another aspect that is developed in me was to be sure ensuring that I am always pairing on the most important business features of the application. When I am changing some technical aspects of the code, for example, when I am changing

some_array.map {|x| x.something}

to

some_array.map(&:something)

I really don’t need to have a pair as I am changing how something is calculated and what is calculated remains the same.

But when I am changing some core business feature, for example what determines a a listing is active, i.e.

def published?
  self.status == :active
end

becomes

def published?
  self.status == :active && self.expiration_time > DateTime.now
end

This is a very core change in business functionality and because I know that this change goes straight to production, I KNOW I want a pair to check and double check this. The temptation is to get over with it because it looks simple and hence when we work in the walled garden of other people writing tests, we change the code, and write a bunch of simple tests and here you go. And to be honest, there are times when I have been tempted with this behaviour. The idea of me typing

[~:] $ git commit && git push

And it going straight to production has definitely made me aware of how aware I have to be of the implications of my code changes, from trivial to the non trivial.

These may seem small things initially, but over the course of the project, this mentality helped us deliver a complete revamp and re-platform in only 7 weeks. I encourage whoever is reading this, to definitely try this, but if you are not used to this, then start small. Maybe from a local project and then show the benefits to your work colleagues. I assure you that this approach is definitely worth a try.

About “Mujtaba Hussain”

I have no idea what to write here :(