|
1 | 1 | # Known issues and limitations |
2 | 2 |
|
3 | | -- Chatmail will be reinstalled every time the container is started (longer the first time, faster on subsequent starts). This is how the original installer works because it wasn’t designed for Docker. At the end of the documentation, there’s a [proposed solution](#locking-the-chatmail-version). |
4 | 3 | - Requires cgroups v2 configured in the system. Operation with cgroups v1 has not been tested. |
5 | 4 | - Yes, of course, using systemd inside a container is a hack, and it would be better to split it into several services, but since this is an MVP, it turned out to be easier to do it this way initially than to rewrite the entire deployment system. |
6 | 5 | - The Docker image is only suitable for amd64. If you need to run it on a different architecture, try modifying the Dockerfile (specifically the part responsible for installing dovecot). |
@@ -59,6 +58,7 @@ cp ./docker/example.env .env |
59 | 58 | - `PATH_TO_SSL` – Path to where the certificates are stored. (default: `/var/lib/acme/live/${MAIL_DOMAIN}`) |
60 | 59 | - `ENABLE_CERTS_MONITORING` – Enable certificate monitoring if `USE_FOREIGN_CERT_MANAGER=true`. If certificates change, services will be automatically restarted. (default: `false`) |
61 | 60 | - `CERTS_MONITORING_TIMEOUT` – Interval in seconds to check if certificates have changed. (default: `'60'`) |
| 61 | +- `CMDEPLOY_STAGES` – Deployment stages to run on container start. (default: `"configure,activate"`). Set to `"install,configure,activate"` to force a full reinstall. |
62 | 62 |
|
63 | 63 | You can also use any variables from the [ini configuration file](https://github.com/chatmail/relay/blob/main/chatmaild/src/chatmaild/ini/chatmail.ini.f); they must be in uppercase. |
64 | 64 |
|
@@ -114,79 +114,19 @@ docker compose down |
114 | 114 | docker compose up -d |
115 | 115 | ``` |
116 | 116 |
|
117 | | -## Locking the Chatmail version |
| 117 | +## Forcing a full reinstall |
118 | 118 |
|
119 | | -> [!note] |
120 | | -> These steps are optional and should only be done if you are not satisfied that the service is installed each time the container starts. |
| 119 | +The Docker image bakes the install stage (binary downloads, package setup, chatmaild venv) into the image at build time. On container start, only the `configure` and `activate` stages run by default. |
121 | 120 |
|
122 | | -Since the current Docker version installs the Chatmail service every time the container starts, you can lock the container version after installation as follows: |
123 | | - |
124 | | -1. Commit the current state of the configured container: |
125 | | - |
126 | | -```shell |
127 | | -docker container commit chatmail configured-chatmail:$(date +'%Y-%m-%d') |
128 | | -docker image ls | grep configured-chatmail |
129 | | -``` |
130 | | - |
131 | | -2. Change the entrypoint for the container in `docker-compose.yaml` to: |
132 | | - |
133 | | -```yaml |
134 | | -services: |
135 | | - chatmail: |
136 | | - image: <image name from step 1> |
137 | | - volumes: |
138 | | - ... |
139 | | - ## custom resources |
140 | | - - ./custom/setup_chatmail_docker.sh:/setup_chatmail_docker.sh |
141 | | -``` |
142 | | -
|
143 | | -3. Create the file `./custom/setup_chatmail_docker.sh` with the new configuration: |
| 121 | +To force a full reinstall (e.g., after updating the source), either rebuild the image: |
144 | 122 |
|
145 | 123 | ```shell |
146 | | -mkdir -p ./custom |
147 | | -cat > ./custom/setup_chatmail_docker.sh << 'EOF' |
148 | | -#!/bin/bash |
149 | | -
|
150 | | -set -eo pipefail |
151 | | -
|
152 | | -export ENABLE_CERTS_MONITORING="${ENABLE_CERTS_MONITORING:-true}" |
153 | | -export CERTS_MONITORING_TIMEOUT="${CERTS_MONITORING_TIMEOUT:-60}" |
154 | | -export PATH_TO_SSL="${PATH_TO_SSL:-/var/lib/acme/live/${MAIL_DOMAIN}}" |
155 | | -
|
156 | | -calculate_hash() { |
157 | | - find "$PATH_TO_SSL" -type f -exec sha1sum {} \; | sort | sha1sum | awk '{print $1}' |
158 | | -} |
159 | | -
|
160 | | -monitor_certificates() { |
161 | | - if [ "$ENABLE_CERTS_MONITORING" != "true" ]; then |
162 | | - echo "Certs monitoring disabled." |
163 | | - exit 0 |
164 | | - fi |
165 | | -
|
166 | | - current_hash=$(calculate_hash) |
167 | | - previous_hash=$current_hash |
168 | | -
|
169 | | - while true; do |
170 | | - current_hash=$(calculate_hash) |
171 | | - if [[ "$current_hash" != "$previous_hash" ]]; then |
172 | | - # TODO: add an option to restart at a specific time interval |
173 | | - echo "[INFO] Certificate's folder hash was changed, reloading nginx, dovecot and postfix services." |
174 | | - systemctl reload nginx.service |
175 | | - systemctl reload dovecot.service |
176 | | - systemctl reload postfix.service |
177 | | - previous_hash=$current_hash |
178 | | - fi |
179 | | - sleep $CERTS_MONITORING_TIMEOUT |
180 | | - done |
181 | | -} |
182 | | -
|
183 | | -monitor_certificates & |
184 | | -EOF |
| 124 | +docker compose build chatmail |
| 125 | +docker compose up -d |
185 | 126 | ``` |
186 | 127 |
|
187 | | -4. Restart the service: |
| 128 | +Or override the stages at runtime without rebuilding: |
188 | 129 |
|
189 | 130 | ```shell |
190 | | -docker compose down |
191 | | -docker compose up -d |
| 131 | +CMDEPLOY_STAGES="install,configure,activate" docker compose up -d |
192 | 132 | ``` |
0 commit comments