Commit b23ba6f7 authored by Joshua Tauberer's avatar Joshua Tauberer

simplify build/setup of dovecot-lucene package

parent f02e0a3c
DOVECOT_VERSION=2.2.9-1ubuntu2.1+miab1
all: clean build_postgrey build_dovecot_lucene
clean:
# Clean.
rm -rf /tmp/build
build_postgrey:
# Prepare to build source packages.
mkdir -p /tmp/build
build_postgrey:
# Download our fork of the Debian postgrey package.
git clone https://github.com/mail-in-a-box/postgrey /tmp/build/postgrey
......@@ -31,6 +33,9 @@ build_postgrey:
#(cd /tmp/build/postgrey; dpkg-buildpackage -us -uc -nc)
build_dovecot_lucene:
# Prepare to build source packages.
mkdir -p /tmp/build
# Get the upstream source.
(cd /tmp/build; apt-get source dovecot)
......@@ -41,10 +46,10 @@ build_dovecot_lucene:
(cd /tmp/build/dovecot-2.2.9; dpkg-buildpackage -S -us -uc -nc)
# Sign the packages.
debsign /tmp/build/dovecot_2.2.9-1ubuntu2.2~ppa0~trusty0_source.changes
debsign /tmp/build/dovecot_$(DOVECOT_VERSION)_source.changes
# Upload it.
dput ppa:mail-in-a-box/ppa /tmp/build/dovecot_2.2.9-1ubuntu2.2~ppa0~trusty0_source.changes
dput ppa:mail-in-a-box/ppa /tmp/build/dovecot_$(DOVECOT_VERSION)_source.changes
# TESTING BINARY PACKAGE
# Install build dependencies and build dependencies we've added in our patch,
......
......@@ -8,6 +8,8 @@ Packages
* [postgrey](https://github.com/mail-in-a-box/postgrey), with a modification to whitelist senders that are whitelisted by [dnswl.org](https://www.dnswl.org/) (i.e. don't greylist mail from them).
* dovecot-lucene, [dovecot's lucene full text search plugin](http://wiki2.dovecot.org/Plugins/FTS/Lucene), which isn't built by Ubuntu's dovecot package maintainer unfortunately.
Building
--------
......@@ -30,9 +32,9 @@ To build:
# Build & upload to launchpad.
vagrant ssh -- "cd /vagrant && make"
To use on a Mail-in-a-Box box, add the PPA and then upgrade packages:
Mail-in-a-Box adds our PPA during setup, but if you need to do that yourself for testing:
apt-add-repository ppa:mail-in-a-box/ppa
apt-get update
apt-get upgrade
apt-get install postgrey dovecot-lucene
......@@ -298,7 +298,7 @@ index 0000000..3d933a5
--- a/debian/changelog
+++ a/debian/changelog
@@ -1,3 +1,9 @@
+dovecot (1:2.2.9-1ubuntu2.2~ppa0~trusty0) trusty; urgency=low
+dovecot (1:2.2.9-1ubuntu2.1+miab1) trusty; urgency=low
+
+ * Changed to just build dovecot-lucene for Mail-in-a-box PPA
+
......
#!/bin/bash
# IMAP search with lucene
# --------------------------------
#
# Adapted from https://github.com/Jonty/mailinabox/blob/solr_support/setup/solr.sh
#
# By default dovecot uses its own Squat search index that has awful performance
# on large mailboxes. Dovecot 2.1+ has support for using Lucene internally but
# this didn't make it into the Ubuntu packages, so we maintain our own
# dovecot-lucene package in a ppa.
source setup/functions.sh # load our functions
source /etc/mailinabox.conf # load global vars
# Install packages and basic configuation
# ---------------------------------------
# Add official ppa
hide_output add-apt-repository -y ppa:mail-in-a-box/ppa
# Update apt
hide_output apt-get update
# Install packages
apt_install dovecot-lucene
# Update the dovecot plugin configuration
#
# Break-imap-search makes search work the way users expect, rather than the way
# the IMAP specification expects
tools/editconf.py /etc/dovecot/conf.d/10-mail.conf \
mail_plugins="$mail_plugins fts fts_lucene"
cat > /etc/dovecot/conf.d/90-plugin.conf << EOF;
plugin {
fts = lucene
fts_lucene = whitespace_chars=@.
}
EOF
# PERMISSIONS
# Ensure configuration files are owned by dovecot and not world readable.
chown -R mail:dovecot /etc/dovecot
chmod -R o-rwx /etc/dovecot
# Restart services to reload dovecot plugins
restart_service dovecot
......@@ -18,11 +18,14 @@
source setup/functions.sh # load our functions
source /etc/mailinabox.conf # load global vars
# Install packages...
# Install packages for dovecot. These are all core dovecot plugins,
# but dovecot-lucene is packaged by *us* in the Mail-in-a-Box PPA,
# not by Ubuntu.
apt_install \
dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-sqlite sqlite3 \
dovecot-sieve dovecot-managesieved
dovecot-sieve dovecot-managesieved dovecot-lucene
# The `dovecot-imapd`, `dovecot-pop3d`, and `dovecot-lmtpd` packages automatically
# enable IMAP, POP and LMTP protocols.
......@@ -92,6 +95,17 @@ tools/editconf.py /etc/dovecot/conf.d/20-imap.conf \
tools/editconf.py /etc/dovecot/conf.d/20-pop3.conf \
pop3_uidl_format="%08Xu%08Xv"
# Full Text Search - Enable full text search of mail using dovecot's lucene plugin,
# which *we* package and distribute (dovecot-lucene package).
tools/editconf.py /etc/dovecot/conf.d/10-mail.conf \
mail_plugins="\$mail_plugins fts fts_lucene"
cat > /etc/dovecot/conf.d/90-plugin-fts.conf << EOF;
plugin {
fts = lucene
fts_lucene = whitespace_chars=@.
}
EOF
# ### LDA (LMTP)
# Enable Dovecot's LDA service with the LMTP protocol. It will listen
......
......@@ -139,7 +139,6 @@ source setup/mail-postfix.sh
source setup/mail-dovecot.sh
source setup/mail-users.sh
source setup/dkim.sh
source setup/lucene.sh
source setup/spamassassin.sh
source setup/web.sh
source setup/webmail.sh
......
......@@ -3,7 +3,21 @@ source setup/functions.sh # load our functions
# Basic System Configuration
# -------------------------
# ### Install Packages
# ### Add Mail-in-a-Box's PPA.
# We've built several .deb packages on our own that we want to include.
# One is a replacement for Ubuntu's stock postgrey package that makes
# some enhancements. The other is dovecot-lucene, a Lucene-based full
# text search plugin for (and by) dovecot, which is not available in
# Ubuntu currently.
#
# Add that to the system's list of repositories:
hide_output add-apt-repository -y ppa:mail-in-a-box/ppa
# The apt-get update in the next step will pull in the PPA's index.
# ### Update Packages
# Update system packages to make sure we have the latest upstream versions of things from Ubuntu.
......@@ -11,6 +25,8 @@ echo Updating system packages...
hide_output apt-get update
apt_get_quiet upgrade
# ### Install System Packages
# Install basic utilities.
#
# * haveged: Provides extra entropy to /dev/random so it doesn't stall
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment