From e499d5a8049772aaf011f1ed41a0c475edfed7dd Mon Sep 17 00:00:00 2001 From: Dario Ernst Date: Sat, 4 Jan 2020 18:04:25 +0100 Subject: [PATCH 1/4] Add xapian full-text-search plugin to dovecot Currently we are not able to offer our users a FTS experience after the demise of lucene due to unfixed coredumps with musl/alpine. We now add lucene, the only remaining maintained small/lean FTS plugin for dovecot. It is quite simple to add to our stack: A two-stage docker build is used to compile the fts plugin in the first stage, and copy over only the resulting plugin-artifact to the second stage, which is our usual dovecot container. Configuration is also minimal. --- core/dovecot/Dockerfile | 15 ++++++++++++++- core/dovecot/conf/dovecot.conf | 9 ++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/core/dovecot/Dockerfile b/core/dovecot/Dockerfile index bb67370c..5a715099 100644 --- a/core/dovecot/Dockerfile +++ b/core/dovecot/Dockerfile @@ -1,4 +1,15 @@ ARG DISTRO=alpine:3.10 +FROM $DISTRO +WORKDIR /tmp +RUN apk add git build-base automake autoconf libtool dovecot-dev xapian-core-dev icu-dev +RUN git clone https://github.com/grosjo/fts-xapian.git \ + && cd fts-xapian \ + # && git checkout 1.2.7 \ # TODO: when upstream releases 1.2.7, use that + && autoreconf -vi \ + && PANDOC=false ./configure --with-dovecot=/usr/lib/dovecot \ + && make \ + && make install + FROM $DISTRO # python3 shared with most images RUN apk add --no-cache \ @@ -13,9 +24,11 @@ RUN pip3 install "podop>0.2.5" # Image specific layers under this line RUN apk add --no-cache \ - dovecot dovecot-lmtpd dovecot-pop3d dovecot-submissiond dovecot-pigeonhole-plugin rspamd-client \ + dovecot dovecot-lmtpd dovecot-pop3d dovecot-submissiond dovecot-pigeonhole-plugin rspamd-client xapian-core \ && mkdir /var/lib/dovecot +COPY --from=0 /usr/lib/dovecot/lib21_fts_xapian_plugin.* /usr/lib/dovecot/ + COPY conf /conf COPY start.py /start.py diff --git a/core/dovecot/conf/dovecot.conf b/core/dovecot/conf/dovecot.conf index f4181e0c..aa33a7bb 100644 --- a/core/dovecot/conf/dovecot.conf +++ b/core/dovecot/conf/dovecot.conf @@ -21,7 +21,8 @@ mail_access_groups = mail maildir_stat_dirs = yes mailbox_list_index = yes mail_vsize_bg_after_count = 100 -mail_plugins = $mail_plugins quota quota_clone zlib +mail_plugins = $mail_plugins quota quota_clone zlib fts fts_xapian +default_vsz_limit = 2GB namespace inbox { inbox = yes @@ -38,6 +39,12 @@ plugin { quota_vsizes = yes quota_clone_dict = proxy:/tmp/podop.socket:quota + fts = xapian + fts_xapian = partial=2 full=30 + fts_autoindex = yes + fts_enforced = yes + fts_autoindex_exclude = \Trash + {% if COMPRESSION in [ 'gz', 'bz2' ] %} zlib_save = {{ COMPRESSION }} {% endif %} From 99ecaee7b97dfa15a0939856d6c9caa7d2776f19 Mon Sep 17 00:00:00 2001 From: Dario Ernst Date: Thu, 23 Jan 2020 22:35:30 +0100 Subject: [PATCH 2/4] Use a released git-tag for fts-xapian --- core/dovecot/Dockerfile | 2 +- towncrier/newsfragments/1320.feature | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 towncrier/newsfragments/1320.feature diff --git a/core/dovecot/Dockerfile b/core/dovecot/Dockerfile index 5a715099..60f6ab9b 100644 --- a/core/dovecot/Dockerfile +++ b/core/dovecot/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /tmp RUN apk add git build-base automake autoconf libtool dovecot-dev xapian-core-dev icu-dev RUN git clone https://github.com/grosjo/fts-xapian.git \ && cd fts-xapian \ - # && git checkout 1.2.7 \ # TODO: when upstream releases 1.2.7, use that + && git checkout 1.2.7 \ && autoreconf -vi \ && PANDOC=false ./configure --with-dovecot=/usr/lib/dovecot \ && make \ diff --git a/towncrier/newsfragments/1320.feature b/towncrier/newsfragments/1320.feature new file mode 100644 index 00000000..fc3fd5aa --- /dev/null +++ b/towncrier/newsfragments/1320.feature @@ -0,0 +1 @@ +Allow users to use server-sided full-text-search again by adding the dovecot fts-xapian plugin From dfe092eb46da1a20f40b65fbc699e9620dba683c Mon Sep 17 00:00:00 2001 From: Dario Ernst Date: Fri, 6 Mar 2020 16:11:59 +0100 Subject: [PATCH 3/4] Use names for docker build stages in dovecot Dockerfile --- core/dovecot/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/dovecot/Dockerfile b/core/dovecot/Dockerfile index 60f6ab9b..1e40bddf 100644 --- a/core/dovecot/Dockerfile +++ b/core/dovecot/Dockerfile @@ -1,4 +1,4 @@ -ARG DISTRO=alpine:3.10 +ARG DISTRO=alpine:3.10 as builder FROM $DISTRO WORKDIR /tmp RUN apk add git build-base automake autoconf libtool dovecot-dev xapian-core-dev icu-dev @@ -27,7 +27,7 @@ RUN apk add --no-cache \ dovecot dovecot-lmtpd dovecot-pop3d dovecot-submissiond dovecot-pigeonhole-plugin rspamd-client xapian-core \ && mkdir /var/lib/dovecot -COPY --from=0 /usr/lib/dovecot/lib21_fts_xapian_plugin.* /usr/lib/dovecot/ +COPY --from=builder /usr/lib/dovecot/lib21_fts_xapian_plugin.* /usr/lib/dovecot/ COPY conf /conf COPY start.py /start.py From 862632655960d79c4b70dc1e22d938fae191fda0 Mon Sep 17 00:00:00 2001 From: Dario Ernst Date: Sat, 7 Mar 2020 10:21:21 +0100 Subject: [PATCH 4/4] Fix dovecot dockerfile (accidentally broken in previous commit) --- core/dovecot/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/dovecot/Dockerfile b/core/dovecot/Dockerfile index 1e40bddf..da75140c 100644 --- a/core/dovecot/Dockerfile +++ b/core/dovecot/Dockerfile @@ -1,5 +1,5 @@ -ARG DISTRO=alpine:3.10 as builder -FROM $DISTRO +ARG DISTRO=alpine:3.10 +FROM $DISTRO as builder WORKDIR /tmp RUN apk add git build-base automake autoconf libtool dovecot-dev xapian-core-dev icu-dev RUN git clone https://github.com/grosjo/fts-xapian.git \