The perils of self updating web apps

18 Feb 2020 • 3 min read

# The perils of self updating web apps

So I've used Grav since 2017 to power my project and blog pages. It's a flat-file Content Management System. It's really easy to use and takes away a lot of the pain of setup. By easy to use I mean you don't ever have to use the command line after the initial setup and the admin pages and general look and feel are really nice and clean.

Internally, Grav uses markdown files to store the user pages using frontmatter to store meta-data such as tags, publication date, etc. It seems that a log of blog and cms systems use this of late as it entirely removes the need for a database and isn't that hard to pickup.

# What went wrong?

Well, every time you login to the Grav admin page it checks for updates and casually lets you know there's an upgrade via a popup. It also checks all installed modules as well. It makes upgrading painless ..... except when it goes wrong. Basically Grav complained about the gateway timing out via a popup.

Oh dear!

Refresh the page and boom, presented with a Please run bin/grav install banner on a white screen.

Okay.... this might have been a harmless timeout. So I login via ssh, goto the needed directory and run the installer and I see many errors like so: tls_process_server_certificate:certificate verify failed.

This is because, like all systems today, Grav uses many 3rd party things and downloads them from other sites. Why this suddenly started happening recently I don't know - I've not updated my server at all.

To be clear, this isn't Grav's fault or error - the failure is somewhere in PHP, OpenSSL or the website in questions HTTPS configuration.

# What can be done about it?

It's possible to fix it for sure, but maybe this is the wrong approach. The vast majority of my site does not accept any data and Static Site Generators have come a long way since I last looked at them. The idea being that a static site has zero runtime dependencies so it's always working. The downside being it can still go wrong as can any other application but you, the end user, does not see this. The other downside is that they build a lot of files and this takes time.

All of them seem to use Markdown and Frontmatter like Grav as their data storage so in theory it should be fairly simple to install some and try them out.

I settled on VuePress mainly because I use Vue.js on a side project I'm working on. VuePress is mainly for documentation though (ie, perfect for my open source projects) but as it turns out isn't that great for blogs! Luckily there is a blog plugin, but the the downside is that you need to set it up as a different site. Thanks to too much cleverness in VuePress, my blog link looks like an external site which I'm not overly keen on. Also, the blog insits on using the date in URLs which I'm not too sure about either.

But it's a start, it's up and working and renders really well on mobile devices. Let's see how long this lasts 😃