feat: added mailserver template

This commit is contained in:
sashagoncharov19
2024-09-17 11:23:40 +00:00
parent 66a4e86209
commit 3e0d4ebbd6
4 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1 @@
<svg viewBox="20 244 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M122 490h172l70-27a10 10 0 0 0 6-12l-55-146a10 10 0 0 0-13-5L90 380a10 10 0 0 0-6 12z" fill="#e3e3e3"/><path d="m294 490 70-27a10 10 0 0 0 5-5l-149-54-46 86z" fill="#d4d4d4"/><path d="m84 387 150 53 75-140a10 10 0 0 0-7 0L90 380a10 10 0 0 0-6 6z" fill="#fff"/><path d="M423 397c-2 0-5 1-7 3-2 3-20 23-16 69 1 3 0 7-2 9-1 2-4 3-7 3H36.6c-2.6 0-5.4 1-7.6 3-2 2-3 5-3 8 0 160 117 177 168 177 129 0 219-78 258-148 52-8 74-43 75-45 3-5 1-11-4-14-1-1-31-20-59-15-7-29-33-47-35-48-1.75-1.3-3.7-1.86-5.66-1.8zM132 544a21 21 0 0 1 21 21 21 21 0 0 1-21 21 21 21 0 0 1-21-21 21 21 0 0 1 21-21z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 677 B

View File

@@ -0,0 +1,54 @@
services:
mailserver:
image: ghcr.io/docker-mailserver/docker-mailserver:latest
hostname: ${DMS_HOSTNAME}
ports:
- "25:25" # SMTP (STARTTLS)
- "465:465" # SMTP (Implicit TLS)
- "587:587" # SMTP (STARTTLS)
- "143:143" # IMAP (STARTTLS)
- "993:993" # IMAP (Implicit TLS)
volumes:
- dms-mail-data:/var/mail/
- dms-mail-state:/var/mail-state/
- dms-mail-logs:/var/log/mail/
- dms-mail-config:/tmp/docker-mailserver/
- /etc/dokploy/traefik/dynamic/acme.json:/etc/letsencrypt/acme.json:ro
- /etc/localtime:/etc/localtime:ro
environment:
- ENABLE_FAIL2BAN=${DMS_ENABLE_FAIL2BAN}
- PERMIT_DOCKER=${DMS_PERMIT_DOCKER}
- SPOOF_PROTECTION=${DMS_SPOOF_PROTECTION}
- SSL_TYPE=${DMS_SSL_TYPE}
- SSL_DOMAIN=${DMS_SSL_DOMAIN}
- POSTMASTER_ADDRESS=${DMS_POSTMASTER_ADDRESS}
cap_add:
- NET_ADMIN
restart: always
stop_grace_period: 1m
healthcheck:
test: ${DMS_HEALTHCHECK_CMD}
timeout: ${DMS_HEALTHCHECK_TIMEOUT}
retries: ${DMS_HEALTHCHECK_RETRIES}
command: >
sh -c '
if [ ! -s /tmp/docker-mailserver/postfix-accounts.cf ]; then
echo "File does not exist or is empty. Running setup command...";
setup email add "${DMS_DEFAULT_USER}" "${DMS_DEFAULT_USER_PASS}";
else
echo "File exists and is not empty. Skipping setup command.";
fi
exec supervisord -c /etc/supervisor/supervisord.conf
'
networks:
- dokploy-network
networks:
dokploy-network:
external: true
volumes:
dms-mail-data:
dms-mail-state:
dms-mail-logs:
dms-mail-config:

View File

@@ -0,0 +1,20 @@
import type { Schema, Template } from "../utils";
export async function generate(schema: Schema): Template {
const envs = [
"DMS_HOSTNAME=mail.example.com",
"DMS_HEALTHCHECK_CMD='ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1'",
"DMS_HEALTHCHECK_TIMEOUT=3s",
"DMS_HEALTHCHECK_RETRIES=0",
"DMS_POSTMASTER_ADDRESS=postmaster@example.com",
"DMS_DEFAULT_USER=admin@example.com",
"DMS_DEFAULT_USER_PASS=password",
"DMS_ENABLE_FAIL2BAN=1",
"DMS_PERMIT_DOCKER=network",
"DMS_SPOOF_PROTECTION=0",
"DMS_SSL_TYPE=letsencrypt",
"DMS_SSL_DOMAIN=example.com",
];
return { envs };
}

View File

@@ -497,4 +497,18 @@ export const templates: TemplateData[] = [
tags: ["self-hosted", "storage"],
load: () => import("./gitea/index").then((m) => m.generate),
},
{
id: "mailserver",
name: "Mailserver",
version: "14.0",
description: "A fullstack but simple mail server with SMTP, IMAP, LDAP, Antispam, Antivirus, etc.",
logo: "mailserver.svg",
links: {
github: "https://github.com/docker-mailserver/docker-mailserver",
website: "https://docker-mailserver.github.io/docker-mailserver/v14.0/",
docs: "https://docker-mailserver.github.io/docker-mailserver/v14.0/config/environment/",
},
tags: ["self-hosted", "email"],
load: () => import("./mailserver/index").then((m) => m.generate),
},
];