From fa2dd2956ef81f4b9ba63260c71df2cc7f61ca30 Mon Sep 17 00:00:00 2001 From: Olivier Girondel Date: Wed, 1 May 2019 12:33:35 +0200 Subject: [PATCH] Use namshi/smtp as SMTP container --- docker-compose.yml | 32 ++++++++++---------------------- postfix/Dockerfile | 38 -------------------------------------- postfix/postfix.sh | 2 -- 3 files changed, 10 insertions(+), 62 deletions(-) delete mode 100644 postfix/Dockerfile delete mode 100644 postfix/postfix.sh diff --git a/docker-compose.yml b/docker-compose.yml index 0426312..cc6939c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -94,14 +94,8 @@ # The inital database to be created on first launch of influxdb. Ignored # after influxdb has been launched. # -# TTN_DASHBOARD_MAIL_DOMAIN -# the postfix mail domain. -# # TTN_DASHBOARD_MAIL_HOST_NAME -# the external FQDN for the mail host. -# -# TTN_DASHBOARD_MAIL_RELAY_IP -# the mail relay machine, assuming that the real mailer is upstream from us. +# The mail hostname. # # TTN_DASHBOARD_PORT_HTTP # The port to listen to for HTTP. Primarily for test purposes. Defaults to @@ -151,10 +145,10 @@ services: user: "root" volumes: - "${TTN_DASHBOARD_DATA}node-red:/data" - # nodered opens ports on influxdb so it needs to be able to talk to it. + # nodered opens ports on influxdb and smtp so it needs to be able to talk to them. links: - influxdb - - postfix + - smtp influxdb: restart: unless-stopped @@ -183,17 +177,11 @@ services: links: - influxdb - - postfix: + smtp: restart: unless-stopped - build: - context: ./postfix - dockerfile: Dockerfile - args: - relay_ip: "${TTN_DASHBOARD_MAIL_RELAY_IP:-}" - host_name: "${TTN_DASHBOARD_MAIL_HOST_NAME:-.}" - domain: "${TTN_DASHBOARD_MAIL_DOMAIN:-.}" - + image: namshi/smtp + environment: + MAILNAME: "${TTN_DASHBOARD_MAIL_HOST_NAME:-.}" grafana: restart: unless-stopped @@ -207,15 +195,15 @@ services: GF_SERVER_ROOT_URL: "https://%(domain)s/grafana/" GF_SMTP_ENABLED: "${TTN_DASHBOARD_GRAFANA_SMTP_ENABLED:-false}" GF_SMTP_SKIP_VERIFY: "${TTN_DASHBOARD_GRAFANA_SMTP_SKIP_VERIFY:-false}" - GF_SMTP_HOST: "postfix:25" + GF_SMTP_HOST: "smtp:25" GF_SMTP_FROM_ADDRESS: "${TTN_DASHBOARD_GRAFANA_SMTP_FROM_ADDRESS:-grafana@localhost}" GF_SMTP_FROM_NAME: "${TTN_DASHBOARD_GRAFANA_PROJECT_NAME:-Default} grafana admin" GF_LOG_MODE: "${TTN_DASHBOARD_GRAFANA_LOG_MODE:-console,file}" GF_LOG_LEVEL: "${TTN_DASHBOARD_GRAFANA_LOG_LEVEL:-info}" GF_INSTALL_PLUGINS: "${TTN_DASHBOARD_GRAFANA_INSTALL_PLUGINS:-}" - # grafana opens ports on influxdb and postfix, so it needs to be able to talk to it. + # grafana opens ports on influxdb and smtp, so it needs to be able to talk to them. links: - influxdb - - postfix + - smtp ### end of file ### diff --git a/postfix/Dockerfile b/postfix/Dockerfile deleted file mode 100644 index e093ed3..0000000 --- a/postfix/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -# -# Dockerfile for building POSTFIX -# -# Build the Postfix using phusion base image -FROM phusion/baseimage - -# some basic package installation for troubleshooting -RUN apt-get update && apt-get install -y \ - iputils-ping \ - net-tools \ - debconf-utils \ - mailutils - -# passing arguments to build postfix image -ARG relay_ip -ARG host_name -ARG domain - -# Install Postfix -RUN echo "postfix postfix/mailname string $host_name" | debconf-set-selections -RUN echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections -RUN apt-get install -y postfix -RUN postconf -e relayhost=$relay_ip -RUN postconf -e myhostname=$host_name -RUN postconf -e mydomain=$domain -RUN postconf -e smtp_generic_maps=hash:/etc/postfix/generic -RUN postconf -e mynetworks="127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.18.0.0/16" -RUN postconf -e smtpd_use_tls=no -RUN echo $host_name > /etc/mailname - -# This will replace local mail addresses by valid Internet addresses when mail leaves the machine via SMTP. so please change it according to container. -RUN echo "root@aa7fde2ee7f1 iotmail@example.com" > /etc/postfix/generic -RUN postmap /etc/postfix/generic - -# Start the postfix daemon during container startup -RUN mkdir -p /etc/my_init.d -COPY postfix.sh /etc/my_init.d/postfix.sh -RUN chmod +x /etc/my_init.d/postfix.sh diff --git a/postfix/postfix.sh b/postfix/postfix.sh deleted file mode 100644 index c14d96e..0000000 --- a/postfix/postfix.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -/etc/init.d/postfix restart