My blog was down

My blog was down
umami shows no visitors and page views on 19.08.2021 - my downtime

Even though I work in the field of cloud hosting and have learned a lot there, my blog was still down for a stupid error.

Out of curiosity I checked my analytics tool (umami) and could not reach it. It is running on the same server this blog is running on, so I had a look. I also checked my mails, since I did setup an E-Mail notification from UptimeRobot but since I do not get notified for E-Mails and do not check them that often I did not notice the downtime.

UptimeRobot shows ~ 8 hours of downtime on 

As you can see in the image I had some time in the afternoon to fix the problem.

Turn out my OS drive was 100% full ️😅

But why?

I am using watchtower to automatically update my docker images and therefore the software on this server.

This contains

  • caddy:2
  • ghost:4
  • ghcr.io/mikecao/umami:postgresql-latest
  • postgres:12-alpine

Every time when Ghost is pushing a new image to the tag ":4" watchtower will pull the new image and run the new version. That way I am always on the latest version.

But docker keeps all the images.

Solution

Create a systemd service and timer to delete unused images every day.

Here is the docker prune service:

cat /etc/systemd/system/docker-prune.service

[Unit]
Description=Delete not used docker images
Wants=docker.service

[Service]
Type=oneshot
ExecStart=/usr/bin/docker image prune -f

[Install]
WantedBy=multi-user.target

Here the docker prune timer:

cat /etc/systemd/system/docker-prune.timer

[Unit]
Description=Timer to delete not used docker images
Requires=docker-prune.service

[Timer]
Unit=docker-prune.service
# Every day at 4am
OnCalendar=*-*-* 4:00:00

[Install]
WantedBy=timers.target

That way I can keep the automatic updates and enjoy a less maintainance work for my hobbies like this blog and will not have any downtime because of this reason (hopefully).

I am surry for the around 10 to 20 people who visit my blog  everyday, but honestly it will not kill me. I rather have a downtime (could be shorter next time 😉️, I admit that) than old and unsecure software.

Thanks for reading, I wish you a great day without downtimes!