diff --git a/docker-compose.yml b/docker-compose.yml index 02c43b5..fe16df4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -97,14 +97,37 @@ # 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. +# The mail hostname. +# +# TTN_MAIL_RELAY_NETWORKS +# The relay networks. MUST start with ":" +# e.g :192.168.0.0/24 or :192.168.0.0/24:10.0.0.0/16. +# +# TTN_SMARTHOST_ADDRESS +# The smarthost address. +# +# TTN_SMARTHOST_PORT +# The smarthost port. +# +# TTN_SMARTHOST_USER +# The smarthost username. +# +# TTN_SMARTHOST_PASSWORD +# The smarthost user password. +# +# TTN_GMAIL_USER +# [SMTP relay] The Google Mail username. # -# TTN_DASHBOARD_MAIL_RELAY_IP -# the mail relay machine, assuming that the real mailer is upstream from us. +# TTN_GMAIL_PASSWORD +# [SMTP relay] The Google Mail user password. +# +# TTN_SMARTHOST_PASSWORD +# The smarthost user password. +# +# TTN_SMARTHOST_ALIASES +# A list of aliases to puth auth data for authentication, semicolon separated. +# e.g. TTN_SMARTHOST_ALIASES=*.mysmtp.com # # TTN_DASHBOARD_PORT_HTTP # The port to listen to for HTTP. Primarily for test purposes. Defaults to @@ -157,10 +180,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 environment: TZ: "${TTN_DASHBOARD_TIMEZONE:-GMT}" @@ -191,17 +214,21 @@ 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:-.}" - + # Documentation: https://hub.docker.com/r/namshi/smtp + image: namshi/smtp + environment: + TZ: "${TTN_DASHBOARD_TIMEZONE:-GMT}" + MAILNAME: "${TTN_DASHBOARD_MAIL_HOST_NAME:-.}" + RELAY_NETWORKS: "${TTN_MAIL_RELAY_NETWORKS}" + SMARTHOST_ADDRESS: "${TTN_SMARTHOST_ADDRESS}" + SMARTHOST_PORT: "${TTN_SMARTHOST_PORT}" + SMARTHOST_USER: "${TTN_SMARTHOST_USER}" + SMARTHOST_PASSWORD: "${TTN_SMARTHOST_PASSWORD}" + SMARTHOST_ALIASES: "${TTN_SMARTHOST_ALIASES}" + GMAIL_USER: "${TTN_GMAIL_USER}" + GMAIL_PASSWORD: "${TTN_GMAIL_PASSWORD}" grafana: restart: unless-stopped @@ -215,16 +242,16 @@ 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:-}" GF_USERS_ALLOW_SIGN_UP: "${TTN_DASHBOARD_GRAFANA_USERS_ALLOW_SIGN_UP:-false}" - # 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