diff --git a/optional/fetchmail/Dockerfile b/optional/fetchmail/Dockerfile index 995ec48f..068a5dce 100644 --- a/optional/fetchmail/Dockerfile +++ b/optional/fetchmail/Dockerfile @@ -12,8 +12,8 @@ RUN apk add --no-cache \ RUN apk add --no-cache fetchmail ca-certificates openssl \ && pip3 install requests +RUN mkdir -p /data + COPY fetchmail.py /fetchmail.py -USER fetchmail - -CMD ["/fetchmail.py"] +CMD ["/fetchmail.py"] \ No newline at end of file diff --git a/optional/fetchmail/fetchmail.py b/optional/fetchmail/fetchmail.py index 4be3c2bd..5459de59 100755 --- a/optional/fetchmail/fetchmail.py +++ b/optional/fetchmail/fetchmail.py @@ -13,6 +13,7 @@ import traceback FETCHMAIL = """ fetchmail -N \ + --idfile /data/fetchids --uidl \ --sslcertck --sslcertpath /etc/ssl/certs \ -f {} """ diff --git a/setup/flavors/compose/docker-compose.yml b/setup/flavors/compose/docker-compose.yml index 2675a2ab..18a881b8 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 }}/data/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..0c744d7e 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 }}/data/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.