Categories
Affiliate Stats Tracker

Automating Deployments

Over the last few days – more than I’d have liked, honestly – I’ve been busy automating the process that Affiliate Stats Tracker goes through after I’ve finished writing code.

Whether it’s a bug fix, or a new feature, all code changes go into a review process.

Hmm, yes, this all looks like something I understand…

Once the review passes, the next version of Affiliate Stats Tracker gets “built”. What this means is that for Windows, an .exe file gets created. For Mac, the .dmg file, and for Linux… well, a bunch of different files get created – because Linux is for nerds, and nerds are a picky bunch. (As a software developer, imagine which category I fall in to?)

What this previously meant was that I’d have to boot up a PC running Windows to make the .exe file.

And then I’d have to load up my Macbook to make the .dmg file.

The only thing I had automated was the Linux version of Affiliate Stats Tracker, and that’s the least popular version. By some considerable distance 🙂

An Army Of Robots

The problem I began facing was that I’d end up putting off the Windows and Mac builds because they took up a bunch of time to complete.

Not good enough, Chris. Not. Good. Enough.

I knew that I could automate this process for Mac and Windows, as I had done for Linux. Let the computer(s) do the hard work, right? After all, that’s a big part of why I build Affiliate Stats Tracker in the first place.

In truth I was concerned that creating these Mac and Windows “pipelines” (sorry, nerd talk) would be difficult. That was a reason I’d put it off in the first place.

Several hundred attempts later…

As usual, it turned out not to be as difficult as I’d imagined.

However, the trickier part became how to get the newly minted .exe and .dmg files from the computers that did all the building over to this server that hosts the website and the download files.

This was made tricky by the fact that when the Affiliate Stats Tracker app is created, it will have a file name like “Affiliate-Stats-Tracker-1.7.1.exe” and the last thing I wanted to do was to have to log in here and update the download link to the very specific version whenever I did a new release.

After all, the whole point of this exercise was to remove the need for me to be involved once the code passes review.

I tried a bunch of things here.

In the end I went with a really simple approach instead:

The long winded file name, e.g. “Affiliate-Stats-Tracker-1.7.1.dmg” is uploaded, and then a short version is also copied from that file, and renamed e.g. “Affiliate-Stats-Tracker.dmg“.

That sounds really obvious – why not just do that in the first place?

Well, I was trying to save disk space. A largely fruitless endeavour, given the server has over 2TB of disk space and only about 5% of that is used.

Was It Worth It?

It’s a really good question.

I spent about 5 days in total, with maybe 30 hours invested in the process.

Previously a deployment would take me about … 10 minutes?

So, some back of the napkin maths says I need to do about 180 new deploys before I recoup my time investment.

Chris: you fool!

Yeah. Sometimes I think I get side tracked by things like this. I suspect it’s an ego thing. I won’t let the computer beat me once I set my mind to a task I want it to do.

I think it’s a really useful place to be, but I kinda wish I’d spent those 30 hours making Affiliate Stats Tracker more useful, and doing a bit more marketing.

Still, we’re here now. And at least it’s automated.