medic / cht-watchdog

Configuration for deploying a monitoring/alerting stack for CHT
GNU Affero General Public License v3.0
4 stars 7 forks source link

Add abstraction/command-control layer for running different configurations of Watchdog #103

Open jkuester opened 6 months ago

jkuester commented 6 months ago

One of the nice things about Watchdog is that its configuration is setup to allow for different configurations of Watchdog containers to be deployed without needing to manually edit docker compose files. Instead, system admins just need to include their desired files when running docker compose commands.

The problem is (especially after https://github.com/medic/cht-watchdog/pull/102) we are getting to have quite a few compose files and might end up with more in the future. It would be nice to have some abstraction layer above the compose files that would allow for flexibility without admins having to remember which compose files to include in each command.

There are a number of ways this could be implemented:

With any of these methods, I think you could set an envar like WATCHDOG_MODE in the .env file and that could automatically cause the proper docker compose config to get selected.

mrjones-plip commented 6 months ago

A fun fourth option that @jkuester and I discussed on a call today where the image declaration can get overridden with env vars. So where we might have this today (all this if untested faux YAML):

image: prom/prometheus:${PROMETHEUS_VERSION:-v2.46.0}

Tomorrow we could have this:

image: ${PROMETHEUS_ORG:-prom/}${PROMETHEUS_IMAGE:-prometheus:}${PROMETHEUS_VERSION:-v2.46.0}

That way if you wanted to change the image to effectively null, you could set PROMETHEUS_ORG to ` (NULL) andPROMETHEUS_IMAGEtoalpine`. This way the service will start with just alpine image and do nothing.