Docker Compose: Icinga 2 HA Cluster

If anyone is interested, I am putting together an HA Cluster using Docker Compose. Still a work in progress, but I have the Masters/Satellites built with IcingaWeb2 and all the bells and whistles working. You can find it on GitHub.

Last time a built an HA Cluster with Icinga2 was over 7 years ago, and it’s still used today.

I did realize something, from way back… Creating a Master 1 on a VM, cloning the VM, and renaming it as Master 2 was so easy. Compared to creating the HA Cluster with the Docker containers. :sad_but_relieved_face:

For anyone who’re interested, here’s an update.

  • Added some nrpe hosts. nrpe isn’t a default plugin anymore. :confounded_face:
  • Changed the ./setup.sh to use the api
    • Still need to run it twice on Master 2, have to sync the CA first.
  • Added a central plugin image. Kinda broken without deps. Nagios ecosystem appears to be deteriorating

Never used Director, so the read-only probably breaks those users.


There’s an ephemeral nature to Docker Compose, while Dockerfile focuses on building stable, reusable images.

services:
  aaa:
   image: y:y
  bbb:
    build: compose.yaml
    data: more_data
  ccc:
    build:Dockerfile
    data: additional_data

I took nginx-node-redis and went a little deeper. Using compose.yaml to use Dockerfile files and nested composer.yaml files.

.
|-- compose.yaml
|-- i2m1
|   |-- compose.yaml
|   |-- etc
|-- i2m2
|   |-- compose.yaml
|   |-- etc
|-- i2s1
|   |-- compose.yaml
|   |-- etc
|-- i2s2
|   |-- compose.yaml
|   |-- etc
|-- icingaweb2
|   `-- compose.yaml
|-- nrpe
|   |-- Dockerfile
|   |-- entrypoint.sh
|-- plugins
|   |-- Dockerfile
|   |-- entrypoint.sh

Reusable Images

For the reusable images, needed to make sure the data was updated. Ignoring any cached data. --no-cache flag does not work with Composer. Need to add no_cache to the yaml.

  top:
    build:
      context: ./Dockerfile
      no_cache: true

In summary, extra steps are needed to updated a reusable image.

docker compose up top --build --no-cache # ERROR
docker compose up top --build # uses: no_cache: true

The --nocache does not work for Docker Compose. Need to use: no_cache: true