Containerization of my server 🐋

Published on 10/11/2024

ContainersDockerUbuntuLinuxBashCI/CD

When I started out with my first Ubuntu server I manually installed everything that I needed. Postgres, Plex, some game servers like Minecraft and Factorio and many more.

But eventually I found out that I have a hard time making small improvements to existing applications. For Plex I wanted to auto update it, so I got a random update script from GitHub. Of course this was going to break, and it did after a while. It was also hard to find the update file because I put it all over the place. And not in my user space. Then I was getting issues with files being saved as root. Which makes cleanup difficult as I need to also be read to fix everything.

Eventually I wanted to move everything to some sort of easier setup. So I started to migrate away everything to containers. Specifically Docker Compose hence the Composes Github repository name. I could have choosen to run something like a K3s or K9s cluster. But for a small server without replication, I think using Docker Compose is just fine.

Here is a small (not really up-to-date) list of things I have running currently on my server:

Containers

Installed natively, but which I want to migrate soon

Scripts

I also created some scripts to more easily update all containers. Check out the repository’s scripts directory.

As example I have this simple update script, where you can give the compose folder name and it will bring all containers down, pull new versions and bring them up again.

#!/bin/bash
git pull

services=("$@")
if [ ${#services[@]} -eq 0 ]; then
  services=("traefik" "portainer" "scrutiny" "jellyfin")
fi

for service in "${services[@]}"; do
  cd "../$service/"
  pushd .
  docker-compose down
  docker-compose pull
  docker-compose up -d
  popd
done

Composes Repository