From 2404cf2e3ddf0456fe2cc1a399d6b1738c0798ad Mon Sep 17 00:00:00 2001 From: Dimitri Huisman Date: Tue, 9 Nov 2021 14:10:04 +0000 Subject: [PATCH] Fix for issue #1223 --- optional/fetchmail/Dockerfile | 3 +++ optional/fetchmail/fetchmail.py | 1 + setup/flavors/compose/docker-compose.yml | 2 ++ setup/flavors/stack/docker-compose.yml | 2 +- towncrier/newsfragments/1223.bugfix | 4 ++++ 5 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 towncrier/newsfragments/1223.bugfix diff --git a/optional/fetchmail/Dockerfile b/optional/fetchmail/Dockerfile index 995ec48f..0b3d4375 100644 --- a/optional/fetchmail/Dockerfile +++ b/optional/fetchmail/Dockerfile @@ -12,6 +12,9 @@ RUN apk add --no-cache \ RUN apk add --no-cache fetchmail ca-certificates openssl \ && pip3 install requests +RUN mkdir -p /data +RUN chown fetchmail:fetchmail /data + COPY fetchmail.py /fetchmail.py USER fetchmail diff --git a/optional/fetchmail/fetchmail.py b/optional/fetchmail/fetchmail.py index 4be3c2bd..3752c395 100755 --- a/optional/fetchmail/fetchmail.py +++ b/optional/fetchmail/fetchmail.py @@ -13,6 +13,7 @@ import traceback FETCHMAIL = """ fetchmail -N \ + --idfile /data/.fetchids \ --sslcertck --sslcertpath /etc/ssl/certs \ -f {} """ diff --git a/setup/flavors/compose/docker-compose.yml b/setup/flavors/compose/docker-compose.yml index 2675a2ab..5cdd6129 100644 --- a/setup/flavors/compose/docker-compose.yml +++ b/setup/flavors/compose/docker-compose.yml @@ -129,6 +129,8 @@ services: image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}fetchmail:${MAILU_VERSION:-{{ version }}} restart: always env_file: {{ env }} + volumes: + - "{{ root }}/fetchmail:/data" {% if resolver_enabled %} depends_on: - resolver diff --git a/setup/flavors/stack/docker-compose.yml b/setup/flavors/stack/docker-compose.yml index 24afa9f3..ae4f0022 100644 --- a/setup/flavors/stack/docker-compose.yml +++ b/setup/flavors/stack/docker-compose.yml @@ -110,7 +110,7 @@ services: image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}fetchmail:${MAILU_VERSION:-{{ version }}} env_file: {{ env }} volumes: - - "{{ root }}/data:/data" + - "{{ root }}/fetchmail:/data" deploy: replicas: 1 healthcheck: diff --git a/towncrier/newsfragments/1223.bugfix b/towncrier/newsfragments/1223.bugfix new file mode 100644 index 00000000..3c23d1a4 --- /dev/null +++ b/towncrier/newsfragments/1223.bugfix @@ -0,0 +1,4 @@ +Fixed fetchmail losing track of fetched emails upon container recreation. +The relevant fetchmail files are now retained in the /data folder (in the fetchmail image). +See the docker-compose.yml file for the relevant volume mapping. +If you already had your own mapping, you must double check the volume mapping and take action.