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
- Portainer: to see and debug containers without using the CLI.
- Watchtower: to keep all containers up-to-date as much as possible.
- Traefik: to proxy all connections and make them support HTTPS (SSL) only connections.
- Jellyfin: to display my media.
- Transmission: to download torrents.
- Flood: torrent UI to manage them online.
- Gluetun: VPN networking container
- Prowlerr: indexer for Radarr and Sonarr.
- Radarr: searches for movies.
- Sonarr: searches for series and anime.
- Bazarr: searches subtitles for all movies, series and anime.
- Jellyseer: people can request for movies, series or anime.
- Scrutiny: to see the SMART status of all drives in the system.
- Bedrock: A bedrock minecraft server to play with friends.
- Satisfactory: A Satisfactory server to play with friends (currently off though).
- Portfolio: My own portfolio, because the hosting I was using is raising their price to 8x the original price.
Installed natively, but which I want to migrate soon
- Samba: To serve files on my local network.
- Minecraft Server(s): to play on of course
- Better MC Java
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
doneI 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")
fiWant 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.