mirror of
https://github.com/librenms/docker.git
synced 2026-01-23 02:14:48 +00:00
Remove SSMTP and add SMTP relay container example
This commit is contained in:
parent
9396e72dbb
commit
fba217b8a1
6 changed files with 19 additions and 46 deletions
|
|
@ -18,12 +18,11 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
|
|||
RUN apk --update --no-cache add \
|
||||
bash binutils ca-certificates coreutils curl fping git graphviz imagemagick mtr \
|
||||
mysql-client net-snmp net-snmp-tools nginx nmap openssl python2 py-mysqldb rrdtool runit \
|
||||
shadow ssmtp supervisor tzdata util-linux whois \
|
||||
shadow supervisor tzdata util-linux whois \
|
||||
php7 php7-cli php7-ctype php7-curl php7-fpm php7-gd php7-json php7-mcrypt php7-memcached php7-mbstring php7-mysqli \
|
||||
php7-opcache php7-openssl php7-pdo php7-pdo_mysql php7-phar php7-posix php7-session php7-simplexml php7-snmp \
|
||||
php7-tokenizer php7-xml php7-zip \
|
||||
&& sed -i -e "s/;date\.timezone.*/date\.timezone = UTC/" /etc/php7/php.ini \
|
||||
&& cp -f /etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf.or \
|
||||
&& rm -rf /var/cache/apk/* /var/www/* /tmp/*
|
||||
|
||||
ENV LIBRENMS_VERSION="1.41" \
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ If you are interested, [check out](https://hub.docker.com/r/crazymax/) my other
|
|||
|
||||
* Alpine Linux 3.8, Nginx, PHP 7.2
|
||||
* Cron tasks as a ["sidecar" container](#cron)
|
||||
* [SSMTP](https://linux.die.net/man/8/ssmtp) for SMTP relay to send emails
|
||||
* OPCache enabled to store precompiled script bytecode in shared memory
|
||||
|
||||
### From docker-compose
|
||||
|
|
@ -28,6 +27,7 @@ If you are interested, [check out](https://hub.docker.com/r/crazymax/) my other
|
|||
* [Traefik](https://github.com/containous/traefik-library-image) as reverse proxy and creation/renewal of Let's Encrypt certificates
|
||||
* [Memcached](https://github.com/docker-library/memcached) image ready to use for better scalability
|
||||
* [RRDcached](https://github.com/crazy-max/docker-rrdcached) image ready to use for better scalability
|
||||
* [Postfix SMTP relay](https://github.com/juanluisbaptiste/docker-postfix) image to send emails
|
||||
* [MariaDB](https://github.com/docker-library/mariadb) image as database instance
|
||||
* Cron jobs as a ["sidecar" container](#cron)
|
||||
|
||||
|
|
@ -50,12 +50,6 @@ If you are interested, [check out](https://hub.docker.com/r/crazymax/) my other
|
|||
| `DB_NAME` | `librenms` | MySQL database name
|
||||
| `DB_USER` | `librenms` | MySQL user
|
||||
| `DB_PASSWORD` | `librenms` | MySQL password
|
||||
| `SSMTP_HOST` | | SMTP server host
|
||||
| `SSMTP_PORT` | `25` | SMTP server port
|
||||
| `SSMTP_HOSTNAME` | `$(hostname -f)` | Full hostname
|
||||
| `SSMTP_USER` | | SMTP username
|
||||
| `SSMTP_PASSWORD` | | SMTP password
|
||||
| `SSMTP_TLS` | `NO` | SSL/TLS
|
||||
| `MEMCACHED_HOST` | | Hostname / IP address of a Memcached server
|
||||
| `RRDCACHED_HOST` | | Hostname / IP address of a RRDcached server
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
sendmail_path=/usr/sbin/ssmtp -t
|
||||
|
|
@ -20,10 +20,6 @@ DB_NAME=${DB_NAME:-"librenms"}
|
|||
DB_USER=${DB_USER:-"librenms"}
|
||||
DB_PASSWORD=${DB_PASSWORD:-"asupersecretpassword"}
|
||||
|
||||
SSMTP_PORT=${SSMTP_PORT:-"25"}
|
||||
SSMTP_HOSTNAME=${SSMTP_HOSTNAME:-"$(hostname -f)"}
|
||||
SSMTP_TLS=${SSMTP_TLS:-"NO"}
|
||||
|
||||
# Timezone
|
||||
echo "Setting timezone to ${TZ}..."
|
||||
ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime
|
||||
|
|
@ -55,23 +51,6 @@ echo "Setting Nginx configuration..."
|
|||
sed -e "s/@UPLOAD_MAX_SIZE@/$UPLOAD_MAX_SIZE/g" \
|
||||
/tpls/etc/nginx/nginx.conf > /etc/nginx/nginx.conf
|
||||
|
||||
# SSMTP
|
||||
echo "Setting SSMTP configuration..."
|
||||
if [ -z "$SSMTP_HOST" ] ; then
|
||||
echo "WARNING: SSMTP_HOST must be defined if you want to send emails"
|
||||
cp -f /etc/ssmtp/ssmtp.conf.or /etc/ssmtp/ssmtp.conf
|
||||
else
|
||||
cat > /etc/ssmtp/ssmtp.conf <<EOL
|
||||
mailhub=${SSMTP_HOST}:${SSMTP_PORT}
|
||||
hostname=${SSMTP_HOSTNAME}
|
||||
FromLineOverride=YES
|
||||
AuthUser=${SSMTP_USER}
|
||||
AuthPass=${SSMTP_PASSWORD}
|
||||
UseTLS=${SSMTP_TLS}
|
||||
UseSTARTTLS=${SSMTP_TLS}
|
||||
EOL
|
||||
fi
|
||||
|
||||
# SNMP
|
||||
echo "Updating SNMP community..."
|
||||
sed -i -e "s/RANDOMSTRINGGOESHERE/${LIBRENMS_SNMP_COMMUNITY}/" /etc/snmp/snmpd.conf
|
||||
|
|
@ -127,14 +106,6 @@ cat > ${LIBRENMS_PATH}/config.d/autoupdate.php <<EOL
|
|||
\$config['update'] = 0;
|
||||
EOL
|
||||
|
||||
# Config : Email
|
||||
cat > ${LIBRENMS_PATH}/config.d/email.php <<EOL
|
||||
<?php
|
||||
\$config['email_backend'] = 'mail';
|
||||
\$config['email_from'] = NULL;
|
||||
\$config['email_sendmail_path'] = '/usr/sbin/ssmtp -t';
|
||||
EOL
|
||||
|
||||
# Config : Memcached
|
||||
if [ ! -z "${MEMCACHED_HOST}" ]; then
|
||||
cat > ${LIBRENMS_PATH}/config.d/memcached.php <<EOL
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ services:
|
|||
volumes:
|
||||
- ./db:/var/lib/mysql
|
||||
environment:
|
||||
- TZ=Europe/Paris
|
||||
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
||||
- MYSQL_DATABASE=librenms
|
||||
- MYSQL_USER=librenms
|
||||
|
|
@ -51,6 +52,8 @@ services:
|
|||
|
||||
memcached:
|
||||
image: memcached:alpine
|
||||
environment:
|
||||
- TZ=Europe/Paris
|
||||
restart: always
|
||||
|
||||
rrdcached:
|
||||
|
|
@ -69,12 +72,26 @@ services:
|
|||
- FLUSH_DEAD_DATA_INTERVAL=3600
|
||||
restart: always
|
||||
|
||||
postfix:
|
||||
image: juanluisbaptiste/postfix
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
environment:
|
||||
- SERVER_HOSTNAME=librenms.example.com
|
||||
- SMTP_SERVER=smtp.example.com
|
||||
- SMTP_USERNAME=smtp@example.com
|
||||
- SMTP_PASSWORD=
|
||||
restart: always
|
||||
|
||||
app:
|
||||
image: crazymax/librenms:latest
|
||||
domainname: example.com
|
||||
hostname: librenms
|
||||
depends_on:
|
||||
- db
|
||||
- memcached
|
||||
- rrdcached
|
||||
- smtp
|
||||
volumes:
|
||||
- ./librenms:/data
|
||||
labels:
|
||||
|
|
|
|||
|
|
@ -12,12 +12,5 @@ DB_NAME=librenms
|
|||
DB_USER=librenms
|
||||
DB_PASSWORD=asupersecretpassword
|
||||
|
||||
SSMTP_HOST=smtp.example.com
|
||||
SSMTP_PORT=587
|
||||
SSMTP_HOSTNAME=librenms.example.com
|
||||
SSMTP_USER=smtp@example.com
|
||||
SSMTP_PASSWORD=
|
||||
SSMTP_TLS=YES
|
||||
|
||||
MEMCACHED_HOST=memcached
|
||||
RRDCACHED_HOST=rrdcached
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue