docs(mailcow): Document env var changes we're making

This commit is contained in:
hygienic-books 2022-07-14 03:43:33 +02:00
parent 58d2c7b0ac
commit 28b7427c7e

45
mailcow/README.md Normal file
View File

@ -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.