Tom Newby

Sunsetting PiggyBike

27 Oct 2018

TLDR: I’ll be shutting down PiggyBike at the end of the year.

I built PiggyBike back in January 2016 when I was bored on the Christmas break from work. I never really expected it to get the reach it did, but I was very happy that several hundred of you folks signed up and tracked your commutes! I also met quite a few of you, both online and in person, which I never really expected from this project either - that was cool.

When I first built PiggyBike, hosting was about $5 per month - I’d hoped to find some ways to cover these costs. I tried affiliate marketing with an online bike retailer at the start and I think I might have even covered one months bills with that before the retailer pulled out of the affiliate program. Ultimately, work and life stuff meant it was difficult to find the time to pour into trying to find new ways to get some coin. Instead I just opted to pay for the servers each month.

Luckily - it was pretty cheap to run and was all automated after a while, but there was a few classic moments before that.

From the start, I had setup the command to send everyone their monthly savings report but I still needed to manually trigger the command each month (log into the server, run the command). Now, I should have either setup a cron job (scheduled task) to run it automatically each month or at the very least I should have created a recurring calendar event to remember to send it.

Naturally, I did neither of those things for close to 12 months.

I remember heading out for work drinks on a Friday evening and meeting a coworker’s partner (a PiggyBike user) and the first thing he had said to me was “I haven’t got my PiggyBike email yet - it’s a bit late!”

Shit - another month I forgot, whoops.

Some months later, I had realised the end of the month lined up with my holiday to Norfolk Island. I recall logging into the server via a very flaky internet connection (a few seconds latency) to run the command and send everyone their monthly email.

After being routinely chided by some co-workers for still not automating it, I finally setup the cron job to send out the email each month and everyone started getting their emails on time!

There was also a period where I was regularly getting error messages to my phone as the app was locking and crashing. At the time, my only real remedy was rebooting the server, which I then discovered I could do from my mobile phone. Luckily - because it was happening pretty regularly and often when I was not at a computer (once I was at Woolworths #devshops)

Whenever I looked at exception logs, it never made much sense other than “the app is getting hammered” but when I checked the analytics, there was rarely more than one or two people using the app while it happened. Drawing some similarities between failures it seemed to occur:

  • sometime between 5-7pm (Brisbane time)
  • only on sunny days in Brisbane
  • more likely to occur after lengthy periods of rain in Brisbane

Eventually, after some more diagnostics, it occurred to me that everyone was finishing rides and uploading to Strava at pretty similar times in the afternoon, and lengthy periods of rain got everyone itching to ride to work again. After each ride was uploaded, Strava would send the app some data about the ride and PiggyBike would do some calculations and some database operations. Enough of this at once would starve the server of it’s already scant resources, it would crash MySQL and the app would fall over.

After considering whether to add in some more background processes to delegate the work a bit, I opted to pay $10/mth for a slightly larger server on DigitalOcean and never had the issue again.

Really for the last 18 months, nothing has really gone wrong and it’s taken practically none of my time. However, PiggyBike is relying on some now deprecated APIs from Strava. My understanding is that the app could still work with the newer Strava API but it’s just too much work for me to take on personally.

So - at the end of the year I will shutdown PiggyBike.

Safe riding,


Follow me on Twitter: @tomnewbyau