Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • infrastruktur/ansible-warpzone
  • specki/ansible-warpzone
2 results
Show changes
Showing
with 614 additions and 248 deletions
......@@ -3,7 +3,7 @@ version: "3"
services:
coturn:
image: coturn/coturn:4.5.2
image: coturn/coturn:4.6.1
restart: always
command:
- turnserver
......
......@@ -9,23 +9,19 @@
path: "{{item}}"
state: "directory"
with_items:
- /srv/dokuwiki/
- /srv/dokuwiki/data
- /srv/dokuwiki/pdftemplate
- "{{ basedir }}"
- "{{ basedir }}/data"
- "{{ basedir }}/pdftemplate"
- name: Docker Compose Konfig-Datei erstellen
template:
src: "{{item}}"
dest: "/srv/dokuwiki/{{item}}"
dest: "{{ basedir }}/{{item}}"
with_items:
- docker-compose.yml
- Dockerfile
- sendmail_plenum.py
- name: start dokuwiki docker
docker_compose:
project_src: /srv/dokuwiki/
state: present
register: config
- name: Cronjob für Mailversand Plenumsmail
cron:
......@@ -33,5 +29,16 @@
weekday: "0"
hour: "20"
minute: "0"
job: "/usr/bin/python3 /srv/dokuwiki/sendmail_plenum.py"
job: "/usr/bin/python3 {{ basedir }}/sendmail_plenum.py"
disabled: false
- name: "stop {{ servicename}} docker"
docker_compose:
project_src: "{{ basedir }}"
state: absent
when: config.changed
- name: "start {{ servicename}} docker"
docker_compose:
project_src: "{{ basedir }}"
state: present
......@@ -3,6 +3,7 @@ version: "3"
services:
app:
# values set in configuration: noreply_email_user - noreply_email_pass - smtp_host - smtp_port
build: .
image: "dokuwiki--{{ ansible_date_time.date }}--{{ ansible_date_time.hour }}-{{ ansible_date_time.minute }}-{{ ansible_date_time.second }}"
restart: always
......@@ -16,11 +17,8 @@ services:
- traefik.http.services.{{ servicename }}.loadbalancer.server.port=80
networks:
- default
- mail
- web
networks:
mail:
external: true
web:
external: true
......@@ -2,73 +2,76 @@ import smtplib
import datetime
from email.message import EmailMessage
from email.utils import formatdate
with open("/srv/dokuwiki/data/data/pages/intern/diskussionsthemen.txt") as fp:
raw = fp.read().split('\n')
# Extract Themen
firstline = 0
lastline = 0
for index, line in enumerate(raw):
# Start marker
if "====== 1." in line:
firstline = index + 1
continue
import requests
def do_work():
with open("/srv/dokuwiki/data/data/pages/intern/diskussionsthemen.txt") as fp:
raw = fp.read().split('\n')
# Extract Themen
firstline = 0
lastline = 0
for index, line in enumerate(raw):
# Start marker
if "====== 1." in line:
firstline = index + 1
continue
# End marker
if "====== 2." in line:
lastline = index
break
# End marker
if "====== 2." in line:
lastline = index
break
# Remove empty lines from topics
topics = []
for extracted in raw[firstline:lastline-1]:
if extracted != '':
topics.append(extracted)
# There are no topics - just exit
if (len(topics) == 0):
exit()
# calculate date of next tuesday
d = datetime.date.today()
while d.strftime('%a') != 'Tue':
d += datetime.timedelta(1)
# mail template
mail = f"""
Liebe Zonies,
es gibt wieder Themen die im Plenum besprochen werden sollen. Der nächste
Reguläre Termin ist am nächsten Dienstag ({str(d)}) um 20:00.
Im Wiki (https://wiki.warpzone.ms/intern:diskussionsthemen#diskussionsthemen_naechstes_plenum_automatische_einladung)
stehen folgende Themen:
{chr(10).join(topics)}
Die Teilnahme ist natürlich auch remote möglich unter
https://jitsi.dorf-post.de/warpzone-plenum möglich.
Viele Grüße und bis Dienstag,
sendmail_plenum.py
"""
msg = EmailMessage()
msg['Subject'] = f'Aktuelle Plenumsthemen für Dienstag ({str(d)} 20:00)'
msg['From'] = '{{noreply_email_user}}'
msg['To'] = 'intern@warpzone.ms'
msg['Date'] = formatdate(localtime=True)
msg.set_content(mail)
server = smtplib.SMTP('{{smtp_host}}', {{smtp_port}})
server.starttls()
server.login("{{noreply_email_user}}", "{{noreply_email_pass}}")
server.send_message(msg)
server.quit()
# Remove empty lines from topics
topics = []
for extracted in raw[firstline:lastline-1]:
if extracted != '':
topics.append(extracted)
# There are no topics - just exit
if (len(topics) == 0):
exit()
# calculate date of next tuesday
d = datetime.date.today()
while d.strftime('%a') != 'Tue':
d += datetime.timedelta(1)
# mail template
mail = f"""
Liebe Zonies,
es gibt wieder Themen die im Plenum besprochen werden sollen. Der nächste
Reguläre Termin ist am nächsten Dienstag ({str(d)}) um 20:00.
Im Wiki (https://wiki.warpzone.ms/intern:diskussionsthemen#diskussionsthemen_naechstes_plenum_automatische_einladung)
stehen folgende Themen:
{chr(10).join(topics)}
Die Teilnahme ist natürlich auch remote möglich unter
https://jitsi.dorf-post.de/warpzone-plenum möglich.
Viele Grüße und bis Dienstag,
sendmail_plenum.py
"""
msg = EmailMessage()
msg['Subject'] = f'Aktuelle Plenumsthemen für Dienstag ({str(d)} 20:00)'
msg['From'] = '{{noreply_email_user}}'
msg['To'] = 'intern@warpzone.ms'
msg['Date'] = formatdate(localtime=True)
msg.set_content(mail)
server = smtplib.SMTP('{{smtp_host}}', {{smtp_port}})
server.starttls()
server.login("{{noreply_email_user}}", "{{noreply_email_pass}}")
server.send_message(msg)
server.quit()
return True
success = False
try:
success = do_work()
finally:
requests.get("{{ healthchecks_url }}" if success else "{{ healthchecks_url }}" + "/fail")
......@@ -116,8 +116,8 @@ gitlab_rails['gitlab_email_enabled'] = true
# gitlab_rails['gitlab_email_smime_key_file'] = '/etc/gitlab/ssl/gitlab_smime.key'
# gitlab_rails['gitlab_email_smime_cert_file'] = '/etc/gitlab/ssl/gitlab_smime.crt'
# gitlab_rails['gitlab_email_smime_ca_certs_file'] = '/etc/gitlab/ssl/gitlab_smime_cas.crt'
gitlab_rails['gitlab_email_from'] = '{{ noreply_email_user }}'
gitlab_rails['gitlab_email_display_name'] = 'Gitlab Warpzone'
gitlab_rails['gitlab_email_from'] = 'gitlab@{{ smtp_domain }}'
gitlab_rails['gitlab_email_display_name'] = 'Warpzone Gitlab'
gitlab_rails['gitlab_email_reply_to'] = '{{ noreply_email_user }}'
### GitLab user privileges
......
......@@ -5,7 +5,7 @@ services:
app:
image: gitlab/gitlab-ce:15.9.3-ce.0
image: gitlab/gitlab-ce:15.10.2-ce.0
restart: always
ports:
- "444:22"
......
......@@ -8,6 +8,7 @@
- { path: "{{ basedir }}/icinga_api_pass", length: 8 }
- { path: "{{ basedir }}/mysql_admin_pass", length: 12 }
- { path: "{{ basedir }}/mysql_user_pass", length: 12 }
- { path: "{{ basedir }}/matrix_notification_access_token", length: -1 }
- name: pakete installieren
......
......@@ -48,3 +48,9 @@ RUN cd /opt/ \
&& git clone https://github.com/elberfeld/check_metric_value.git \
&& cd /opt/check_metric_value/ \
&& git checkout b94d3c3e78497a05e3b4520d33421f37e4d77985
# icinga2-matrix_notification - commit from 15.04.2012
RUN cd /opt/ \
&& git clone https://github.com/linuxmail/icinga2-matrix_notification \
&& cd /opt/icinga2-matrix_notification/ \
&& git checkout 99d2174a3b00e9a88648fe58bcd975368f69837d
/**
* Check MQTT values
*/
object CheckCommand "check_mqtt" {
import "plugin-check-command"
......@@ -33,6 +37,10 @@ object CheckCommand "check_mqtt" {
}
}
/**
* Check for Mail Blacklisting
*/
object CheckCommand "check_mail_blacklist" {
import "plugin-check-command"
......@@ -45,6 +53,9 @@ object CheckCommand "check_mail_blacklist" {
}
}
/**
* Check for Prometheus values
*/
object CheckCommand "check_metric_value" {
import "plugin-check-command"
......@@ -62,4 +73,138 @@ object CheckCommand "check_metric_value" {
"-w" = "$metric_warn$"
"-c" = "$metric_crit$"
}
}
\ No newline at end of file
}
/**
* Matrix Notification
*/
object NotificationCommand "matrix-host-notification" {
import "plugin-notification-command"
command = [ "/opt/icinga2-matrix_notification/scripts/matrix-host-notification.sh" ]
arguments += {
"-4" = "$notification_address$"
"-6" = "$notification_address6$"
"-b" = "$notification_author$"
"-c" = "$notification_comment$"
"-d" = {
required = true
value = "$notification_date$"
}
"-i" = "$notification_icingaweb2url$"
"-l" = {
required = true
value = "$notification_hostname$"
}
"-m" = {
required = true
value = "$notification_matrix_room_id$"
}
"-n" = {
required = true
value = "$notification_hostdisplayname$"
}
"-o" = {
required = true
value = "$notification_hostoutput$"
}
"-s" = {
required = true
value = "$notification_hoststate$"
}
"-t" = {
required = true
value = "$notification_type$"
}
"-x" = {
required = true
value = "$notification_matrix_server$"
}
"-y" = {
required = true
value = "$notification_matrix_token$"
}
}
vars.notification_address = "$address$"
vars.notification_address6 = "$address6$"
vars.notification_author = "$notification.author$"
vars.notification_comment = "$notification.comment$"
vars.notification_date = "$icinga.long_date_time$"
vars.notification_hostdisplayname = "$host.display_name$"
vars.notification_hostname = "$host.name$"
vars.notification_hostoutput = "$host.output$"
vars.notification_hoststate = "$host.state$"
vars.notification_type = "$notification.type$"
}
object NotificationCommand "matrix-service-notification" {
import "plugin-notification-command"
command = [ "/opt/icinga2-matrix_notification/scripts/matrix-service-notification.sh" ]
arguments += {
"-4" = {
required = true
value = "$notification_address$"
}
"-6" = "$notification_address6$"
"-b" = "$notification_author$"
"-c" = "$notification_comment$"
"-d" = {
required = true
value = "$notification_date$"
}
"-e" = {
required = true
value = "$notification_servicename$"
}
"-i" = "$notification_icingaweb2url$"
"-l" = {
required = true
value = "$notification_hostname$"
}
"-m" = {
required = true
value = "$notification_matrix_room_id$"
}
"-n" = {
required = true
value = "$notification_hostdisplayname$"
}
"-o" = {
required = true
value = "$notification_serviceoutput$"
}
"-s" = {
required = true
value = "$notification_servicestate$"
}
"-t" = {
required = true
value = "$notification_type$"
}
"-u" = {
required = true
value = "$notification_servicedisplayname$"
}
"-x" = {
required = true
value = "$notification_matrix_server$"
}
"-y" = {
required = true
value = "$notification_matrix_token$"
}
}
vars.notification_address = "$address$"
vars.notification_address6 = "$address6$"
vars.notification_author = "$notification.author$"
vars.notification_comment = "$notification.comment$"
vars.notification_date = "$icinga.long_date_time$"
vars.notification_hostdisplayname = "$host.display_name$"
vars.notification_hostname = "$host.name$"
vars.notification_servicedisplayname = "$service.display_name$"
vars.notification_serviceoutput = "$service.output$"
vars.notification_servicestate = "$service.state$"
vars.notification_type = "$notification.type$"
vars.notification_servicename = "$service.name$"
}
// https://github.com/linuxmail/icinga2-matrix_notification
/**
* Example Matrix.org apply rules.
* The "!<id>:matrix.org" needs to be replaced with the room ID
* for example "!SDFfskjfdszhdaslasdkjhdasd:matrix.org".
* Also a Matrix access token is required too.
*/
apply Notification "Matrix host problems" to Host {
import "matrix-host-notification"
user_groups = [ "icingaadmins" ]
vars.notification_matrix_server = "https://{{ matrix_notification_domain }}"
vars.notification_matrix_room_id = "{{ matrix_notification_room }}"
vars.notification_matrix_token = "{{ matrix_notification_access_token }}"
# Assign to all hosts
assign where host.address
}
apply Notification "Matrix service problems" to Service {
import "matrix-service-notification"
user_groups = [ "icingaadmins" ]
vars.notification_matrix_server = "https://{{ matrix_notification_domain }}"
vars.notification_matrix_room_id = "{{ matrix_notification_room }}"
vars.notification_matrix_token = "{{ matrix_notification_access_token }}"
# Assign to all services
assign where service.name
}
......@@ -81,3 +81,38 @@ template Notification "mail-service-notification" {
period = "24x7"
}
/**
* Provides default settings for Matrix.org service notifications.
*/
template Notification "matrix-host-notification" {
command = "matrix-host-notification"
states = [ Up, Down ]
types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ]
vars += {
// notification_icingaweb2url = "https://{{ domain }}/icingaweb2"
notification_logtosyslog = false
}
// interval = 0s
period = "24x7"
}
template Notification "matrix-service-notification" {
command = "matrix-service-notification"
states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ]
vars += {
// notification_icingaweb2url = "https://{{ domain }}/icingaweb2"
notification_logtosyslog = false
}
// interval = 0s
period = "24x7"
}
......@@ -2,6 +2,7 @@
- include_tasks: ../functions/get_secret.yml
with_items:
- { path: /srv/shared/noreply_email_pass, length: -1 }
- { path: /srv/keycloak/keycloak_admin_pass, length: 32 }
- { path: /srv/keycloak/postgres_user_pass, length: 24 }
......
......@@ -6,7 +6,7 @@ services:
app:
# values set in configuration: noreply_email_user - noreply_email_pass - smtp_host - smtp_port
image: jboss/keycloak:16.1.1
restart: always
depends_on:
......@@ -31,7 +31,6 @@ services:
- traefik.http.services.{{ servicename }}.loadbalancer.server.port=8080
networks:
- default
- mail
- web
......@@ -64,7 +63,5 @@ services:
networks:
mail:
external: true
web:
external: true
---
servicename: mail
basedir: /srv/mail
......@@ -2,21 +2,23 @@
- include_tasks: ../functions/get_secret.yml
with_items:
- { path: "{{ basedir }}/secrets/mailcow_admin_pass", length: 28 }
- { path: "{{ basedir }}/secrets/mysql_mailcow_pass", length: 28 }
- { path: "{{ basedir }}/secrets/mysql_root_pass", length: 28 }
# mailman
- { path: "{{ basedir }}/secrets/mailu_secret_key", length: 32 }
- { path: "{{ basedir }}/secrets/mailu_admin_pass", length: 32 }
- { path: "{{ basedir }}/secrets/mailu_api_token", length: 32 }
- { path: "{{ basedir }}/secrets/mailu_db_pass", length: 28 }
- { path: "{{ basedir }}/secrets/roundcube_db_pass", length: 28 }
- { path: "{{ basedir }}/secrets/hyperkitty_api_key", length: 28 }
- { path: "{{ basedir }}/secrets/postgres_mailman_pass", length: 28 }
- { path: "{{ basedir }}/secrets/mailman_db_pass", length: 28 }
- { path: "{{ basedir }}/secrets/mailman_secret_key", length: 28 }
- { path: "{{ basedir }}/secrets/mailman_restapi_pass", length: 28 }
- { path: "{{ basedir }}/secrets/mysql_root_pass", length: 28 }
- name: pakete installieren
apt:
pkg: ['git', 'logrotate', 'openssl']
update_cache: no
state: present
# - name: pakete installieren
# apt:
# pkg: ['logrotate']
# update_cache: no
# state: present
- name: "create folder struct for {{ servicename }}"
......@@ -26,139 +28,78 @@
with_items:
- "{{ basedir }}"
- "{{ basedir }}/secrets"
# mailcow
- "{{ basedir }}/data/mysql"
- "{{ basedir }}/data/mysql-socket"
- "{{ basedir }}/data/redis"
- "{{ basedir }}/data/rspamd"
- "{{ basedir }}/data/solr"
- "{{ basedir }}/data/postfix"
- "{{ basedir }}/data/sogo-web"
- "{{ basedir }}/data/sogo-userdata-backup"
- "{{ basedir }}/data/xmpp-vol-1"
- "{{ basedir }}/data/xmpp-upload-vol-1"
# mailmann
- "{{ basedir }}/data/mailman-core"
- "{{ basedir }}/data/mailman-core/var"
- "{{ basedir }}/data/mailman-core/var/data"
- "{{ basedir }}/data/mailman-web"
- "{{ basedir }}/data/mailman-postgres"
- name: "create folder struct for {{ servicename }} with rights"
file:
path: "{{ item }}"
state: "directory"
owner: "5000"
group: "5000"
mode: "ugo+rwx"
with_items:
- "{{ basedir }}/data/crypt"
- "{{ basedir }}/data/vmail"
- "{{ basedir }}/data/vmail-index"
- name: check if git dir exists
stat:
path: "{{ basedir }}/mailcow-dockerized/.git"
register: mailcow_dotgit
- name: revert main.cf to avoid local changes
command: "git checkout data/conf/postfix/main.cf"
args:
chdir: "{{ basedir }}/mailcow-dockerized"
when: mailcow_dotgit.stat.exists == True
- name: Git checkout mailcow
git:
repo: 'https://github.com/mailcow/mailcow-dockerized.git'
dest: "{{ basedir }}/mailcow-dockerized"
version: d6a3094bcc8b3d748994978ca7e274301b39e583
# current version 2021-05-18
- name: Git checkout mailman-dockerized
git:
repo: 'https://github.com/maxking/docker-mailman.git'
dest: "{{ basedir }}/docker-mailman"
version: v0.4.4
# current version 2020-03-15
- name: "create folder struct for {{ servicename }} 3"
file:
path: "{{ item }}"
state: "directory"
with_items:
- "{{ basedir }}/mailcow-dockerized/data/assets/ssl/"
- name: check if DH Params exists
stat:
path: "{{ basedir }}/mailcow-dockerized/data/assets/ssl/dhparams.pem"
register: dhparams
- name: generate new DH Params
command: "openssl dhparam -out {{ basedir }}/mailcow-dockerized/data/assets/ssl/dhparams.pem 2048"
when: dhparams.stat.exists == False
- name: deploy mailcow config files
template:
dest: "{{ basedir }}/{{ item }}"
src: "{{ item }}"
mode: 0644
with_items:
- mailcow-dockerized/mailcow.conf
- mailcow-dockerized/docker-compose.override.yml
- mailcow-dockerized/data/conf/postfix/extra.cf
register: config_mailcow
- name: deploy mailman config files
- "{{ basedir }}/db"
- "{{ basedir }}/db-init"
- "{{ basedir }}/mailu"
- "{{ basedir }}/mailu/overrides"
- "{{ basedir }}/mailu/overrides/postfix"
- "{{ basedir }}/mailman-core"
- "{{ basedir }}/mailman-core/var"
- "{{ basedir }}/mailman-core/var/data"
- "{{ basedir }}/mailman-web"
# - "{{ basedir }}/mailman-db"
# - name: "create folder struct for {{ servicename }} with rights"
# file:
# path: "{{ item }}"
# state: "directory"
# owner: "5000"
# group: "5000"
# mode: "ugo+rwx"
# with_items:
# - "{{ basedir }}/data/crypt"
# - "{{ basedir }}/data/vmail"
# - "{{ basedir }}/data/vmail-index"
- name: "deploy {{ servicename }} config files"
template:
dest: "{{ basedir }}/{{ item }}"
src: "{{ item }}"
mode: 0644
with_items:
- docker-mailman/docker-compose.override.yml
- docker-mailman/nginx.conf
- data/mailman-core/mailman-extra.cfg
- data/mailman-web/settings_local.py
register: config_mailman
- name: deploy LogRotate configs
template:
src: "logrotate/{{item}}"
dest: "/etc/logrotate.d/{{item}}"
with_items:
- mailman-core
- mailman-web
# Start mailcow containers
- name: "stop {{ servicename }} (mailcow) docker"
- docker-compose.yml
- mailu.env
- mailman.env
- mailman-nginx.conf
- db-init/mailman.sql
- db-init/roundcube.sql
- mailu/overrides/postfix/postfix.cf
register: config
# - name: deploy LogRotate configs
# template:
# src: "logrotate/{{item}}"
# dest: "/etc/logrotate.d/{{item}}"
# with_items:
# - mailman-core
# - mailman-web
# Start containers
- name: "stop {{ servicename }} docker"
docker_compose:
project_src: "{{ basedir }}/mailcow-dockerized"
project_src: "{{ basedir }}"
state: absent
when: config_mailcow.changed
when: config.changed
- name: "start {{ servicename }} (mailcow) docker"
- name: "start {{ servicename }} docker"
docker_compose:
project_src: "{{ basedir }}/mailcow-dockerized"
project_src: "{{ basedir }}"
state: present
# Start mailman containers
- name: "stop {{ servicename }} (mailman) docker"
docker_compose:
project_src: "{{ basedir }}/docker-mailman"
state: absent
when: config_mailcow.changed
- name: "start {{ servicename }} (mailman) docker"
docker_compose:
project_src: "{{ basedir }}/docker-mailman"
state: present
# - name: "stop {{ servicename }} (mailman) docker"
# docker_compose:
# project_src: "{{ basedir }}/docker-mailman"
# state: absent
# when: config_mailcow.changed
# - name: "start {{ servicename }} (mailman) docker"
# docker_compose:
# project_src: "{{ basedir }}/docker-mailman"
# state: present
[mailman]
site_owner: listmaster@warpzone.ms
[mta]
remove_dkim_headers: yes
from settings import *
import socket
# Archivierung für Mailman-Core Container erlauben
MAILMAN_ARCHIVER_FROM = (socket.gethostbyname('mailman-core'),)
# disable social logins (google, facebook, etc. )
INSTALLED_APPS = [a for a in INSTALLED_APPS if not
a.startswith('allauth.socialaccount.providers') and not
a.startswith('django_mailman3.lib.auth.fedora')]
# Mail backend settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'postfix'
EMAIL_PORT = 25
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
DEFAULT_FROM_EMAIL = 'listmaster@warpzone.ms'
SERVER_EMAIL = 'listmaster@warpzone.ms'
CREATE DATABASE IF NOT EXISTS mailman;
CREATE USER IF NOT EXISTS mailman@'%' IDENTIFIED BY '{{ mailman_db_pass }}';
GRANT ALL ON mailman.* TO mailman@'%';
FLUSH PRIVILEGES;
CREATE DATABASE IF NOT EXISTS roundcube;
CREATE USER IF NOT EXISTS roundcube@'%' IDENTIFIED BY '{{ roundcube_db_pass }}';
GRANT ALL ON roundcube.* TO roundcube@'%';
FLUSH PRIVILEGES;
version: '2.2'
services:
# External dependencies
redis:
image: redis:alpine
restart: always
volumes:
- "{{ basedir }}/mailu/redis:/data"
depends_on:
- resolver
dns:
- 192.168.203.254
# Certdumper
certdumper:
image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}traefik-certdumper:${MAILU_VERSION:-2.0}
restart: always
environment:
- DOMAIN={{ mailserver }}
- TRAEFIK_VERSION=v2
volumes:
- "/srv/traefik:/traefik"
- "{{ basedir }}/mailu/certs:/output"
# Core services
front:
image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}nginx:${MAILU_VERSION:-2.0}
restart: always
depends_on:
- db
- resolver
env_file: mailu.env
ports:
- "25:25" #smtp
- "465:465" #submissions
- "587:587" #submission
- "143:143" #imap
- "993:993" #imaps
volumes:
- "{{ basedir }}/mailu/certs:/certs"
- "{{ basedir }}/mailu/overrides/nginx:/overrides:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.{{ servicename }}.entrypoints=websecure"
- "traefik.http.routers.{{ servicename }}.rule=Host(`{{ mailserver }}`)"
- "traefik.http.routers.{{ servicename }}.tls"
- "traefik.http.routers.{{ servicename }}.tls.certresolver=letsencrypt"
- "traefik.http.routers.{{ servicename }}.tls.domains[0].main={{ domain }}"
- "traefik.http.routers.{{ servicename }}.tls.domains[0].sans={{ mailserver }}"
- "traefik.http.routers.{{ servicename }}.service={{ servicename }}"
- "traefik.http.services.{{ servicename }}.loadbalancer.server.port=80"
networks:
- default
- web
dns:
- 192.168.203.254
resolver:
image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}unbound:${MAILU_VERSION:-2.0}
env_file: mailu.env
restart: always
networks:
default:
ipv4_address: 192.168.203.254
admin:
image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}admin:${MAILU_VERSION:-2.0}
restart: always
depends_on:
- db
- redis
- resolver
env_file: mailu.env
volumes:
- "{{ basedir }}/mailu/data:/data"
- "{{ basedir }}/mailu/dkim:/dkim"
dns:
- 192.168.203.254
imap:
image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}dovecot:${MAILU_VERSION:-2.0}
restart: always
depends_on:
- db
- front
- resolver
env_file: mailu.env
volumes:
- "{{ basedir }}/mailu/mail:/mail"
- "{{ basedir }}/mailu/overrides/dovecot:/overrides:ro"
dns:
- 192.168.203.254
smtp:
image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}postfix:${MAILU_VERSION:-2.0}
restart: always
depends_on:
- db
- front
- resolver
- mailman-core
env_file: mailu.env
volumes:
- "{{ basedir }}/mailu/mailqueue:/queue"
- "{{ basedir }}/mailu/overrides/postfix:/overrides:ro"
- "{{ basedir }}/mailman-core/var/data:/opt/mailman:ro"
dns:
- 192.168.203.254
oletools:
image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}oletools:${MAILU_VERSION:-2.0}
hostname: oletools
restart: always
depends_on:
- resolver
networks:
- noinet
dns:
- 192.168.203.254
antispam:
image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}rspamd:${MAILU_VERSION:-2.0}
hostname: antispam
restart: always
depends_on:
- front
- redis
- oletools
- resolver
env_file: mailu.env
volumes:
- "{{ basedir }}/mailu/filter:/var/lib/rspamd"
- "{{ basedir }}/mailu/overrides/rspamd:/overrides:ro"
networks:
default:
ipv4_address: 192.168.203.253
noinet:
dns:
- 192.168.203.254
# Optional mailu services: Database
db:
image: mariadb:10.5
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always
volumes:
- "{{ basedir }}/db:/var/lib/mysql"
- "{{ basedir }}/db-init:/docker-entrypoint-initdb.d:ro"
environment:
- MYSQL_DATABASE=mailu
- MYSQL_USER=mailu
- MYSQL_PASSWORD={{ mailu_db_pass }}
- MYSQL_ROOT_PASSWORD={{ mysql_root_pass }}
# Optional mailu services: Webmail
webmail:
image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}webmail:${MAILU_VERSION:-2.0}
restart: always
depends_on:
- front
env_file: mailu.env
volumes:
- "{{ basedir }}/mailu/webmail:/data"
- "{{ basedir }}/mailu/overrides/roundcube:/overrides:ro"
# Additional Services: mailman
mailman-core:
image: maxking/mailman-core:0.4
restart: always
env_file: mailman.env
depends_on:
- db
volumes:
- "{{ basedir }}/mailman-core:/opt/mailman:rw,z"
mailman-web:
image: maxking/mailman-web:0.4
restart: always
env_file: mailman.env
depends_on:
- db
volumes:
- "{{ basedir }}/mailman-web:/opt/mailman-web-data:rw,z"
mailman-nginx:
image: nginx:1.19
restart: always
depends_on:
- mailman-web
volumes:
- "{{ basedir }}/mailman-web/:/opt/mailman-web-data:ro,z"
- "{{ basedir }}/mailman-nginx.conf:/etc/nginx/conf.d/default.conf:ro"
labels:
- traefik.enable=true
- traefik.http.routers.{{ servicename }}-mailman.rule=Host(`{{ listserver }}`)
- traefik.http.routers.{{ servicename }}-mailman.entrypoints=websecure
- traefik.http.services.{{ servicename }}-mailman.loadbalancer.server.port=80
networks:
- default
- web
networks:
default:
driver: bridge
enable_ipv6: true
ipam:
driver: default
config:
# must be a ULA range
- subnet: fd00:dead:beef:25::/64
- subnet: 192.168.203.0/24
noinet:
driver: bridge
internal: true
web:
external: true