1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-01-23 02:14:48 +00:00

Dedicated example for Traefik (#44)

This commit is contained in:
CrazyMax 2019-10-30 16:53:11 +01:00
parent 66abae2189
commit 4a5f8a0f4c
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
6 changed files with 211 additions and 41 deletions

View file

@ -1,4 +1,4 @@
<p align="center"><a href="https://github.com/librenms/docker" target="_blank"><img height="128"src="https://raw.githubusercontent.com/librenms/docker/master/.res/docker-librenms.jpg"></a></p>
<p align="center"><a href="https://github.com/librenms/docker" target="_blank"><img height="128" src="https://raw.githubusercontent.com/librenms/docker/master/.res/docker-librenms.jpg"></a></p>
<p align="center">
<a href="https://hub.docker.com/r/librenms/librenms/tags?page=1&ordering=last_updated"><img src="https://img.shields.io/github/v/tag/librenms/docker?label=version&style=flat-square" alt="Latest Version"></a>
@ -25,7 +25,7 @@ It's a fork of [CrazyMax's LibreNMS Docker image repository](https://github.com/
* Ability to configure [distributed polling](https://docs.librenms.org/#Extensions/Distributed-Poller/#distributed-poller)
* Ability to add custom Monitoring plugins (Nagios)
* OPCache enabled to store precompiled script bytecode in shared memory
* [Traefik](https://github.com/containous/traefik-library-image) as reverse proxy and creation/renewal of Let's Encrypt certificates
* [Traefik](https://github.com/containous/traefik-library-image) as reverse proxy and creation/renewal of Let's Encrypt certificates (see [this template](examples/traefik))
* [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

View file

@ -2,11 +2,9 @@
### Docker Compose
Docker compose is the recommended way to run this image. Copy the content of folder [examples/compose](../examples/compose) in `/var/librenms/` on your host for example. Edit the compose and env files with your preferences and run the following commands :
Docker compose is the recommended way to run this image. Copy the content of folder [examples/compose](../examples/compose) in `/var/librenms/` on your host for example. Edit the compose and env files with your preferences and run the following commands:
```bash
touch acme.json
chmod 600 acme.json
docker-compose up -d
docker-compose logs -f
```

View file

@ -1,37 +1,6 @@
version: "3.5"
services:
traefik:
image: traefik:1.7-alpine
container_name: traefik
command:
- "--logLevel=INFO"
- "--defaultentrypoints=http,https"
- "--entryPoints=Name:http Address::80 Redirect.EntryPoint:https"
- "--entryPoints=Name:https Address::443 TLS"
- "--docker"
- "--docker.exposedbydefault=false"
- "--docker.domain=example.com"
- "--acme=true"
- "--acme.acmelogging=true"
- "--acme.email=webmaster@example.com"
- "--acme.storage=acme.json"
- "--acme.entryPoint=https"
- "--acme.onhostrule=true"
- "--acme.httpchallenge=true"
- "--acme.httpchallenge.entrypoint=http"
ports:
- target: 80
published: 80
protocol: tcp
- target: 443
published: 443
protocol: tcp
volumes:
- "./acme.json:/acme.json"
- "/var/run/docker.sock:/var/run/docker.sock"
restart: always
db:
image: mariadb:10.2
container_name: librenms_db
@ -91,6 +60,10 @@ services:
container_name: librenms
domainname: example.com
hostname: librenms
ports:
- target: 80
published: 80
protocol: tcp
depends_on:
- db
- memcached
@ -98,11 +71,6 @@ services:
- smtp
volumes:
- "./librenms:/data"
labels:
- "traefik.enable=true"
- "traefik.backend=librenms"
- "traefik.port=80"
- "traefik.frontend.rule=Host:librenms.example.com"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"

11
examples/traefik/.env Normal file
View file

@ -0,0 +1,11 @@
MYSQL_DATABASE=librenms
MYSQL_USER=librenms
MYSQL_PASSWORD=asupersecretpassword
SMTP_SERVER=smtp.example.com
SMTP_USERNAME=smtp@example.com
SMTP_PASSWORD=
TZ=Europe/Paris
PUID=1000
PGID=1000

View file

@ -0,0 +1,170 @@
version: "3.5"
services:
traefik:
image: traefik:1.7-alpine
container_name: traefik
command:
- "--logLevel=INFO"
- "--defaultentrypoints=http,https"
- "--entryPoints=Name:http Address::80 Redirect.EntryPoint:https"
- "--entryPoints=Name:https Address::443 TLS"
- "--docker"
- "--docker.exposedbydefault=false"
- "--docker.domain=example.com"
- "--acme=true"
- "--acme.acmelogging=true"
- "--acme.email=webmaster@example.com"
- "--acme.storage=acme.json"
- "--acme.entryPoint=https"
- "--acme.onhostrule=true"
- "--acme.httpchallenge=true"
- "--acme.httpchallenge.entrypoint=http"
ports:
- target: 80
published: 80
protocol: tcp
- target: 443
published: 443
protocol: tcp
volumes:
- "./acme.json:/acme.json"
- "/var/run/docker.sock:/var/run/docker.sock"
restart: always
db:
image: mariadb:10.2
container_name: librenms_db
command:
- "mysqld"
- "--sql-mode="
- "--innodb-file-per-table=1"
- "--lower-case-table-names=0"
- "--character-set-server=utf8"
- "--collation-server=utf8_unicode_ci"
volumes:
- "./db:/var/lib/mysql"
environment:
- "TZ=${TZ}"
- "MYSQL_ALLOW_EMPTY_PASSWORD=yes"
- "MYSQL_DATABASE=${MYSQL_DATABASE}"
- "MYSQL_USER=${MYSQL_USER}"
- "MYSQL_PASSWORD=${MYSQL_PASSWORD}"
restart: always
memcached:
image: memcached:alpine
container_name: librenms_memcached
environment:
- "TZ=${TZ}"
restart: always
rrdcached:
image: crazymax/rrdcached
container_name: librenms_rrdcached
volumes:
- "./librenms/rrd:/data/db"
- "./rrd-journal:/data/journal"
environment:
- "TZ=${TZ}"
- "LOG_LEVEL=LOG_INFO"
- "WRITE_TIMEOUT=1800"
- "WRITE_JITTER=1800"
- "WRITE_THREADS=4"
- "FLUSH_DEAD_DATA_INTERVAL=3600"
restart: always
smtp:
image: juanluisbaptiste/postfix
container_name: librenms_smtp
volumes:
- "/etc/localtime:/etc/localtime:ro"
environment:
- "SERVER_HOSTNAME=librenms.example.com"
- "SMTP_SERVER=${SMTP_SERVER}"
- "SMTP_USERNAME=${SMTP_USERNAME}"
- "SMTP_PASSWORD=${SMTP_PASSWORD}"
restart: always
librenms:
image: librenms/librenms:latest
container_name: librenms
domainname: example.com
hostname: librenms
depends_on:
- db
- memcached
- rrdcached
- smtp
volumes:
- "./librenms:/data"
labels:
- "traefik.enable=true"
- "traefik.backend=librenms"
- "traefik.port=80"
- "traefik.frontend.rule=Host:librenms.example.com"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=30"
env_file:
- "./librenms.env"
restart: always
cron:
image: librenms/librenms:latest
container_name: librenms_cron
domainname: example.com
hostname: librenms
depends_on:
- librenms
volumes:
- "./librenms:/data"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=30"
- "SIDECAR_CRON=1"
env_file:
- "./librenms.env"
restart: always
syslog-ng:
image: librenms/librenms:latest
container_name: librenms_syslog
domainname: example.com
hostname: librenms
depends_on:
- librenms
ports:
- target: 514
published: 514
protocol: tcp
- target: 514
published: 514
protocol: udp
volumes:
- "./librenms:/data"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=30"
- "SIDECAR_SYSLOGNG=1"
env_file:
- "./librenms.env"
restart: always

View file

@ -0,0 +1,23 @@
MEMORY_LIMIT=256M
UPLOAD_MAX_SIZE=16M
OPCACHE_MEM_SIZE=128
REAL_IP_FROM=0.0.0.0/32
REAL_IP_HEADER=X-Forwarded-For
LOG_IP_VAR=http_x_forwarded_for
LIBRENMS_POLLER_THREADS=16
LIBRENMS_POLLER_INTERVAL=5
LIBRENMS_CRON_DISCOVERY_ENABLE=true
LIBRENMS_CRON_DAILY_ENABLE=true
LIBRENMS_CRON_ALERTS_ENABLE=true
LIBRENMS_CRON_BILLING_ENABLE=true
LIBRENMS_CRON_BILLING_CALCULATE_ENABLE=true
LIBRENMS_CRON_CHECK_SERVICES_ENABLE=true
LIBRENMS_CRON_POLLER_ENABLE=true
LIBRENMS_SNMP_COMMUNITY=librenmsdocker
MEMCACHED_HOST=memcached
MEMCACHED_PORT=11211
RRDCACHED_HOST=rrdcached
RRDCACHED_PORT=42217