From 28b7427c7ed510b890c3ea7b24112fb003ca92d7 Mon Sep 17 00:00:00 2001 From: hygienic-books Date: Thu, 14 Jul 2022 03:43:33 +0200 Subject: [PATCH] docs(mailcow): Document env var changes we're making --- mailcow/README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 mailcow/README.md diff --git a/mailcow/README.md b/mailcow/README.md new file mode 100644 index 0000000..0c52396 --- /dev/null +++ b/mailcow/README.md @@ -0,0 +1,45 @@ +# Overrides for mailcow-dockerized + +Provides files that are meant to be copied into your location of the [github.com/mailcow/mailcow-dockerized](https://github.com/mailcow/mailcow-dockerized) repo thereby customizing its behavior. + +yq 'del( .services.[].environment.[] | select(. == "TZ=*") ) | del(.. | select( (tag == "!!map" or tag =="!!seq") and length == 0)) | del( .services.[].restart )' /opt/containers/mailcow-dockerized/docker-compose.yml | yq --indent 4 ea '. as $item ireduce ({}; . * $item )' - /opt/containers/mailcow-dockerized/docker-compose.override.yml > /opt/containers/mailcow-dockerized/docker-compose.final.yml + + +* Env variables + ``` + yq 'del( .services.[].environment.[] | select(. == "TZ=*") ) | del(.. | select( (tag == "!!map" or tag =="!!seq") and length == 0))' ... + ``` + From all `.services.[].environment.[]` lists remove items that match the expression `TZ=*`. Realistically this removes the `TZ` environment variable declaration and in some cases leaves the `environment` list empty. If the list now truly is empty delete it. + + Given a file: + ``` + services: + unbound-mailcow: + image: mailcow/unbound:1.16 + environment: + - TZ=${TZ} + volumes: + - ./data/hooks/unbound:/hooks:Z + ``` + Step one does: + ``` + services: + unbound-mailcow: + image: mailcow/unbound:1.16 + ---> environment: + volumes: + - ./data/hooks/unbound:/hooks:Z + ``` + We detect that `environment` is now empty and delete it: + ``` + services: + unbound-mailcow: + image: mailcow/unbound:1.16 + ---> volumes: + - ./data/hooks/unbound:/hooks:Z + ``` +* Restart policy + ``` + del( .services.[].restart ) ... + ``` + From all services delete restart policy declaration. We're defaulting to `unless-stopped` via the `extends:` directive.