I made a thing

Posted: 8th Feburary 2015

First post of 2015! and first post in the last... 5 months so I'm doing well (as ever).

Anyway, for once this isn't a post about how I've not posted recently (although it should be) or about what I've been up to generally (although there's a fair bit to put in there as well...) it's not even about something I've only got 50% of the way done (well sorta). No, it's about a thing that is at least at the minimal viable product stage.

Backstory: my partner (go look at/buy her awesome stuff here) wanted a way of tracking her mood & sleep patterns. I foolishly promised to make her a web app to do this with as her Christmas present. I mere 2 months late I've finished. This article won't be an in-depth write up of how I did it, if you're interested in that the stack's in the side-bar and I may write it up later. Instead I'm going to write up a bit about what I learnt doing this, keeping in mind that although I've now been a webdev for over a year(!) I've never actually built a site from scratch before (although I have done all of the bits separately).

So here are some number of things I learnt:

There's a hell of a lot more boilerplate than I remember

There are tools like yeoman and bower that claim to remove some of this but having poked them a bit for this project I realised that I'd have spent as much time removing excess cruft as I would have done writing boilerplate. These strike me as very useful if you're writing a dozen sites a year and you have a very fixed set of things you want each and every time. For me I'm generally toying around with different stuff and I just don't make that many sites...

Sod bower

Talking of bower I tried it a bit at the start of this and I really can't see the advantage of yet another repo manager. We use this a bit at my current work and it causes more problems that it solves the number one of which is a lack of consistent structure to the stuff it installed (being pulled directly from Github). Lack of consistency in structure & naming makes it a pain if you want to just concat all the minified versions of libraries people provide (rather than pointlessly doing it yourself). Rather than use bower I manually downloaded what I wanted and had two library folders: one for un-minified libraries, the other for those that are. This way at build time I can just concat all the *.min versions of the files together and get on with my life.

Apache2 still confuses the hell out of me

Less so that any other time I've had to poke it but good gods was I taking a lot on trust to get the site up. I'm pretty sure I did it right but there seems to be a weird gulf between "here's how you make django run locally as dev" and "here's how you deploy your app in a vaguely production worth way" both in terms of tutorials and support. Unless you're using something like heroku or AWS then there's a lot you need to hack through to figure out how to deploy your stuff. And if you do use something like AWS or Heroku then enjoy moving it... Anyway I think this time I got the apache2 stuff down ok (and really got a chance to kick wsgi for a bit).

Deploy stuff is annoying

I actually finished the site for Christmas day (at least a bare bones local version). I then took some time off from it to enjoy the holidays but since about the 2nd weekend of January most weekends have been fighting to get deploy stuff working. Some of this was the above apache2 wrangling (so much conf) and other fun things (figuring out how to set up subdomains) but a lot was get getting what I needed from my laptop to the server and running with as much consistency and as few commands as possible. In the end I used Grunt for building and Fabric for deploying but it took a while. Annoyingly I still have to run these separately as calling grunt from fabric makes the later choke...

Anyway hopefully I'll have a better write up soon of what I actually did as well as some sort of guest account on the actual app so people can play with it (or I may just host another version on heroku or aws).