The sun has set on my unbridled "cowboy coding" for the last time. (Geek alert. You've been forewarned.)
Traveling 5+ weeks and not touching Charitocracy the entire time was never my plan. I thought I would have remote access to my home server, but something went wrong. (I still don't know what, but I have some suspicions.) I set up a more reliable VNC connection as an immediate countermeasure when I returned home so this particular obstacle wouldn't repeat itself.
Really, though, I needed to rethink my overdependence on an old Mac Mini (MM). I chose it as my main staging server by virtue of it being the only unutilized Mac in my house, purchased as a home theatre PC before Apple TV made it obsolete. I used dynamic DNS to direct ch-y.org traffic to my home network, then my router port-forwarded to the MM. It just worked... except when it didn't. Namely while on my trip, and about half the times I tried logging into it from neighborhood coffee shops.
Meanwhile, I have a powerful mid-2015 MacBook Pro (MBP) at my fingertips any time I'm working. It runs circles around my circa 2009 MM. I never need to access it remotely over a questionable net connection. So why am I trying to use it as a dumb terminal into an ancient machine across the house, across town, or across the world as the case may be, with mixed success at the best of times?
Last week I declared an end to amateur hour by doing the following:
- I installed MAMP on my MBP.
- I set up a git source control repository (with origin backed by my iCloud drive) to host Charitocracy web code and database.
- I rebuilt the Charitocracy beta site from scratch on my MBP, submitting to git at intervals along the way, using my MM's site as a reference.
- I created a pre-commit hook that automatically adds a SQL database snapshot whenever I commit code changes.
- I installed and configured PageKite, a pay-what-you-want tunneling service which allows me to receive Charitocracy network traffic (including TLS/SSL) wherever I like, including on my MBP, even if I'm in a random waiting room or coffee shop (as I am right now).
- After proving the new beta site worked as well as the MM's, I pulled all the code and data back from git and proved I could easily clone the site on my MM, redirect PageKite to serve it up externally, make changes to the site on MM, and pull the changes (code and DB) back onto my MBP.
So I'm finally baking some real engineering discipline into my coding process. Nothing falls through the cracks. I can go back to previous snapshots of code and data. I can easily view and search through changes, even if they were in the DB or in code I didn't write myself, like plugins. I can travel. And all of this is quick and robust, because 99% of it is happening right on my laptop (credit card processing is one exception, but that traffic works seamlessly through PageKite, too). And if I get hit by a bus stagecoach tomorrow, you'll all be able to pick up where I left off, right?!
I still have plenty of engineering discipline yet to adopt, the sorts of things truly necessary when working in teams with fluid requirements and actual deadlines. So I reckon I'll just ⌘H the cowboy coder until the coast is clear. Yeehaw!