Setup

Cypht is one of the newer containers I’m running and I love it. I am tired of running multiple mail clients everywhere (Thunderbird at work, Outlook on Windows, Mail on Mac and so on). With Cypht I can log in to my to one webmail and see all my IMAP/POP mail accounts one place.

It is not too difficuelt to setup but one thing to keep in mind is to always save changes you make in the webinterface. By default everything is purged when you logout. This is not ideal for me, since I don’t want to have to setup everything again.

To start with, we make an environemtn (.env) file where we add things like passwords and domain names.

DOMAIN=<name>.<ext>
USER=<username>
PASS=<password>
DB_PASS=<db password>
DB_USER=<db username>
DB=<db name>
ROOT_PASS=<root password>

Next we create our docker-compose file and add

version: "3"

services:
  cypht_app:
    container_name: cypht_app
    image: sailfrog/cypht-docker:latest
    environment:
      - CYPHT_AUTH_USERNAME=${USER}
      - CYPHT_AUTH_PASSWORD=${PASS}
      - CYPHT_DB_CONNECTION_TYPE=host
      - CYPHT_DB_HOST=cypht_db:3306
      - CYPHT_DB_NAME=${DB}
      - CYPHT_DB_USER=${DB_USER}
      - CYPHT_DB_PASS=${DB_PASS}
      - CYPHT_ALLOW_EXTERNAL_IMAGE_SOURCES=true
      - CYPHT_MODULE_NASA=enable
      - CYPHT_DISABLE_IP_CHECK=true
    volumes:
      - ${PWD}/users:/var/lib/hm3/users
      - ${PWD}/app_data:/var/lib/hm3/app_data
    labels:
      - "traefik.enable=true"
      - "traefik.frontend.rule=Host:mail.${DOMAIN}"
    depends_on:
      - cypht_db
  cypht_db:
    container_name: cypht_db
    image: mariadb:10
    ports:
      - 3322:3306
    environment:
      - MYSQL_ROOT_PASSWORD=${ROOT_PASS}
      - MYSQL_DATABASE=${DB}
      - MYSQL_USER=${DB_USER}
      - MYSQL_PASSWORD=${DB_PASS}
    volumes:
      - ${PWD}/mysql:/var/lib/mysql
networks:
  default:
      external:
        name: webproxy

Most of the things are the same as previous posts, but we have a few Cypht specific settings. CYPHT_ALLOW_EXTERNAL_IMAGE_SOURCES allows external images in emails, CYPHT_MODULE_NASA enables the NASA image of the day using their API and CYPHT_DISABLE_IP_CHECK disables IP check. Disabling IP check makes it possible to login from more than one IP using the same settings. If we enable this, we would need to setup the server settings on each new IP adress we access the site from. Since I want to use this at work, at home etc. I dont want to enter each setting multiple times.

Finally we can run the container

docker-compose up -d

and after a minute or two (Let’s Encrypt needs to generate a certificate) we can access the site.