| 1 | # Optional mail server piece of ClonAgent. |
| 2 | # |
| 3 | # Provides per-agent mailboxes at <local>@${MAIL_DOMAIN} (default bot.utopiaia.com) |
| 4 | # so each ClonAgent can have its own SMTP/IMAP inbox without touching the main |
| 5 | # corporate Outlook. |
| 6 | # |
| 7 | # Run only after `scripts/setup-mailserver.sh` has prepared: |
| 8 | # - DNS A + MX records on the subdomain |
| 9 | # - DKIM keys + the TXT records you must add by hand |
| 10 | # |
| 11 | # Usage on the host: |
| 12 | # docker compose -f docker-compose.mail.yml up -d |
| 13 | # |
| 14 | # Add/remove mailboxes: |
| 15 | # docker exec mailserver setup email add bug@bot.utopiaia.com 'pa$$w0rd' |
| 16 | # docker exec mailserver setup email del bug@bot.utopiaia.com |
| 17 | # docker exec mailserver setup email list |
| 18 | # |
| 19 | # ClonAgent's UI calls these via /api/mail (server/lib/mail-server.js). |
| 20 | services: |
| 21 | mailserver: |
| 22 | image: ghcr.io/docker-mailserver/docker-mailserver:latest |
| 23 | container_name: mailserver |
| 24 | hostname: ${MAIL_HOSTNAME:-bot.utopiaia.com} |
| 25 | restart: unless-stopped |
| 26 | ports: |
| 27 | - "25:25" # SMTP |
| 28 | - "143:143" # IMAP |
| 29 | - "465:465" # ESMTP submissions (TLS) |
| 30 | - "587:587" # ESMTP submission (STARTTLS) |
| 31 | - "993:993" # IMAPS |
| 32 | environment: |
| 33 | OVERRIDE_HOSTNAME: ${MAIL_HOSTNAME:-bot.utopiaia.com} |
| 34 | ENABLE_FAIL2BAN: "1" |
| 35 | ENABLE_SPAMASSASSIN: "1" |
| 36 | ENABLE_CLAMAV: "0" |
| 37 | SSL_TYPE: letsencrypt |
| 38 | PERMIT_DOCKER: none |
| 39 | ONE_DIR: "1" |
| 40 | POSTMASTER_ADDRESS: postmaster@${MAIL_DOMAIN:-bot.utopiaia.com} |
| 41 | LOG_LEVEL: info |
| 42 | volumes: |
| 43 | - ./mail/mail-data:/var/mail |
| 44 | - ./mail/mail-state:/var/mail-state |
| 45 | - ./mail/mail-logs:/var/log/mail |
| 46 | - ./mail/config:/tmp/docker-mailserver |
| 47 | # Reuse Let's Encrypt certs from the host (already issued by certbot) |
| 48 | - /etc/letsencrypt:/etc/letsencrypt:ro |
| 49 | cap_add: |
| 50 | - NET_ADMIN |
| 51 | - SYS_PTRACE |
| 52 | healthcheck: |
| 53 | test: "ss -lntp | grep -q ':25' || exit 1" |
| 54 | timeout: 3s |
| 55 | retries: 0 |