Containerization of my server 🐋

Published on 11/10/2024

ContainersDockerUbuntuLinuxBashCICD

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 list of things I have currently running 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
source helpers/pull.sh
source helpers/services.sh
source helpers/remove_portfolio.sh

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

I also checked on how to insert pieces of other code so I can re-use and not duplicate the code all over the place. For example pulling repositories getting a list of all services. Those are always the same or should be only edited in one place. And this all can be done using source [PATH/FILE.sh].

So the list of folders are now not duplicated anymore and I can change them in one file only:

#!/bin/bash
services=("$@")
if [ ${#services[@]} -eq 0 ]; then
  services=("bedrock" "jellyfin" "portainer" "scrutiny" "traefik" "watchtower" "notifiarr")
fi

Want to check everything? Check out or clone the GitHub, but be warned that I made a specific folder structure. So this will not work right away for everyone.

Composes Repository