Home Server Mk. 2

With everything I learned in the development of Mk. 1 I had a better idea of what Mk. 2 was going to be.
I knew it was all going to be built on the back of Docker Compose, after completely borking up my bare metal server dozens of times, I knew I wanted as little dependencies installed locally as was physically possible. Almost every service I have running on Mk. 2 came as a pre-packaged container, with a few built from scratch API servers built on boiler plate containers.
The screenshot below is of my Heimdall container it's like a web launcher for all of my other home server apps. Heimdall is just one of the many completely free, open-source containers LinuxServer.io offers. I cannot praise them enough, their containers are phenomenal, well documented, and almost all plug-n-play. I'm not affiliated with them, but I've used a dozen of their containers and love them all. I'm not going to discuss every container seen in the screenshot, but I will cover what is essentially the backbone of Mk. 2.

To get started, it's important to note that when I refer to a container, it is generally defined by a few lines of code. The screenshot below is a fairly average length definition for a container in Docker Compose. It has a name, an image (the pre-packaged container,) some settings, and environment variables. The container below updates my CloudFlare DNS account when my IP changes.

Files & File Management with Docker Compose
I've pared down my file structure to be as simple and quick to navigate as possible. If there is any configuration files, or if I want to manipulate files inside of a container, it gets it's own little directory in the data directory.

If I want to give a container access to system files it gets a volume where the left side of the definition is the directory on the system and the right is the directory on the container. This effectively creates a live connection between the two. The below definition gives my Netdata container Read Only (:ro) access to the system files to monitor performance.
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
Linking files and directories in containers to the local system makes it really easy to see what's going on, you can be as restrictive or permissive as is needed. Usually I use it for logs/configs as seen in the definition below.
volumes:
- ./data/pt_wings/config:/etc/pterodactyl/
- ./data/pt_wings/logs:/var/log/pterodactyl/
Services I Use Nearly Every Day
Some of the services I have running on Mk. 2 are set it and forget it, some are tools I use nearly every day. Some of those are Portainer, Dozzle, and Netdata. My Docker Compose definitions are almost identical to those found in their respective Docker Hub pages.

Portainer:
I don't use Portainer to create containers even though it can do that, I still write my docker-compose.yaml files by hand and usually start containers initially via CLI. That being said, it is phenomenal for getting a high level view of different projects I have going on, each docker-compose.yaml represents a "Stack" in Portainer.

When viewing a stack it gives you an overview of each container in that stack. You can easily see at a glance their name, state, ports, and you can start/stop/restart, basically most of the high use commands in the docker compose package.

Dozzle:
Dozzle is great for quickly viewing logs and Memory/CPU usage per container, Portainer also has log viewing capability but it's less feature rich than Dozzle. You can see Dozzle has a very similar stack/container layout in it's navigation as well.

Netdata:
Now, if you read my post on Mk. 1 then you know I built a Laravel application leveraging CAdvisor, Prometheus, and Grafana to create a system monitoring page. That was months of development. Well I replaced all of that with Netdata in about 5 minutes. It let's you view basically anything going on in the system, the free version has more information available than I'll ever use. It's great to see what is going on with the bare metal server itself.

Other Important Services
There's a lot more services that go into running Mk. 2. I'll cover most of them briefly here.
Docker Socket Proxy:
This is a super simple container that replaces any lines where you would otherwise need to allow a container (like Portainer) to access the Docker Socket which is used for starting/stopping/other Docker operations. It acts as a security gateway/proxy for those requests.
NGINX Proxy Manager:
I could rave about this for days, but it will require it's own article along with other advanced networking topics. For now, suffice to say it makes managing reverse proxies, caching, SSL, and HTTPS routing incredibly simple.

These are some services I basically forget exist most of the time.
DockerGC:
This just frees up resources that are left dangling in Docker environments
WatchTower:
This is great as it keeps the docker containers up to date automatically, although sometimes you may not want that.

Conclusion
That about wraps it up, those were some of the first services I got running on my home network, and they laid the ground work for dozens of projects to follow. They make managing my projects super simple.