hardware / mailserver

:warning: UNMAINTAINED - Simple and full-featured mail server using Docker
https://store.docker.com/community/images/hardware/mailserver
MIT License
1.29k stars 322 forks source link

Docker swarm #395

Closed SkazochnikZlodey closed 5 years ago

SkazochnikZlodey commented 5 years ago

Classification

Reproducibility

Docker information

docker --version
Docker version 19.03.1, build 74b1e89

Description

Hello I delete sensitive information, but most information is usable: cat mailserverupdate.sh

! /bin/bash

##################

Update traefik image from docker hub

##################

###################################################################

local variables

################################################################### unset username # user name for regitry unset password # user password for regitry

MAILSERVER_DOCKER_TAG=1.1-stable

CurrentReg="reg.srv.int.com"

echo -n " Please, enter username for docker repository server (jenkinsuser?): "

read username

prompt=" Please, enter password: "

while IFS= read -p "$prompt" -r -s -n 1 char

do

if [[ $char == $'\0' ]]

then

break

fi

prompt='*'

password+="$char"

done

echo

echo $username

echo $password

docker login -u $username -p $password $CurrentReg

docker login -u jenkins -p Pass $CurrentReg

echo "Current mail server docker tag is:"${MAILSERVER_DOCKER_TAG}

echo "clean up docker" docker system prune -a -f

echo Download hardware/mailserver:${MAILSERVER_DOCKER_TAG} image from docker hub docker pull hardware/mailserver:${MAILSERVER_DOCKER_TAG} echo "Push hardware/mailserver:${MAILSERVER_DOCKER_TAG} to $CurrentReg " docker tag hardware/mailserver:${MAILSERVER_DOCKER_TAG} $CurrentReg/codinsula/it/mailserver docker push $CurrentReg/codinsula/it/mailserver

echo Download hardware/mailserver:1.1-stable image from docker hub

docker pull hardware/mailserver:1.1-stable

echo "Push hardware/mailserver:1.1-stable to $CurrentReg "

docker tag hardware/mailserver:1.1-stable $CurrentReg/codinsula/it/mailserver

docker push $CurrentReg/codinsula/it/mailserver

echo Download hardware/postfixadmin image from docker hub docker pull hardware/postfixadmin echo "Push hardware/postfixadmin to $CurrentReg " docker tag hardware/postfixadmin $CurrentReg/codinsula/it/postfixadmin docker push $CurrentReg/codinsula/it/postfixadmin

echo "Download hardware/rainloop image form docker hub" docker pull hardware/rainloop echo "Push consul to $CurrentReg " docker tag hardware/rainloop $CurrentReg/codinsula/it/rainloop docker push $CurrentReg/codinsula/it/rainloop

echo ".... Done. " echo "Finish"

cat ./start.sh

/bin/bash

mkdir -p /external/services/mailserver/{mail,rainloop}

echo "Create the overlay network that will be used for our stack (mailnetwork):" docker network create --driver overlay mailserver_network

echo Deploy the Mailserver Stack:

env $(cat .env | grep ^[A-Z] | xargs) docker stack deploy --compose-file mailserver-compose.yml mailserver

echo Waiting 5 sec. sleep 5

echo Stacks review:

docker stack ls

echo ..Done ?..

$cat .env

This file is used to define environment variables to be used

for variable substitution in your docker compose file.

https://docs.docker.com/compose/env-file/

#

MANDATORY

/!\ if this variables are unset, the mail server will not start.

#

Your domain name (eg. domain.tld)

MAILSERVER_DOMAIN=ll.com

MariaDB/PostgreSQL database password

DATABASE_USER_PASSWORD=M@ilP@ssw0rd!

Rspamd WebUI and controller password

RSPAMD_PASSWORD=M@ilP@ssw0rd! DATABASEIP=10.18.28.10 REDISIP=10.18.28.12 #

NOT MANDATORY

#

Your mailserver hostname (eg. mail for mail.domain.tld)

MAILSERVER_HOSTNAME=mail

Mailserver version

1.1-stable : Stable version (v1.1-stable github branch)

1.1-latest : Latest development build (master github branch)

Latest development builds have been validated through

the CI automation system but they are not meant for

deployment in production.

1.1-stable and 1.1-latest are rebuilt weekly on the docker hub but if you

have any problem with a new build you can switch to 1.1-stable-fallback

The fallback tag is rebuilt monthly.

MAILSERVER_DOCKER_TAG=1.1-stable

Docker volumes parent folder

VOLUMES_ROOT_PATH=/external/services/mailserver

Docker containers restart mode

https://docs.docker.com/compose/compose-file/#restart

RESTART_MODE=unless-stopped

cat ./mailserver-compose.yml version: "3"

IPv4 only

docker network create http_network

IPv4/IPv6 network

docker network create http_network --ipv6 --subnet "fd00:0000:0000:0000::/64"

Refer to https://github.com/hardware/mailserver/#ipv6-support for more information.

networks:

http_network:

external: true

traefiknet:
external: true mail_network: external: false

services: mailserver: image: reg.srv.int.com/codinsula/it/mailserver hostname: ${MAILSERVER_HOSTNAME} deploy: replicas: 1 labels:

- traefik.enable=true

- traefik.frontend.rule=Host:spam.${MAILSERVER_DOMAIN}

- traefik.port=11334

- traefik.docker.network=traefiknet

    - "traefik.backend.loadbalancer.stickiness=false"
    - "traefik.backend.loadbalancer.swarm=true"
    - "traefik.backend=spam_mailserver"
    - "traefik.docker.network=traefiknet"
    - "traefik.entrypoints=https"
    - "traefik.frontend.passHostHeader=true"
    - "traefik.frontend.rule=Host:spam.${MAILSERVER_DOMAIN}"
    - "traefik.port=11334"
ports:
  - "25:25"       # SMTP                - Required
  - "110:110"     # POP3       STARTTLS - Optional - For webmails/desktop clients
  - "143:143"     # IMAP       STARTTLS - Optional - For webmails/desktop clients
  - "465:465"     # SMTPS      SSL/TLS  - Optional - Enabled for compatibility reason, otherwise disabled
  - "587:587"     # Submission STARTTLS - Optional - For webmails/desktop clients
  - "993:993"     # IMAPS      SSL/TLS  - Optional - For webmails/desktop clients
  - "995:995"     # POP3S      SSL/TLS  - Optional - For webmails/desktop clients
  - "4190:4190"   # SIEVE      STARTTLS - Optional - Recommended for mail filtering
extra_hosts:                               # Required for external database (on other server or for local databases on host without docker)
  - "mariadb:${DATABASEIP}"                # Replace with IP address of MariaDB server
  - "redis:${REDISIP}"                     # Replace with IP address of Redis server
environment:
  - DOMAIN=${MAILSERVER_DOMAIN}
  - DBPASS=${DATABASE_USER_PASSWORD}       # MariaDB database password (required)
  - RSPAMD_PASSWORD=${RSPAMD_PASSWORD}     # Rspamd WebUI password (required)
# - ADD_DOMAINS=aa.tld, www.bb.tld...      # Add additional domains separated by commas (needed for dkim keys etc.)
# - DEBUG_MODE=true                        # Enable Postfix, Dovecot, Rspamd and Unbound verbose logging
# - ENABLE_POP3=true                       # Enable POP3 protocol
# - ENABLE_FETCHMAIL=true                  # Enable fetchmail forwarding
# - DISABLE_RATELIMITING=false             # Enable ratelimiting policy
# - DISABLE_CLAMAV=true                    # Disable virus scanning
# - DISABLE_SIGNING=true                   # Disable DKIM/ARC signing
# - DISABLE_GREYLISTING=true               # Disable greylisting policy
#
# Full list : https://github.com/hardware/mailserver#environment-variables
#
volumes:
  - ${VOLUMES_ROOT_PATH}/mail:/var/mail
networks:
  - mail_network
  - traefiknet

Administration interface

https://github.com/hardware/postfixadmin

http://postfixadmin.sourceforge.net/

Configuration : https://github.com/hardware/mailserver/wiki/Postfixadmin-initial-configuration

postfixadmin: image: reg.srv.int.com/codinsula/it/postfixadmin hostname: ${MAILSERVER_HOSTNAME} deploy: replicas: 1 labels:

hardware commented 5 years ago

Your post is unreadable... I can't even understand your issue. Fix it and I will reopen the thread. Thank you.