In the previous blog post we learned that the traefik edge router is a handy tool to provide https connection together with Let’s Encrypt. Wouldn’t it be nice if we could run all components required by an email archive including traefik as well in a dockerized environment and still having the https certificate? We’ll do exactly like that with docker-compose.

The first step to the cloud is the ability to run in a docker container. Fortunately, piler runs on Linux, and it’s quite possible to run it in a container. In fact the dev and test environments of both piler and piler enterprise are docker based.

The goal

We will deploy the following components:

  • traefik edge router to provide the http(s) inbound
  • mariadb to store metadata, user data, etc.
  • memcached to power some search related features
  • apache tika to extract text from attachments
  • piler enterprise to archive emails
You’ll have 3 ports exposed:
  • 80/tcp and 443/tcp on traefik
  • 25/tcp on piler

Before we start

Before we start, you need a valid license file to run piler enterprise. Go to the Download page to register for a trial license if you need to. (Alternatively you may use the open source project’s docker image (sutoj/piler:1.3.10) as well. In this case remove the piler.lic volume reference in docker-compose.yaml).

I assume, you already have both docker and docker-compose installed. If not, then check out the docker engine and the docker compose manuals for the details.

Clone the piler-examples repo

git clone https://github.com/jsuto/piler-examples.git
cd examples/docker

Customize the configuration

Edit docker-compose.yaml and fix the following values matching your environment:

  • MYSQL_PILER_PASSWORD
  • MYSQL_ROOT_PASSWORD
  • PILER_HOSTNAME
  • MULTITENANCY

Edit traefik.yaml and replace admin@yourdomain.com and archive.yourdomain.com with your email and archive hostname.

Be sure to fix the permissions and change the ownership of acme.json:

chown 600 acme.json
sudo chown root:root acme.json

Run the deployment

Run the following command to start the containers:

docker-compose up -d

That’s it! You have a https enabled archive running in a dockerized environment.

The setup we just did is quite flexible. Feel free to tailor it to your needs.

Final words

I know what you are thinking. If piler can run inside a container, then why not deploy it to kubernetes? We’ll explore this option in a later blog post.