Skip to content

Self Hosted

Creating True Database Backups with Dumps

Too often I see folks relying on copies of a persisted database volume mount. While it is great people are backing up their database volumes, backing up a database volume can easily result in a corrupted backup unless the docker container is properly turned off prior to the backup. We like our containers running 24/7 though!

In this post, let's introduce ourselves to the following:

  • fradelg/mysql-cron-backup for MySQL / MariaDB
  • prodrigestivill/postgres-backup-local for Postgres

Setting up NextCloud AIO

We already have Nginx set up as our reverse proxy so that changes the docker command a bit. NextCloud AIO is simply portainer-like container management for NextCloud containers. We simply run a docker run command to initialize the AIO interface and from there we configure the containers. If you run most of your apps with docker compose, this is slightly annoying because you cannot manage your containers like you normally would, you have to do so through the abstraction of the AIO interface.

Setting up Loki/Grafana in Docker to analyze Nginx logs

To be honest, it's a little confusing how to get started because there are lots of instructions out there and docker compose files floating around that are outdated. Let's follow the official docs at https://grafana.com/docs/loki/latest/setup/install/docker/#install-with-docker-compose.

The docker compose file from the docs as of today is here: https://raw.githubusercontent.com/grafana/loki/v3.4.1/production/docker-compose.yaml. Note that the link is likely subject to change with new versions.

Nginx in Docker with GeoIP

To use the GeoIP2 module, we pretty much need to use a Dockerfile to start with the latest nginx, but then compile the GeoIP2 module from source. This is preferred because using precompiled binaries is actually challenging - we have to ensure we get the binary that was compiled with the same nginx version that we have. Compiling the module ourselves actually simplifies this process.

Nginx in Docker with Local Let’s Encrypt Certs

Docker Project folder

├── docker
│   ├── nginx
│   │   ├── docker-compose.yml
│   │   ├── cloudflare.ini
│   │   ├── nginx.conf
│   └── └── (any additional confs for server blocks)
└────────────