Dev Log 2016-05-30

With the launch of helm108 I’ve been diving back into the world of webops a fair bit, and I’ve been learning quite a lot as I go. I tend to have a few maintenance tasks I need to do, and some evenings or weekends usually get dedicated to solve these tasks.

I host a couple of wordpress sites for my parents and some of their friends, and I’ve been in the process of migrating them from shared hosting to a box on Digital Ocean. I’d never done this before and I was going to have to do it for five different sites, so as I realised the process wasn’t that simple I started noting down exactly what I had to do.

By the time I got to the fifth site, I had a big list of commands to paste into my terminal and all I had to do was rename things as appropriate, and I was very glad that I’d had the foresight to do that as the migrations were spaced out over several weeks and I would definitely have forgotten steps and had to relearn various commands.

It was a good lesson. So since then whenever I’m working on something, I take notes as I go. Not always detailed notes with every command I used, but enough for me to refer to and remember what I had done, what worked, what failed, what I had left to do.

So I’m going to IMMORTALISE THESE NOTES FOREVER in the form of sporadic dev logs.

Dev Log

Uptime monitoring for helm108 and other websites

I wanted to monitor the uptime of the various sites under my care. I assumed I’d be lucky if I found anything that let me monitor one or two websites for free, and then I discovered uptimerobot.com which lets you monitor 50 websites for free with a 5 minute interval. They’ve been running since 2010 so they seem like they must be pretty solid. Seems pretty good so far, I’ll see how it goes.

Dokku monitoring

All of my personal stuff is running in Docker containers which are handled by Dokku. I’ve had a couple of my tools stop working for seemingly no reason, and are fixed just fine by restarting their Dokku apps. I’m not sure if the problem lies with Dokku or my code, so I had a look to see how I could go about monitoring Dokku and I found a couple of plugins I can install but I’ve decided to leave it for later.

I’m tempted to drop Dokku and switch to using PM2 and starting all my node processes manually, so investing more time in Dokku feels questionable, but I’ll probably stick with it for now.

letsencrypt auto renew

My Dokku apps are all using Let’s Encrypt certs, but they only issue 90 certificates so I have a cron job running every seven days to run the auto-renew command. I thought I’d set it up to email me the results of said command but I’d never received anything, so I did a bit more research and I think I’ve fixed it. I’ll have to wait for whenever it next tries to renew them.

MainWP

I wanted to use MainWp to manage the Wordpress sites I host but I’m having a hard time getting the child sites to connect to my MainWP install. I think it might be because they’re on the same box. I need to run MainWP from a different host as a test; I will do this some other day.

Caching

My sites are all behind Cloudflare, but I’d noticed that the caching wasn’t working properly. After some searching I found that wepbagetest.com is good at telling you what you’re doing wrong, and that pointed me in the right direction. My understanding so far is that by default Cloudflare honours the caching rules specified by the origin server, but Dokku’s default nginx config doesn’t really have any caching rules in it.

I couldn’t figure out how to modify the default nginx.conf template Dokku has (you can provide a custom template per Dokku app but I wanted to modify all of them), so I settled for using Cloudflare page rules to specify what should be cached. That raised my webpagetest caching rank from a D to a C, but my time to first bite also dropped below 500ms netting me another A, so I thought that was a good start.

I could figure out to make Dokku do what I want, but it’s becoming another reason to just stop using it. I feel like getting better at nginx would be a better use of my time than getting better at Dokku in terms of transferable skills.

One upshot of this was, unsurprisingly, that I now need to worry about cachebusting Iomante’s static assets when I push changes up. Right now this is handled manually (I stuck ?cb=1 on the end of the script references), I may automate this in the future if it becomes a problem but since chapter two is basically done it’s unlikely to need many further changes. I might address this for chapter three, whenever that happens.

End

It’s been a productive weekend.