1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-01-23 18:25:09 +00:00

Compare commits

..

No commits in common. "master" and "1.42.01-RC1" have entirely different histories.

64 changed files with 712 additions and 2638 deletions

13
.dockerignore Normal file
View file

@ -0,0 +1,13 @@
/.dev
/.idea
/*.iml
/.git
/.res
/examples
/.editorconfig
/.gitignore
/.travis.yml
/CHANGELOG.md
/LICENSE
/README.md

View file

@ -3,13 +3,16 @@ root = true
[*]
indent_style = space
indent_size = 2
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[rootfs/**]
[{Dockerfile,*.sh,*.yml}]
indent_size = 2
[assets/**]
insert_final_newline = false
[*.md]

2
.gitattributes vendored
View file

@ -1,2 +0,0 @@
/*.sh linguist-detectable=false
/rootfs/** linguist-detectable=false

1
.github/CODEOWNERS vendored
View file

@ -1 +0,0 @@
* @crazy-max

2
.github/FUNDING.yml vendored
View file

@ -1,2 +0,0 @@
github: crazy-max
custom: https://www.paypal.me/crazyws

View file

@ -1,91 +0,0 @@
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
name: Bug Report
description: Report a bug
labels:
- kind/bug
- status/triage
body:
- type: checkboxes
attributes:
label: Support guidelines
description: Please read the support guidelines before proceeding.
options:
- label: I've read the [support guidelines](https://github.com/librenms/docker/blob/master/.github/SUPPORT.md)
required: true
- type: checkboxes
attributes:
label: I've found a bug and checked that ...
description: |
Make sure that your request fulfills all of the following requirements. If one requirement cannot be satisfied, explain in detail why.
options:
- label: ... the documentation does not mention anything about my problem
- label: ... there are no open or closed issues that are related to my problem
- type: textarea
attributes:
label: Description
description: |
Please provide a brief description of the bug in 1-2 sentences.
validations:
required: true
- type: textarea
attributes:
label: Expected behaviour
description: |
Please describe precisely what you'd expect to happen.
validations:
required: true
- type: textarea
attributes:
label: Actual behaviour
description: |
Please describe precisely what is actually happening.
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: |
Please describe the steps to reproduce the bug.
placeholder: |
1. ...
2. ...
3. ...
validations:
required: true
- type: textarea
attributes:
label: Docker info
description: |
Output of `docker info` command.
render: text
validations:
required: true
- type: textarea
attributes:
label: Docker Compose config
description: |
Output of `docker compose config` command.
render: yaml
- type: textarea
attributes:
label: Logs
description: |
Please provide the container logs (set `LOG_LEVEL=debug` if applicable).
render: text
validations:
required: true
- type: textarea
attributes:
label: Additional info
description: |
Please provide any additional information that seem useful.

View file

@ -1,6 +0,0 @@
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
blank_issues_enabled: true
contact_links:
- name: Questions and Discussions
url: https://github.com/librenms/docker/discussions/new
about: Use Github Discussions to ask questions and/or open discussion topics.

View file

@ -1,15 +0,0 @@
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
name: Feature request
description: Missing functionality? Come tell us about it!
labels:
- kind/enhancement
- status/triage
body:
- type: textarea
id: description
attributes:
label: Description
description: What is the feature you want to see?
validations:
required: true

29
.github/SUPPORT.md vendored
View file

@ -1,29 +0,0 @@
# Support [![](https://isitmaintained.com/badge/resolution/librenms/docker.svg)](https://isitmaintained.com/project/librenms/docker)
## Reporting an issue
Please do a search in [open issues](https://github.com/librenms/docker/issues?utf8=%E2%9C%93&q=) to see if the issue or feature request has already been filed.
If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment.
:+1: - upvote
:-1: - downvote
If you cannot find an existing issue that describes your bug or feature, submit an issue using the guidelines below.
## Writing good bug reports and feature requests
File a single issue per problem and feature request.
* Do not enumerate multiple bugs or feature requests in the same issue.
* Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar, but have different causes.
The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
You are now ready to [create a new issue](https://github.com/librenms/docker/issues/new/choose)!
## Closure policy
* Issues that don't have the information requested above (when applicable) will be closed immediately and the poster directed to the support guidelines.
* Issues that go a week without a response from original poster are subject to closure at my discretion.

73
.github/labels.yml vendored
View file

@ -1,73 +0,0 @@
## more info https://github.com/crazy-max/ghaction-github-labeler
-
name: "bot"
color: "69cde9"
description: ""
-
name: "good first issue"
color: "7057ff"
description: ""
-
name: "help wanted"
color: "4caf50"
description: ""
-
name: "area/ci"
color: "ed9ca9"
description: ""
-
name: "area/dockerfile"
color: "03a9f4"
description: ""
-
name: "kind/bug"
color: "b60205"
description: ""
-
name: "kind/dependencies"
color: "0366d6"
description: ""
-
name: "kind/docs"
color: "c5def5"
description: ""
-
name: "kind/duplicate"
color: "cccccc"
description: ""
-
name: "kind/enhancement"
color: "0054ca"
description: ""
-
name: "kind/invalid"
color: "e6e6e6"
description: ""
-
name: "kind/upstream"
color: "fbca04"
description: ""
-
name: "kind/wontfix"
color: "ffffff"
description: ""
-
name: "status/automerge"
color: "8f4fbc"
description: ""
-
name: "status/needs-investigation"
color: "e6625b"
description: ""
-
name: "status/needs-more-info"
color: "795548"
description: ""
-
name: "status/stale"
color: "237da0"
description: ""
-
name: "status/triage"
color: "dde4b7"
description: ""

16
.github/renovate.json vendored
View file

@ -1,16 +0,0 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"customManagers": [
{
"customType": "regex",
"description": "Update _VERSION variables in Dockerfiles",
"fileMatch": ["(^|/|\\.)Dockerfile$", "(^|/)Dockerfile\\.[^/]*$"],
"matchStrings": [
"# renovate: datasource=(?<datasource>[a-z-]+?)(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>[a-z-]+?))?\\s(?:ENV|ARG) .+?_VERSION=\"(?<currentValue>.+?)\"\\s"
]
}
]
}

View file

@ -1,77 +0,0 @@
name: build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
on:
push:
branches:
- 'master'
tags:
- '*'
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
env:
DOCKERHUB_SLUG: librenms/librenms
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKERHUB_SLUG }}
tags: |
type=match,pattern=(.*)-r,group=1
type=ref,event=pr
type=edge
labels: |
org.opencontainers.image.title=LibreNMS
org.opencontainers.image.description=Fully featured network monitoring system
org.opencontainers.image.vendor=LibreNMS
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v6
with:
files: |
./docker-bake.hcl
cwd://${{ steps.meta.outputs.bake-file }}
targets: image-all
push: ${{ github.event_name != 'pull_request' }}
-
name: Check manifest
if: github.event_name != 'pull_request'
run: |
docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
-
name: Inspect
if: github.event_name != 'pull_request'
run: |
docker pull ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}

View file

@ -1,39 +0,0 @@
name: labels
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
on:
push:
branches:
- 'master'
paths:
- '.github/labels.yml'
- '.github/workflows/labels.yml'
pull_request:
paths:
- '.github/labels.yml'
- '.github/workflows/labels.yml'
jobs:
labeler:
runs-on: ubuntu-latest
permissions:
# same as global permissions
contents: read
# required to update labels
issues: write
steps:
-
name: Checkout
uses: actions/checkout@v6
-
name: Run Labeler
uses: crazy-max/ghaction-github-labeler@v5
with:
dry-run: ${{ github.event_name == 'pull_request' }}

View file

@ -1,81 +0,0 @@
name: test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
on:
push:
branches:
- 'master'
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
env:
BUILD_TAG: librenms:test
CONTAINER_NAME: librenms
jobs:
test:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.version == 'master' }}
strategy:
fail-fast: false
matrix:
version:
- ''
- master
steps:
-
name: Prepare
if: matrix.version != ''
run: |
echo "LIBRENMS_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
-
name: Checkout
uses: actions/checkout@v6
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v6
with:
source: .
targets: image-local
env:
DEFAULT_TAG: ${{ env.BUILD_TAG }}
-
name: Start
run: |
docker compose up -d
working-directory: test
env:
LIBRENMS_IMAGE: ${{ env.BUILD_TAG }}
LIBRENMS_CONTAINER: ${{ env.CONTAINER_NAME }}
-
name: Check container logs
uses: crazy-max/.github/.github/actions/container-logs-check@main
with:
container_name: ${{ env.CONTAINER_NAME }}
log_check: "ready to handle connections"
timeout: 120
-
name: Logs
if: always()
run: |
docker compose logs
working-directory: test
env:
LIBRENMS_IMAGE: ${{ env.BUILD_TAG }}
LIBRENMS_CONTAINER: ${{ env.CONTAINER_NAME }}

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
# Jetbrains
/.idea
/*.iml
# App
/.dev

View file

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Before After
Before After

BIN
.res/paypal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

62
.travis.yml Normal file
View file

@ -0,0 +1,62 @@
sudo: required
services:
- docker
env:
global:
- VERSION=1.42.01
- GITHUB_REPO=crazy-max/docker-librenms
- DOCKER_USERNAME=crazymax
- DOCKER_REPONAME=librenms
- QUAY_USERNAME=crazymax
- QUAY_REPONAME=librenms
- MICROBADGER_HOOK=https://hooks.microbadger.com/images/crazymax/librenms/-iJon04e52FswWvLC-zkB6yi2vo=
- secure: GMYFptO3rWVVITjC0Wz8g9uccBjSMBvVt3aFC3Y08/3Hw9CoA/SS51X/2lh0bRn+y49X0742QC7b2LtSWa3eERM1HbzlS1ODK75+P0lGYdtW2Ng5JutI+GRt8xTouY7+iP4qSAbOYMUdM5e61PkRepJvZWVeBkPtAtcGpxZO75h+snFxuzFVZXWLoSKjByKIqy9VXzT2P0Wx+zuUWpeo2qA62ONRJf5RjIKCDxHmWEwhXKmmDjeqo+Db/zsUwGYSwKpKRGBhyPVP0MnKFA2HQ/+dG1NyikXhae5dhjaZvgG9tSpbYdOWCHCunbxm6VWozt/kvkqkbizn+S3aoeeZyco40ZFIUinpypxw/nZpVvfDkwBIhw3nOS4giMKHLLBtnkSZw2szP6zfdLX6MLKWSjcDsBbtqj8aNe8Z1ViEKc2uW+yqJvd6GNnDL+AINe5rJ/cjeseh1ancOaGG8tlGsg/80dhOV3l+E4nINn+1uj354ncH/lv14e4giDNMGRw8gq7HFWxIE1X8SLetK9Hz5kLyMIPlSCO2fL73adrqfJFFluTQ0CbzsOEHSuScHT8i9UJWrqcu25BQ4pKidmDAt0gT7x6cz7zziuTY0hTO05txIP0FCop0qCFoLuAGM/bQg8r6FnfIZu4NbUxutjLiAN5aMB1D3znnymxKdeX/HOc= # DOCKER_PASSWORD
- secure: XMkF9Nz6FjKVB52vv7rZ+fa7vDDRXG7/nDm5Wio4eljYU/+cIZwdbBv2hU2IEmherZBn2jO9V64LYR9yTLALOGMEjqE/0E8KNiibj7VRjeRmtQrTHbUj7XpBmqAVyNek2GxkmtS4meOIcUUxBOfCAiIu2b++iuR70rAHvr+dL8skX7FNG77ZgTRsP9VkCylyfw0qb+50pD+2ukOFHxZ4tSi89F8ZU4UQOiNTBre4NUPCN5DZmglSt4nUYt3iofKs9p4ZjPP0cTBpHhArn37VZJyo1tOcl1jP8x18PVvgxrHO8Z0FQCasnZ6O269FR8lF28yM4CwHxk6ufCuieCCj5f0ez6S8IEv82a8ljmw+a75Gb6+pAmYB8nY49VkrWmA6KoDY+F+Ob30QOOtLCGumGBLZ1++6MOtwFjN5BzAyVl3Qhl+9heUMM3ULkbEV0IGJHL1M3zEBqxkQO6urdgf6cPEf3uldd+T6Ochn2DZ42Ge+yiZiIrgF/p0R3l1vDbyBG6OcnmaEoQWdIgqa6DUV48MBkYHF9Sp0idUbsrOaoVNsZZ4h0P72fRci/rElvoDGJIAdFEEE1ZW/y3a6hJihxvYQM9+S+HvzluI+5SKzdFUJ4hRpaGfIvclKdyaCNSE1B0VrwGXn7pBt5tem0IZnE5BQ9d/6TgVFc+L2Eyf7Mck= # QUAY_PASSWORD
- secure: mLY2C4Ggmg/VUdWoYc8vqYQb7lLSSB/YMvKUzY+z8VGAi5A8J1A6oTgeeThiKPWaNp9GgU1hdHA5WqoSCuOk2SzJoIEhnPU0j3GkDknuXmbhU1UXsuefMF++v2J9RarmC2CkyGiBDzJCrcs9srcS6RjmbK7hQv5EsbkjjyQHQwZlMG+q2aUwNcNxhAeD0+gn8j6eZ6myxt/SJ3LZRLCb+ZpP1NITc6aHjC9glc6ZO7bTy6WG6SVg0SREdxbht+cUrTNQvAcIkoEZQ4vOJBi3kAo6aZz6QYglofaYpTCdmiSSFGHseJ7k1Dl+khCL8OqeOnVCOkcu8SgPV7tI6WId8Dky/YPUsFtjivJqekjs/ctAekOHTzJW9UeOLkCOiqeLmQTDQ01JDLno1znzMOTC3T96I5d2LUnob3QOu32chdzqw0LfcawcuNnLwLdbK4AwPcDuIUl6b1FjU6I8DckHjtvL9Mr9xLhIkNrhdPW0vAj8yZkvGCxvGXh+qK6ejNDt/RdH6wWojh1yTbJSCAQLo1WnJ5YpqLxtu5++/4PfiTLkt7u8QMnau5m+8wZ4ju2RfFrwmEaKkrZSkq7ViQ+RsI/y0bNxUzk3Bb02Wgh9MfpPUXLA+4llYWIPnbgL17N5zhsROp9u0YSbzc3cWJm+0TQZZ0hAjyXBDoT2UCsDNqE= # GITHUB_TOKEN
before_install:
- sudo apt-get update
- docker --version
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
- export DOCKER_TAG=$(if [ "$BRANCH" == "master" ]; then echo "latest"; else echo $BRANCH; fi)
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH, DOCKER_TAG=$DOCKER_TAG"
install:
- |
docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=${TRAVIS_COMMIT::8} \
--build-arg VERSION=${VERSION} \
-t $DOCKER_USERNAME/$DOCKER_REPONAME .
before_script:
- docker network create -d bridge $DOCKER_REPONAME
- docker run -d --network=$DOCKER_REPONAME --name db mariadb:10.2
- docker run -d --network=$DOCKER_REPONAME --link db -p 8000:80 -e "DB_HOST=db" --name $DOCKER_REPONAME $DOCKER_USERNAME/$DOCKER_REPONAME
- sleep 20
- docker logs $DOCKER_REPONAME
script:
- docker ps | grep $DOCKER_REPONAME
after_success:
- |
test $TRAVIS_PULL_REQUEST = false \
&& echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin \
&& docker tag $DOCKER_USERNAME/$DOCKER_REPONAME $DOCKER_USERNAME/$DOCKER_REPONAME:$DOCKER_TAG \
&& docker tag $DOCKER_USERNAME/$DOCKER_REPONAME $DOCKER_USERNAME/$DOCKER_REPONAME:$VERSION \
&& docker push $DOCKER_USERNAME/$DOCKER_REPONAME \
&& echo "$QUAY_PASSWORD" | docker login quay.io --username "$QUAY_USERNAME" --password-stdin \
&& docker tag $DOCKER_USERNAME/$DOCKER_REPONAME quay.io/$DOCKER_USERNAME/$DOCKER_REPONAME:$DOCKER_TAG \
&& docker tag $DOCKER_USERNAME/$DOCKER_REPONAME quay.io/$DOCKER_USERNAME/$DOCKER_REPONAME:$VERSION \
&& docker push quay.io/$QUAY_USERNAME/$QUAY_REPONAME \
&& curl -X POST $MICROBADGER_HOOK
branches:
except:
- /^[0-9]/
notifications:
webhooks:
secure: qy/lFOFGeP0IMvDTJZmPemOtHjkpnYq4sm734rTjBsKFNA8MU4TyWCnx24hljRd4YazAkH6j2Uav3XfmnR+UGfutXRsmktzZoDTlygiJLP/026gvD+VuT8GZIFXRpYhNlfPemFoN2/wO5sf91JGQL4cxVcF9r1A0aUQUtAzvl9UKwk+DRc9Y78oCKRmIaeoFrvKE1SCGPf/drNYeLKJiRiq7VV5jL+1tmZUjYKWVYnWU3yYSyg3OdAvXAVEDagzvAQ0ors9UJeXxAsAls0kTQc8c2+uWfEH411sRrPuqTYYkXIPQpJszLeDhG0ISU5xs5UCJSi7QzTRxD5lWgn8C2QfGS8x3eQK8fHEfN1Q0frqGdCYJcEC2izs91bwZDmFmDj9B0mkuOyHDjWmTIo+HPkb/ryATFD3Bk2pekHWBkuq+KKTQzvgtgokp4V7xRumDh7htyYzr88uk1EQFR7VY05aWFGFsoZ13oKa4UQ4uglH2xmWVW3X9cyf5NCj/t4mUt5223ZM7Q+LKDONSPz/VEDlSOkPapjC4rpn6mn/k6FNN3UyC4hL9+HXSFyCOJZDy3P6lagCWWlzLxt0R4DnptZG+cShW0+bzcecEaGPjyEidACctKl3hfDCiblg05Js0lvW454C4TPnzZ/tDAE6VE8mCFtU/K1ur+wneZuOv2pA=

14
CHANGELOG.md Normal file
View file

@ -0,0 +1,14 @@
# Changelog
## 1.42.01-RC1 (2018/08/05)
* Upgrade to LibreNMS 1.42.01
## 1.42-RC1 (2018/08/02)
* Upgrade to LibreNMS 1.42
* Add syslog-ng support
## 1.41-RC1 (2018/07/07)
* Initial version based on LibreNMS 1.41

View file

@ -1,147 +1,62 @@
# syntax=docker/dockerfile:1
FROM alpine:3.8
MAINTAINER CrazyMax <crazy-max@users.noreply.github.com>
# renovate: datasource=github-releases packageName=librenms/librenms versioning=semver
ARG LIBRENMS_VERSION="26.1.1"
ARG ALPINE_VERSION="3.22"
ARG SYSLOGNG_VERSION="4.8.3-r1"
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="librenms" \
org.label-schema.description="LibreNMS based on Alpine Linux and Nginx" \
org.label-schema.version=$VERSION \
org.label-schema.url="https://github.com/crazy-max/docker-librenms" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/crazy-max/docker-librenms" \
org.label-schema.vendor="CrazyMax" \
org.label-schema.schema-version="1.0"
FROM crazymax/yasu:latest AS yasu
FROM crazymax/alpine-s6:${ALPINE_VERSION}-2.2.0.3
COPY --from=yasu / /
RUN apk --update --no-cache add \
busybox-extras \
acl \
bash \
bind-tools \
binutils \
ca-certificates \
coreutils \
curl \
file \
fping \
git \
graphviz \
imagemagick \
ipmitool \
iputils \
libcap-utils \
mariadb-client \
monitoring-plugins \
mtr \
net-snmp \
net-snmp-tools \
nginx \
nmap \
openssl \
openssh-client \
perl \
php83 \
php83-cli \
php83-ctype \
php83-curl \
php83-dom \
php83-fileinfo \
php83-fpm \
php83-gd \
php83-gmp \
php83-iconv \
php83-json \
php83-ldap \
php83-mbstring \
php83-mysqlnd \
php83-opcache \
php83-openssl \
php83-pdo \
php83-pdo_mysql \
php83-pecl-memcached \
php83-pear \
php83-phar \
php83-posix \
php83-session \
php83-simplexml \
php83-snmp \
php83-sockets \
php83-tokenizer \
php83-xml \
php83-xmlwriter \
php83-zip \
python3 \
py3-pip \
rrdtool \
runit \
sed \
shadow \
ttf-dejavu \
tzdata \
util-linux \
whois \
&& apk --update --no-cache add -t build-dependencies \
build-base \
make \
mariadb-dev \
musl-dev \
python3-dev \
&& pip3 install --upgrade --break-system-packages pip \
&& pip3 install python-memcached mysqlclient --upgrade --break-system-packages \
&& curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
&& apk del build-dependencies \
&& rm -rf /var/www/* /tmp/* \
&& echo "/usr/sbin/fping -6 \$@" > /usr/sbin/fping6 \
&& chmod +x /usr/sbin/fping6 \
&& chmod u+s,g+s \
/bin/ping \
/bin/ping6 \
/usr/lib/monitoring-plugins/check_icmp \
&& setcap cap_net_raw+ep /usr/bin/nmap \
&& setcap cap_net_raw+ep /usr/sbin/fping \
&& setcap cap_net_raw+ep /usr/sbin/fping6 \
&& setcap cap_net_raw+ep /usr/lib/monitoring-plugins/check_icmp \
&& setcap cap_net_raw+ep /usr/lib/monitoring-plugins/check_ping
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 supervisor syslog-ng 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 \
&& rm -rf /var/cache/apk/* /var/www/* /tmp/*
ARG SYSLOGNG_VERSION
RUN apk --update --no-cache add syslog-ng=${SYSLOGNG_VERSION}
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2" \
ENV LIBRENMS_VERSION="1.42.01" \
LIBRENMS_PATH="/opt/librenms" \
LIBRENMS_DOCKER="1" \
TZ="UTC" \
PUID="1000" \
PGID="1000"
DATA_PATH="/data" \
CRONTAB_PATH="/var/spool/cron/crontabs"
RUN addgroup -g ${PGID} librenms \
&& adduser -D -h /home/librenms -u ${PUID} -G librenms -s /bin/sh -D librenms \
&& curl -sSLk -q https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro -o /usr/bin/distro \
&& chmod +x /usr/bin/distro
RUN mkdir -p /opt \
&& addgroup -g 1000 librenms \
&& adduser -u 1000 -G librenms -h ${LIBRENMS_PATH} -s /sbin/nologin -D librenms \
&& usermod -a -G librenms nginx \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
&& git clone --branch ${LIBRENMS_VERSION} https://github.com/librenms/librenms.git ${LIBRENMS_PATH} \
&& chown -R librenms. ${LIBRENMS_PATH} \
&& su - librenms -s /bin/sh -c "composer install --no-dev --no-interaction --no-ansi --working-dir=${LIBRENMS_PATH}" \
&& wget -q https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro -O /usr/bin/distro \
&& chmod +x /usr/bin/distro \
&& rm -rf /tmp/*
COPY entrypoint.sh /entrypoint.sh
COPY assets /
RUN mkdir -p /data ${LIBRENMS_PATH}/config.d /var/log/supervisord \
&& chmod a+x /entrypoint.sh /usr/local/bin/* \
&& cp ${LIBRENMS_PATH}/snmpd.conf.example /etc/snmp/snmpd.conf \
&& cp ${LIBRENMS_PATH}/config.php.default ${LIBRENMS_PATH}/config.php \
&& echo "foreach (glob(\"${DATA_PATH}/config/*.php\") as \$filename) include \$filename;" >> ${LIBRENMS_PATH}/config.php \
&& echo "foreach (glob(\"${LIBRENMS_PATH}/config.d/*.php\") as \$filename) include \$filename;" >> ${LIBRENMS_PATH}/config.php \
&& chown -R librenms. ${DATA_PATH} ${LIBRENMS_PATH} \
&& chown -R nginx. /var/lib/nginx /var/log/nginx /var/log/php7 /var/tmp/nginx
EXPOSE 80 514 514/udp
WORKDIR ${LIBRENMS_PATH}
ARG LIBRENMS_VERSION
ARG WEATHERMAP_PLUGIN_COMMIT
RUN apk --update --no-cache add -t build-dependencies \
build-base \
linux-headers \
musl-dev \
python3-dev \
&& echo "Installing LibreNMS https://github.com/librenms/librenms.git#${LIBRENMS_VERSION}..." \
&& git clone --depth=1 --branch ${LIBRENMS_VERSION} https://github.com/librenms/librenms.git . \
&& pip3 install --ignore-installed -r requirements.txt --upgrade --break-system-packages \
&& mkdir config.d \
&& cp config.php.default config.php \
&& cp snmpd.conf.example /etc/snmp/snmpd.conf \
&& sed -i '/runningUser/d' lnms \
&& echo "foreach (glob(\"/data/config/*.php\") as \$filename) include \$filename;" >> config.php \
&& echo "foreach (glob(\"${LIBRENMS_PATH}/config.d/*.php\") as \$filename) include \$filename;" >> config.php \
&& chown -R librenms:librenms ${LIBRENMS_PATH} \
&& su librenms -s /bin/sh -c "COMPOSER_CACHE_DIR=/tmp composer install --no-dev --no-interaction --no-ansi" \
&& apk del build-dependencies \
&& rm -rf .git \
html/plugins/Test \
doc/ \
tests/ \
/tmp/*
VOLUME [ "${DATA_PATH}" ]
COPY rootfs /
EXPOSE 8000 514 514/udp 162 162/udp
VOLUME [ "/data" ]
ENTRYPOINT [ "/init" ]
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/usr/bin/supervisord", "-c", "/etc/supervisord.conf" ]

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018-2025 CrazyMax
Copyright (c) 2018 CrazyMax
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

474
README.md
View file

@ -1,294 +1,98 @@
<p align="center"><a href="https://github.com/librenms/docker" target="_blank"><img height="128" src="https://raw.githubusercontent.com/librenms/docker/master/.github/docker-librenms.jpg"></a></p>
<p align="center"><a href="https://github.com/crazy-max/docker-librenms" target="_blank"><img height="128"src="https://raw.githubusercontent.com/crazy-max/docker-librenms/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>
<a href="https://github.com/librenms/docker/actions?workflow=build"><img src="https://img.shields.io/github/actions/workflow/status/librenms/docker/build.yml?branch=master&label=build&logo=github&style=flat-square" alt="Build Status"></a>
<a href="https://hub.docker.com/r/librenms/librenms/"><img src="https://img.shields.io/docker/stars/librenms/librenms.svg?style=flat-square&logo=docker" alt="Docker Stars"></a>
<a href="https://hub.docker.com/r/librenms/librenms/"><img src="https://img.shields.io/docker/pulls/librenms/librenms.svg?style=flat-square&logo=docker" alt="Docker Pulls"></a>
<br /><a href="https://github.com/sponsors/crazy-max"><img src="https://img.shields.io/badge/sponsor-crazy--max-181717.svg?logo=github&style=flat-square" alt="Become a sponsor"></a>
<a href="https://www.paypal.me/crazyws"><img src="https://img.shields.io/badge/donate-paypal-00457c.svg?logo=paypal&style=flat-square" alt="Donate Paypal"></a>
<a href="https://microbadger.com/images/crazymax/librenms"><img src="https://images.microbadger.com/badges/version/crazymax/librenms.svg?style=flat-square" alt="Version"></a>
<a href="https://travis-ci.org/crazy-max/docker-librenms"><img src="https://img.shields.io/travis/crazy-max/docker-librenms/master.svg?style=flat-square" alt="Build Status"></a>
<a href="https://hub.docker.com/r/crazymax/librenms/"><img src="https://img.shields.io/docker/stars/crazymax/librenms.svg?style=flat-square" alt="Docker Stars"></a>
<a href="https://hub.docker.com/r/crazymax/librenms/"><img src="https://img.shields.io/docker/pulls/crazymax/librenms.svg?style=flat-square" alt="Docker Pulls"></a>
<a href="https://quay.io/repository/crazymax/librenms"><img src="https://quay.io/repository/crazymax/librenms/status?style=flat-square" alt="Docker Repository on Quay"></a>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=962TPYQKMQ2UE"><img src="https://img.shields.io/badge/donate-paypal-7057ff.svg?style=flat-square" alt="Donate Paypal"></a>
</p>
## About
Docker image for [LibreNMS](https://www.librenms.org/), a fully featured network
monitoring system that provides a wealth of features and device support.
> [!TIP]
> Want to be notified of new releases? Check out 🔔 [Diun (Docker Image Update Notifier)](https://github.com/crazy-max/diun)
> project!
___
* [Features](#features)
* [Demo](#demo)
* [Build locally](#build-locally)
* [Image](#image)
* [Environment variables](#environment-variables)
* [General](#general)
* [Redis](#redis)
* [Dispatcher service](#dispatcher-service)
* [Syslog-ng](#syslog-ng)
* [Snmptrapd](#snmptrapd)
* [Database](#database)
* [Misc](#misc)
* [Volumes](#volumes)
* [Ports](#ports)
* [Usage](#usage)
* [Docker Compose](#docker-compose)
* [Command line](#command-line)
* [First launch](#first-launch)
* [Upgrade](#upgrade)
* [Configuration Management](#configuration-management)
* [Initial Configuration](#initial-configuration)
* [Live Configuration](#live-configuration)
* [Re-Apply YAML Config](#re-apply-yaml-config)
* [Live Config](#live-config)
* [Notes](#notes)
* [LNMS command](#lnms-command)
* [Validate](#validate)
* [Dispatcher service container](#dispatcher-service-container)
* [Syslog-ng container](#syslog-ng-container)
* [Snmptrapd container](#snmptrapd-container)
* [Add a LibreNMS plugin](#add-a-librenms-plugin)
* [Additional Monitoring plugins](#additional-monitoring-plugins)
* [Custom alert templates](#custom-alert-templates)
* [Contributing](#contributing)
* [License](#license)
🐳 [LibreNMS](https://www.librenms.org/) Docker image based on Alpine Linux and Nginx.<br />
If you are interested, [check out](https://hub.docker.com/r/crazymax/) my other 🐳 Docker images!
## Features
* Run as non-root user
* Multi-platform image
* [Dispatcher service](#dispatcher-service) as "sidecar" container
### Included
* Alpine Linux 3.8, Nginx, PHP 7.2
* Cron tasks as a ["sidecar" container](#cron)
* Syslog-ng support through a ["sidecar" container](#syslog-ng)
* Snmp-trap support through a ["sidecar" container](#snmptrapd)
* Ability to add custom Monitoring plugins
* Ability to add custom alert templates
* OPCache enabled to store precompiled script bytecode in shared memory
* [s6-overlay](https://github.com/just-containers/s6-overlay/) as process supervisor
* [Traefik](https://github.com/containous/traefik-library-image) as reverse proxy and creation/renewal of Let's Encrypt certificates (see [this template](examples/traefik))
* [Redis](https://github.com/docker-library/redis) image ready to use for better scalability
* [RRDcached](https://github.com/crazy-max/docker-rrdcached) image ready to use for data caching and graphs
* [msmtpd SMTP relay](https://github.com/crazy-max/docker-msmtpd) image to send emails
### From docker-compose
* [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)
* Syslog-ng support through a ["sidecar" container](#syslog-ng)
## Demo
## Docker
[![Try in PWD](https://raw.githubusercontent.com/play-with-docker/stacks/master/assets/images/button.png)](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/librenms/docker/master/examples/pwd/librenms.yml)
### Environment variables
## Build locally
```console
$ git clone https://github.com/librenms/docker.git docker-librenms
$ cd docker-librenms
# Build image and output to docker (default)
$ docker buildx bake
# Build multi-platform image
$ docker buildx bake image-all
```
## Image
Following platforms for this image are available:
```
$ docker buildx imagetools inspect librenms/librenms --format "{{json .Manifest}}" | \
jq -r '.manifests[] | select(.platform.os != null and .platform.os != "unknown") | .platform | "\(.os)/\(.architecture)\(if .variant then "/" + .variant else "" end)"'
linux/386
linux/amd64
linux/arm/v7
linux/arm64
linux/ppc64le
linux/s390x
```
## Environment variables
### General
* `TZ`: The timezone assigned to the container (default `UTC`)
* `PUID`: LibreNMS user id (default `1000`)
* `TZ` : The timezone assigned to the container (default `UTC`)
* `PUID` : LibreNMS user id (default `1000`)
* `PGID`: LibreNMS group id (default `1000`)
* `MEMORY_LIMIT`: PHP memory limit (default `256M`)
* `MAX_INPUT_VARS`: PHP max input vars (default `1000`)
* `UPLOAD_MAX_SIZE`: Upload max size (default `16M`)
* `CLEAR_ENV`: Clear environment in FPM workers (default `yes`)
* `FPM_PM_MAX_CHILDREN`: FPM max Children (default: `15`)
* `FPM_PM_START_SERVERS`: FPM start servers (default: `2`)
* `FPM_PM_MIN_SPARE_SERVERS`: FPM min spare servers (default: `1`)
* `FPM_PM_MAX_SPARE_SERVERS`: FPM max spare servers (default: `6`)
* `OPCACHE_MEM_SIZE`: PHP OpCache memory consumption (default `128`)
* `LISTEN_IPV6`: Enable IPv6 for Nginx (default `true`)
* `REAL_IP_FROM`: Trusted addresses that are known to send correct replacement addresses (default `0.0.0.0/32`)
* `REAL_IP_HEADER`: Request header field whose value will be used to replace the client address (default `X-Forwarded-For`)
* `LOG_IP_VAR`: Use another variable to retrieve the remote IP address for access [log_format](http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format) on Nginx. (default `remote_addr`)
* `SESSION_DRIVER`: [Driver to use for session storage](https://github.com/librenms/librenms/blob/master/config/session.php) (default `file`)
* `CACHE_DRIVER`: [Driver to use for cache and locks](https://github.com/librenms/librenms/blob/master/config/cache.php) (default `database`)
* `MEMORY_LIMIT` : PHP memory limit (default `256M`)
* `UPLOAD_MAX_SIZE` : Upload max size (default `16M`)
* `OPCACHE_MEM_SIZE` : PHP OpCache memory consumption (default `128`)
* `LIBRENMS_POLLER_THREADS` : Threads that `poller-wrapper.py` runs (default `16`)
* `LIBRENMS_SNMP_COMMUNITY` : Your community string (default `librenmsdocker`)
* `DB_HOST` : MySQL database hostname / IP address
* `DB_PORT` : MySQL database port (default `3306`)
* `DB_NAME` : MySQL database name (default `librenms`)
* `DB_USER` : MySQL user (default `librenms`)
* `DB_PASSWORD` : MySQL password (default `librenms`)
* `MEMCACHED_HOST` : Hostname / IP address of a Memcached server
* `RRDCACHED_HOST` : Hostname / IP address of a RRDcached server
### Redis
### Volumes
> [!NOTE]
> Redis variables should be set on all containers and are required when running
> more than one dispatcher.
* `/data` : Contains configuration, rrd database, logs, additional syslog-ng config files
* `REDIS_HOST`: Redis host for poller synchronization
* `REDIS_SENTINEL`: Redis Sentinel host for high availability Redis cluster
* `REDIS_SENTINEL_SERVICE`: Redis Sentinel service name (default `librenms`)
* `REDIS_SCHEME`: Redis scheme (default `tcp`)
* `REDIS_PORT`: Redis port (default `6379`)
* `REDIS_PASSWORD`: Redis password
* `REDIS_DB`: Redis database (default `0`)
* `REDIS_CACHE_DB`: Redis cache database (default `1`)
### Ports
### Dispatcher service
* `80` : HTTP port
> [!WARNING]
> You need at least one dispatcher sidecar, otherwise poller will not run [sidecar dispatcher container](#dispatcher-service-container).
* `SIDECAR_DISPATCHER`: Set to `1` to enable sidecar dispatcher mode for this container (default `0`)
* `DISPATCHER_NODE_ID`: Unique node ID for your dispatcher service
* `DISPATCHER_ARGS`: Additional args to pass to the [dispatcher service](https://github.com/librenms/librenms/blob/master/librenms-service.py)
### Syslog-ng
> [!WARNING]
> Only used if you enable and run a [sidecar syslog-ng container](#syslog-ng-container).
* `SIDECAR_SYSLOGNG`: Set to `1` to enable sidecar syslog-ng mode for this container (default `0`)
### Snmptrapd
> [!WARNING]
> Only used if you enable and run a [sidecar snmptrapd container](#snmptrapd-container).
* `SIDECAR_SNMPTRAPD`: Set to `1` to enable sidecar snmptrapd mode for this container (default `0`)
* `SNMP_PROCESSING_TYPE`: Sets which type of processing (`log`, `execute`, and/or `net`) to use with the SNMP trap (default `log,execute,net`)
* `SNMP_USER`: Defines what username to authenticate with (default `librenms_user`)
* `SNMP_AUTH`: Defines what password to authenticate with (default `auth_pass` should not be used, but will work)
* `SNMP_PRIV`: Defines what password to encrypt packages with (default `priv_pass` should not be used, but will work)
* `SNMP_AUTH_PROTO`: Sets what protocol (`MD5`|`SHA`) to use for authentication (default `SHA`)
* `SNMP_PRIV_PROTO`: Sets what protocol (`DES`|`AES`) to use for encryption of packages (default `AES`)
* `SNMP_SECURITY_LEVEL`: Sets what security level (`noauth`|`priv`) to use (default `priv`)
* `SNMP_ENGINEID`: Defines what SNMP EngineID to use (default `1234567890`)
* `SNMP_DISABLE_AUTHORIZATION`: Will disable the above access control checks, and revert to the previous behaviour of accepting all incoming notifications. (default `yes`)
* `SNMP_EXTRA_MIB_DIRS`: [Additional directories where MIB files are for SNMP Traps](https://docs.librenms.org/Extensions/SNMP-Trap-Handler/#option-2) (example `/opt/librenms/mibs/veeam`)
### Database
* `DB_HOST`: MySQL database hostname / IP address
* `DB_PORT`: MySQL database port (default `3306`)
* `DB_NAME`: MySQL database name (default `librenms`)
* `DB_USER`: MySQL user (default `librenms`)
* `DB_PASSWORD`: MySQL password (default `librenms`)
* `DB_TIMEOUT`: Time in seconds after which we stop trying to reach the MySQL server (useful for clusters, default `60`)
### Misc
* `LIBRENMS_BASE_URL`: URL of your LibreNMS instance (default `/`)
* `LIBRENMS_SNMP_COMMUNITY`: This container's SNMP v2c community string (default `librenmsdocker`)
* `MEMCACHED_HOST`: Hostname / IP address of a Memcached server
* `MEMCACHED_PORT`: Port of the Memcached server (default `11211`)
* `RRDCACHED_SERVER`: RRDcached server (eg. `rrdcached:42217`)
## Volumes
* `/data`: Contains configuration, plugins, rrd database, logs, additional Monitoring plugins, additional syslog-ng config files
> [!WARNING]
> Note that the volume should be owned by the user/group with the specified
> `PUID` and `PGID`. If you don't give the volume correct permissions, the
> container may not start.
## Ports
* `8000`: HTTP port
* `514 514/udp`: Syslog ports (only used if you enable and run a [sidecar syslog-ng container](#syslog-ng-container))
* `162 162/udp`: Snmptrapd ports (only used if you enable and run a [sidecar snmptrapd container](#snmptrapd-container))
## Usage
## Use this image
### 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 :
```console
$ docker compose up -d
$ docker compose logs -f
```bash
touch acme.json
chmod 600 acme.json
docker-compose up -d
docker-compose logs -f
```
### Command line
You can also use the following minimal command:
```console
$ docker run -d -p 8000:8000 --name librenms \
-v $(pwd)/data:/data \
-e "DB_HOST=db" \
librenms/librenms:latest
```
> [!WARNING]
> `db` must be a running MySQL instance.
### First launch
When you first access the webui, you will be prompted to create an admin user.
> [!NOTE]
> If you lose access, you can create another one using the [`lnms` command](#lnms-command).
## Upgrade
To upgrade to the latest version of LibreNMS, pull the newer image and launch
the container. LibreNMS will upgrade automatically:
```console
$ docker compose down
$ docker compose pull
$ docker compose up -d
```
## Configuration Management
### Initial Configuration
You can set the initial configuration of LibreNMS by placing `*.yaml` files inside `/data/config` folder. Let's say you want to edit the [WebUI config](https://docs.librenms.org/Support/Configuration/#webui-settings).
Create a file called for example `/data/config/webui.yaml` with this content :
```yaml
page_refresh: 300
webui.default_dashboard_id: 0
```
This configuration will be seeded into the LibreNMS database when it is first deployed
and will override the default values.
### Live Configuration
You can edit the running configuration via the LibreNMS web UI or `lnms config:set`
You can also use the following minimal command :
```bash
docker compose exec librenms lnms config:set page_refresh 300
docker run -d -p 80:80 --name librenms \
-v $(pwd)/data:/data \
-e "DB_HOST=db" \
crazymax/librenms:latest
```
### Re-Apply YAML Config
> `-e "DB_HOST=db"`<br />
> :warning: `db` must be a running MySQL instance
Set `REAPPLY_YAML_CONFIG=1` to overwrite any settings that are set during initial config
or via user config back to their initial values every time the container is deployed.
## Notes
### Live Config
### Edit configuration
Using this config method, configuration changes will be reflected live on the containers, BUT
you will be unable to edit the configured settings from within the LibreNMS web UI or lnms config:set.
The same example using PHP `/data/config/webui.php`
You can edit configuration of LibreNMS by placing `*.php` files inside `/data/config` folder. Let's say you want to edit the [WebUI config](https://docs.librenms.org/#Support/Configuration/#webui-settings). Create a file called for example `/data/config/webui.php` with this content :
```php
<?php
@ -296,140 +100,112 @@ $config['page_refresh'] = "300";
$config['webui']['default_dashboard_id'] = 0;
```
## Notes
This configuration will be included in LibreNMS and will override the default values.
### LNMS command
### Add user
If you want to use the `lnms` command to perform common server operations like
manage users, database migration, and more, type:
On first launch, an initial administrator user will be created :
```console
$ docker compose exec librenms lnms
| Login | Password |
|------------|------------|
| `librenms` | `librenms` |
You can create an other user using the commande line :
```text
$ docker exec -it --user librenms librenms php adduser.php <name> <pass> 10 <email>
```
> :warning: Substitute your desired username `<name>`, password `<pass>` and email address `<email>`
### Validate
If you want to validate your installation from the CLI, type the following
command:
If you want to validate your installation from the CLI, type the following command :
```console
$ docker compose exec --user librenms librenms php validate.php
```text
$ docker exec -it --user librenms librenms php validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.64
DB Schema | 2020_04_19_010532_eventlog_sensor_reference_cleanup (165)
PHP | 7.3.18
Python | 3.8.2
MySQL | 10.4.13-MariaDB-1:10.4.13+maria~bionic
RRDTool | 1.7.2
SNMP | NET-SNMP 5.8
LibreNMS | 1.41
DB Schema | 253
PHP | 7.2.7
MySQL | 10.2.16-MariaDB-10.2.16+maria~jessie
RRDTool | 1.7.0
SNMP | NET-SNMP 5.7.3
====================================
[OK] Installed from the official Docker image; no Composer required
[OK] Composer Version: 1.6.5
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] IPv6 is disabled on your server, you will not be able to add IPv6 devices.
[WARN] Updates are managed through the official Docker image
[WARN] You have not added any devices yet.
[FIX] You can add a device in the webui or with ./addhost.php
[FAIL] fping6 location is incorrect or bin not installed.
[FIX] Install fping6 or manually set the path to fping6 by placing the following in config.php: $config['fping6'] = '/path/to/fping6';
[WARN] Your install is over 24 hours out of date, last update: Sat, 30 Jun 2018 21:37:37 +0000
[FIX] Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
[WARN] Your local git branch is not master, this will prevent automatic updates.
[FIX] You can switch back to master with git checkout master
```
### Dispatcher service container
### Update database
If you want to enable the new [Dispatcher service](https://docs.librenms.org/Extensions/Dispatcher-Service/),
you have to run a "sidecar" container (see dispatcher service in
[compose.yml](examples/compose/compose.yml) example) or run a simple container
like this:
To update the database manually, type the following command :
```console
$ docker run -d --name librenms_dispatcher \
```bash
$ docker exec -it --user librenms librenms php build-base.php
```
### Cron
If you want to enable the cron job, you have to run a "sidecar" container like in the [docker-compose file](examples/compose/docker-compose.yml) or run a simple container like this :
```bash
docker run -d --name librenms-cron \
--env-file $(pwd)/librenms.env \
-e SIDECAR_DISPATCHER=1 \
-e DISPATCHER_NODE_ID=dispatcher1 \
-v librenms:/data \
librenms/librenms:latest
crazymax/librenms:latest /usr/local/bin/cron
```
> [!WARNING]
> `librenms` must be a valid volume already attached to a LibreNMS container.
> `-v librenms:/data`<br />
> :warning: `librenms` must be a valid volume already attached to a LibreNMS container
### Syslog-ng container
### Syslog-ng
If you want to enable syslog-ng, you have to run a "sidecar" container (see
syslog-ng service in [compose.yml](examples/compose/compose.yml) example) or
run a simple container like this:
If you want to enable syslog-ng, you have to run a "sidecar" container like in the [docker-compose file](examples/compose/docker-compose.yml) or run a simple container like this :
```console
$ docker run -d --name librenms_syslog \
```bash
docker run -d --name librenms-syslog-ng \
--env-file $(pwd)/librenms.env \
-e SIDECAR_SYSLOGNG=1 \
-p 514 -p 514/udp \
-v librenms:/data \
librenms/librenms:latest
crazymax/librenms:latest /usr/sbin/syslog-ng -F
```
> [!WARNING]
> `librenms` must be a valid volume already attached to a LibreNMS container.
You have to create a configuration file to enable syslog in LibreNMS too. Create a file called for example `/data/config/syslog.php` with this content :
You have to create a configuration file to enable syslog in LibreNMS too. Create
a file called for example `/data/config/syslog.yaml` with this content :
```yaml
enable_syslog: true
```php
<?php
$config['enable_syslog'] = 1;
```
### Snmptrapd container
## Upgrade
If you want to enable snmptrapd, you have to run a "sidecar" container (see
snmptrapd service in [compose.yml](examples/compose/compose.yml) example) or
run a simple container like this:
To upgrade to the latest version of LibreNMS, pull the newer image and launch the container. LibreNMS will upgrade automatically :
```console
$ docker run -d --name librenms_snmptrapd \
--env-file $(pwd)/librenms.env \
-e SIDECAR_SNMPTRAPD=1 \
-p 162 -p 162/udp \
-v librenms:/data \
librenms/librenms:latest
```bash
docker-compose pull
docker-compose up -d
```
> [!WARNING]
> `librenms` must be a valid volume already attached to a LibreNMS container.
## How can i help ?
### Add a LibreNMS plugin
All kinds of contributions are welcomed :raised_hands:!<br />
The most basic way to show your support is to star :star2: the project, or to raise issues :speech_balloon:<br />
But we're not gonna lie to each other, I'd rather you buy me a beer or two :beers:!
You can add [plugins for LibreNMS](https://docs.librenms.org/Extensions/Plugin-System/)
in `/data/plugins/`. If you add a plugin that already exists in LibreNMS, it
will be removed and yours will be used.
> [!WARNING]
> Container has to be restarted to propagate changes.
### Additional Monitoring plugins
You can add a custom Monitoring plugin in `/data/monitoring-plugins/`.
Some plugins can be found in the [Monitoring Plugins](https://github.com/monitoring-plugins/monitoring-plugins#readme)
repo, or in the [unofficial fork for Nagios](https://github.com/nagios-plugins/nagios-plugins#readme).
> [!WARNING]
> Container has to be restarted to propagate changes.
### Custom alert templates
You can add [Laravel alert templates](https://docs.librenms.org/Alerting/Templates/#base-templates)
in `/data/alert-templates/`.
> [!WARNING]
> Container has to be restarted to propagate changes.
## Contributing
Want to contribute? Awesome! The most basic way to show your support is to star
the project, or to raise issues. You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max)
or by making a [PayPal donation](https://www.paypal.me/crazyws) to ensure this
journey continues indefinitely!
Thanks again for your support, it is much appreciated! :pray:
[![Paypal](.res/paypal.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=962TPYQKMQ2UE)
## License

View file

@ -0,0 +1,21 @@
[supervisord]
nodaemon = true
user = root
logfile = /var/log/supervisord/supervisord.log
pidfile = /var/run/supervisord.pid
childlogdir = /var/log/supervisord/
logfile_maxbytes = 50MB
logfile_backups = 10
loglevel = info
[supervisorctl]
serverurl = unix:///var/run/supervisor.sock
[unix_http_server]
file = /var/run/supervisor.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[include]
files = /etc/supervisord/*.conf

View file

@ -0,0 +1,8 @@
[program:nginx]
command = /usr/sbin/nginx
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0
stderr_logfile = /dev/stderr
stderr_logfile_maxbytes = 0
autorestart = false
startentries = 0

View file

@ -0,0 +1,8 @@
[program:php]
command = /usr/sbin/php-fpm7
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0
stderr_logfile = /dev/stderr
stderr_logfile_maxbytes = 0
autorestart = false
startentries = 0

View file

@ -0,0 +1,7 @@
[program:snmpd]
command = /usr/sbin/snmpd -f -c /etc/snmpd.conf
startentries = 0
stdout_logfile = /proc/1/fd/1
stdout_logfile_maxbytes = 0
stderr_logfile = /proc/1/fd/2
stderr_logfile_maxbytes = 0

View file

@ -1,4 +1,4 @@
@version:4.8
@version:3.13
options {
chain_hostnames(off);
@ -18,7 +18,7 @@ source s_sys {
};
source s_net {
tcp(ip(0.0.0.0), port(514), max-connections(300));
tcp(ip(0.0.0.0), port(514));
udp(ip(0.0.0.0), port(514));
unix-stream("/run/syslog-ng/syslog-ng.sock");
};

View file

@ -1,6 +1,8 @@
pid /var/run/nginx/nginx.pid;
daemon off;
user nginx;
pid /run/nginx.pid;
worker_processes auto;
error_log /proc/self/fd/2 info;
error_log /proc/1/fd/2 info;
worker_rlimit_nofile 8192;
events {
@ -12,17 +14,10 @@ events {
http {
include mime.types;
default_type application/octet-stream;
access_log /proc/1/fd/1;
aio threads;
sendfile on;
large_client_header_buffers 4 16k;
## Temp folders
client_body_temp_path /tmp/nginx 1 2;
proxy_temp_path /tmp/nginx-proxy;
fastcgi_temp_path /tmp/nginx-fastcgi;
uwsgi_temp_path /tmp/nginx-uwsgi;
scgi_temp_path /tmp/nginx-scgi;
## Timeouts
client_body_timeout 60;
@ -35,14 +30,8 @@ http {
tcp_nodelay on;
## Handling of IPs in proxied and load balancing situations
set_real_ip_from @REAL_IP_FROM@;
real_ip_header @REAL_IP_HEADER@;
# Log
log_format main '$@LOG_IP_VAR@ - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log /proc/self/fd/1 main;
set_real_ip_from 0.0.0.0/32;
real_ip_header X-Forwarded-For;
## Hide the Nginx version number
server_tokens off;
@ -65,9 +54,17 @@ http {
## Serve already compressed files directly, bypassing on-the-fly compression
gzip_static on;
## FastCGI
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_buffers 256 4k;
fastcgi_intercept_errors on;
fastcgi_read_timeout 14400;
server {
listen 8000;
listen [::]:8000;
listen 80;
root /opt/librenms/html;
index index.php;
@ -81,19 +78,7 @@ http {
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SERVER_SOFTWARE "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_buffers 256 4k;
fastcgi_buffer_size 32k;
fastcgi_intercept_errors on;
fastcgi_read_timeout 14400;
fastcgi_pass unix:/var/run/php-fpm7.sock;
}
location ~ /\.ht {

View file

@ -0,0 +1,28 @@
[global]
daemonize = no
error_log = /proc/self/fd/2
[www]
user = librenms
group = librenms
listen = /run/php-fpm7.sock
listen.owner = librenms
listen.group = librenms
pm = dynamic
pm.max_children = 15
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 6
request_terminate_timeout = 0
; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2
php_admin_value[post_max_size] = @UPLOAD_MAX_SIZE@
php_admin_value[upload_max_filesize] = @UPLOAD_MAX_SIZE@
php_admin_value[max_execution_time] = 10800
php_admin_value[max_input_time] = 3600
php_admin_value[expose_php] = Off
php_admin_value[memory_limit] = @MEMORY_LIMIT@

View file

@ -0,0 +1,5 @@
#!/bin/sh
set -e
exec busybox crond -f -L /dev/stdout

View file

@ -1,40 +0,0 @@
variable "DEFAULT_TAG" {
default = "librenms:local"
}
variable "LIBRENMS_VERSION" {
default = null
}
// Special target: https://github.com/docker/metadata-action#bake-definition
target "docker-metadata-action" {
tags = ["${DEFAULT_TAG}"]
args = {
LIBRENMS_VERSION = LIBRENMS_VERSION
}
}
// Default target if none specified
group "default" {
targets = ["image-local"]
}
target "image" {
inherits = ["docker-metadata-action"]
}
target "image-local" {
inherits = ["image"]
output = ["type=docker"]
}
target "image-all" {
inherits = ["image"]
platforms = [
"linux/amd64",
"linux/arm/v7",
"linux/arm64",
"linux/386",
"linux/s390x"
]
}

191
entrypoint.sh Normal file
View file

@ -0,0 +1,191 @@
#!/bin/sh
function runas_librenms() {
su - librenms -s /bin/sh -c "$1"
}
TZ=${TZ:-"UTC"}
PUID=${PUID:-1000}
PGID=${PGID:-1000}
MEMORY_LIMIT=${MEMORY_LIMIT:-"256M"}
UPLOAD_MAX_SIZE=${UPLOAD_MAX_SIZE:-"16M"}
OPCACHE_MEM_SIZE=${OPCACHE_MEM_SIZE:-"128"}
LIBRENMS_POLLER_THREADS=${LIBRENMS_POLLER_THREADS:-"16"}
LIBRENMS_SNMP_COMMUNITY=${LIBRENMS_SNMP_COMMUNITY:-"librenmsdocker"}
DB_PORT=${DB_PORT:-"3306"}
DB_NAME=${DB_NAME:-"librenms"}
DB_USER=${DB_USER:-"librenms"}
DB_PASSWORD=${DB_PASSWORD:-"asupersecretpassword"}
# Timezone
echo "Setting timezone to ${TZ}..."
ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime
echo ${TZ} > /etc/timezone
sed -i -e "s|date\.timezone.*|date\.timezone = ${TZ}|" /etc/php7/php.ini \
# Change librenms UID / GID
echo "Checking if librenms UID / GID has changed..."
if [ $(id -u librenms) != ${PUID} ]; then
usermod -u ${PUID} librenms
fi
if [ $(id -g librenms) != ${PGID} ]; then
groupmod -g ${PGID} librenms
fi
# PHP
echo "Setting PHP-FPM configuration..."
sed -e "s/@MEMORY_LIMIT@/$MEMORY_LIMIT/g" \
-e "s/@UPLOAD_MAX_SIZE@/$UPLOAD_MAX_SIZE/g" \
/tpls/etc/php7/php-fpm.d/www.conf > /etc/php7/php-fpm.d/www.conf
# OpCache
echo "Setting OpCache configuration..."
sed -e "s/@OPCACHE_MEM_SIZE@/$OPCACHE_MEM_SIZE/g" \
/tpls/etc/php7/conf.d/opcache.ini > /etc/php7/conf.d/opcache.ini
# Nginx
echo "Setting Nginx configuration..."
sed -e "s/@UPLOAD_MAX_SIZE@/$UPLOAD_MAX_SIZE/g" \
/tpls/etc/nginx/nginx.conf > /etc/nginx/nginx.conf
# SNMP
echo "Updating SNMP community..."
sed -i -e "s/RANDOMSTRINGGOESHERE/${LIBRENMS_SNMP_COMMUNITY}/" /etc/snmp/snmpd.conf
# Init files and folders
echo "Initializing LibreNMS files / folders..."
mkdir -p ${DATA_PATH}/config \
${DATA_PATH}/logs \
${DATA_PATH}/rrd
rm -f ${LIBRENMS_PATH}/config.d/*
echo "Setting LibreNMS configuration..."
# Config : Directories
cat > ${LIBRENMS_PATH}/config.d/directories.php <<EOL
<?php
\$config['install_dir'] = '${LIBRENMS_PATH}';
\$config['log_dir'] = '${DATA_PATH}/logs';
\$config['rrd_dir'] = '${DATA_PATH}/rrd';
EOL
# Config : Database
if [ -z "$DB_HOST" ]; then
>&2 echo "ERROR: DB_HOST must be defined"
exit 1
fi
cat > ${LIBRENMS_PATH}/config.d/database.php <<EOL
<?php
\$config['db_host'] = '${DB_HOST}';
\$config['db_port'] = ${DB_PORT};
\$config['db_user'] = '${DB_USER}';
\$config['db_pass'] = '${DB_PASSWORD}';
\$config['db_name'] = '${DB_NAME}';
EOL
dbcmd="mysql -h ${DB_HOST} -P ${DB_PORT} -u "${DB_USER}" "-p${DB_PASSWORD}""
unset DB_PASSWORD
# Config : User
cat > ${LIBRENMS_PATH}/config.d/user.php <<EOL
<?php
\$config['user'] = "librenms";
EOL
# Config : Fping
cat > ${LIBRENMS_PATH}/config.d/fping.php <<EOL
<?php
\$config['fping'] = "/usr/sbin/fping";
EOL
# Config : Disable autoupdate
cat > ${LIBRENMS_PATH}/config.d/autoupdate.php <<EOL
<?php
\$config['update'] = 0;
EOL
# Config : Memcached
if [ ! -z "${MEMCACHED_HOST}" ]; then
cat > ${LIBRENMS_PATH}/config.d/memcached.php <<EOL
<?php
\$config['memcached']['enable'] = true;
\$config['memcached']['host'] = '$MEMCACHED_HOST';
\$config['memcached']['port'] = 11211;
EOL
fi
# Config : RRDcached
if [ ! -z "${RRDCACHED_HOST}" ]; then
cat > ${LIBRENMS_PATH}/config.d/rrdcached.php <<EOL
<?php
\$config['rrdcached'] = "${RRDCACHED_HOST}:42217";
EOL
fi
# Sidecar cron container ?
if [ "$1" == "/usr/local/bin/cron" ]; then
echo ">>"
echo ">> Sidecar cron container detected"
echo ">>"
# Init
rm -rf ${CRONTAB_PATH}
mkdir -m 0644 -p ${CRONTAB_PATH}
touch ${CRONTAB_PATH}/librenms
# Add crons
cat ${LIBRENMS_PATH}/librenms.nonroot.cron > ${CRONTAB_PATH}/librenms
sed -i -e "s/ librenms //" ${CRONTAB_PATH}/librenms
sed -i -e "s/poller-wrapper.py 16/poller-wrapper.py ${LIBRENMS_POLLER_THREADS}/g" ${CRONTAB_PATH}/librenms
# Fix perms
echo "Fixing permissions..."
chmod -R 0644 ${CRONTAB_PATH}
elif [ "$1" == "/usr/sbin/syslog-ng" ]; then
echo ">>"
echo ">> Sidecar syslog-ng container detected"
echo ">>"
# Init
mkdir -p ${DATA_PATH}/syslog-ng /run/syslog-ng
chown -R librenms. ${DATA_PATH}/syslog-ng /run/syslog-ng
else
# Fix perms
echo "Fixing permissions..."
chown -R librenms. ${DATA_PATH} \
${LIBRENMS_PATH}/config.d \
${LIBRENMS_PATH}/bootstrap \
${LIBRENMS_PATH}/storage
chmod ug+rw ${DATA_PATH}/logs \
${DATA_PATH}/rrd \
${LIBRENMS_PATH}/bootstrap/cache \
${LIBRENMS_PATH}/storage \
${LIBRENMS_PATH}/storage/framework/*
echo "Waiting database..."
waitdb_timeout=30
counter=1
while ! ${dbcmd} -e "show databases;" > /dev/null 2>&1; do
sleep 1
counter=`expr $counter + 1`
if [ ${counter} -gt ${waitdb_timeout} ]; then
>&2 echo "ERROR: Failed to connect to database on $DB_HOST"
exit 1
fi;
done
echo "Database up!"
counttables=$(echo 'SHOW TABLES' | ${dbcmd} "$DB_NAME" | wc -l)
echo "Updating database schema..."
runas_librenms "php build-base.php"
if [ "${counttables}" -eq "0" ]; then
echo "Creating admin user..."
runas_librenms "php adduser.php librenms librenms 10 librenms@librenms.docker"
fi
fi
exec "$@"

View file

@ -1,7 +0,0 @@
TZ=Europe/Paris
PUID=1000
PGID=1000
MYSQL_DATABASE=librenms
MYSQL_USER=librenms
MYSQL_PASSWORD=asupersecretpassword

View file

@ -1,158 +0,0 @@
name: librenms
services:
db:
image: mariadb:10
container_name: librenms_db
command:
- "mysqld"
- "--innodb-file-per-table=1"
- "--lower-case-table-names=0"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
volumes:
- "./db:/var/lib/mysql"
environment:
- "TZ=${TZ}"
- "MARIADB_RANDOM_ROOT_PASSWORD=yes"
- "MYSQL_DATABASE=${MYSQL_DATABASE}"
- "MYSQL_USER=${MYSQL_USER}"
- "MYSQL_PASSWORD=${MYSQL_PASSWORD}"
restart: always
redis:
image: redis:7.2-alpine
container_name: librenms_redis
environment:
- "TZ=${TZ}"
restart: always
msmtpd:
image: crazymax/msmtpd:latest
container_name: librenms_msmtpd
env_file:
- "./msmtpd.env"
restart: always
librenms:
image: librenms/librenms:latest
container_name: librenms
hostname: librenms
cap_add:
- NET_ADMIN
- NET_RAW
ports:
- target: 8000
published: 8000
protocol: tcp
depends_on:
- db
- redis
- msmtpd
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
restart: always
dispatcher:
image: librenms/librenms:latest
container_name: librenms_dispatcher
hostname: librenms-dispatcher
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "DISPATCHER_NODE_ID=dispatcher1"
- "SIDECAR_DISPATCHER=1"
restart: always
syslogng:
image: librenms/librenms:latest
container_name: librenms_syslogng
hostname: librenms-syslogng
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
ports:
- target: 514
published: 514
protocol: tcp
- target: 514
published: 514
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SYSLOGNG=1"
restart: always
snmptrapd:
image: librenms/librenms:latest
container_name: librenms_snmptrapd
hostname: librenms-snmptrapd
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
ports:
- target: 162
published: 162
protocol: tcp
- target: 162
published: 162
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SNMPTRAPD=1"
restart: always

View file

@ -0,0 +1,135 @@
version: "3.2"
services:
traefik:
image: traefik:1.6-alpine
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
command:
- "mysqld"
- "--sql-mode="
- "--innodb-file-per-table=1"
- "--lower-case-table-names=0"
volumes:
- "./db:/var/lib/mysql"
environment:
- "TZ=Europe/Paris"
- "MYSQL_ALLOW_EMPTY_PASSWORD=yes"
- "MYSQL_DATABASE=librenms"
- "MYSQL_USER=librenms"
- "MYSQL_PASSWORD=asupersecretpassword"
restart: always
memcached:
image: memcached:alpine
environment:
- "TZ=Europe/Paris"
restart: always
rrdcached:
image: crazymax/rrdcached
volumes:
- "./librenms/rrd:/data/db"
- "./rrd-journal:/data/journal"
environment:
- "TZ=Europe/Paris"
- "PUID=1000"
- "PGID=1000"
- "LOG_LEVEL=LOG_INFO"
- "WRITE_TIMEOUT=1800"
- "WRITE_JITTER=1800"
- "WRITE_THREADS=4"
- "FLUSH_DEAD_DATA_INTERVAL=3600"
restart: always
smtp:
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:
- "traefik.enable=true"
- "traefik.backend=librenms"
- "traefik.port=80"
- "traefik.frontend.rule=Host:librenms.example.com"
env_file:
- ./librenms.env
restart: always
cron:
image: crazymax/librenms:latest
command:
- "/usr/local/bin/cron"
depends_on:
- app
volumes:
- "./librenms:/data"
env_file:
- ./librenms.env
restart: always
syslog-ng:
image: crazymax/librenms:latest
command:
- "/usr/sbin/syslog-ng"
- "-F"
depends_on:
- app
ports:
- target: 514
published: 514
protocol: tcp
- target: 514
published: 514
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- ./librenms.env
restart: always

View file

@ -1,16 +1,16 @@
TZ=Europe/Paris
MEMORY_LIMIT=256M
MAX_INPUT_VARS=1000
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=remote_addr
CACHE_DRIVER=redis
SESSION_DRIVER=redis
REDIS_HOST=redis
LIBRENMS_POLLER_THREADS=16
LIBRENMS_SNMP_COMMUNITY=librenmsdocker
LIBRENMS_WEATHERMAP=false
LIBRENMS_WEATHERMAP_SCHEDULE=*/5 * * * *
DB_HOST=db
DB_NAME=librenms
DB_USER=librenms
DB_PASSWORD=asupersecretpassword
MEMCACHED_HOST=memcached
RRDCACHED_HOST=rrdcached

View file

@ -1,10 +0,0 @@
# https://github.com/crazy-max/docker-msmtpd
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_TLS=on
SMTP_STARTTLS=on
SMTP_TLS_CHECKCERT=on
SMTP_AUTH=on
SMTP_USER=foo
SMTP_PASSWORD=bar
SMTP_FROM=foo@gmail.com

View file

@ -1,152 +0,0 @@
version: "3.5"
x-env-global: &env-global
- &MYSQL_DATABASE "librenms"
- &MYSQL_USER "librenms"
- &MYSQL_PASSWORD "asupersecretpassword"
- &TZ "UTC"
- &PUID "1000"
- &PGID "1000"
x-envlibrenms: &envlibrenms
MEMORY_LIMIT: "256M"
MAX_INPUT_VARS: "1000"
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: "remote_addr"
CACHE_DRIVER: "redis"
SESSION_DRIVER: "redis"
REDIS_HOST: "redis"
LIBRENMS_SNMP_COMMUNITY: "librenmsdocker"
LIBRENMS_WEATHERMAP: "true"
LIBRENMS_WEATHERMAP_SCHEDULE: "*/5 * * * *"
services:
db:
image: mariadb:10.11
command:
- "mysqld"
- "--innodb-file-per-table=1"
- "--lower-case-table-names=0"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
volumes:
- "db:/var/lib/mysql"
environment:
TZ: *TZ
MARIADB_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_DATABASE: *MYSQL_DATABASE
MYSQL_USER: *MYSQL_USER
MYSQL_PASSWORD: *MYSQL_PASSWORD
restart: always
redis:
image: redis:7.2-alpine
environment:
TZ: *TZ
restart: always
librenms:
image: librenms/librenms:edge
hostname: librenms
cap_add:
- NET_ADMIN
- NET_RAW
ports:
- "8000:8000"
depends_on:
- db
- redis
volumes:
- "librenms:/data"
environment:
<<: *envlibrenms
TZ: *TZ
PUID: *PUID
PGID: *PGID
DB_HOST: "db"
DB_NAME: *MYSQL_DATABASE
DB_USER: *MYSQL_USER
DB_PASSWORD: *MYSQL_PASSWORD
DB_TIMEOUT: "60"
restart: always
dispatcher:
image: librenms/librenms:edge
hostname: librenms-dispatcher-1234
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
volumes:
- "librenms:/data"
environment:
<<: *envlibrenms
TZ: *TZ
PUID: *PUID
PGID: *PGID
DB_HOST: "db"
DB_NAME: *MYSQL_DATABASE
DB_USER: *MYSQL_USER
DB_PASSWORD: *MYSQL_PASSWORD
DB_TIMEOUT: "60"
DISPATCHER_NODE_ID: "dispatcher1234"
SIDECAR_DISPATCHER: "1"
restart: always
dispatcher2:
image: librenms/librenms:edge
hostname: librenms-dispatcher-5678
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
volumes:
- "librenms:/data"
environment:
<<: *envlibrenms
TZ: *TZ
PUID: *PUID
PGID: *PGID
DB_HOST: "db"
DB_NAME: *MYSQL_DATABASE
DB_USER: *MYSQL_USER
DB_PASSWORD: *MYSQL_PASSWORD
DB_TIMEOUT: "60"
DISPATCHER_NODE_ID: "dispatcher5678"
SIDECAR_DISPATCHER: "1"
restart: always
syslogng:
image: librenms/librenms:edge
hostname: librenms-syslogng
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
volumes:
- "librenms:/data"
environment:
<<: *envlibrenms
TZ: *TZ
PUID: *PUID
PGID: *PGID
DB_HOST: "db"
DB_NAME: *MYSQL_DATABASE
DB_USER: *MYSQL_USER
DB_PASSWORD: *MYSQL_PASSWORD
DB_TIMEOUT: "60"
SIDECAR_SYSLOGNG: "1"
restart: always
volumes:
db:
librenms:

View file

@ -1,7 +0,0 @@
TZ=Europe/Paris
PUID=1000
PGID=1000
MYSQL_DATABASE=librenms
MYSQL_USER=librenms
MYSQL_PASSWORD=asupersecretpassword

View file

@ -1,176 +0,0 @@
name: librenms
services:
db:
image: mariadb:10
container_name: librenms_db
command:
- "mysqld"
- "--innodb-file-per-table=1"
- "--lower-case-table-names=0"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
volumes:
- "./db:/var/lib/mysql"
environment:
- "TZ=${TZ}"
- "MARIADB_RANDOM_ROOT_PASSWORD=yes"
- "MYSQL_DATABASE=${MYSQL_DATABASE}"
- "MYSQL_USER=${MYSQL_USER}"
- "MYSQL_PASSWORD=${MYSQL_PASSWORD}"
restart: always
redis:
image: redis:7.2-alpine
container_name: librenms_redis
environment:
- "TZ=${TZ}"
restart: always
rrdcached:
image: crazymax/rrdcached
container_name: librenms_rrdcached
volumes:
- "./rrd/db:/data/db"
- "./rrd/journal:/data/journal"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "LOG_LEVEL=LOG_INFO"
- "WRITE_TIMEOUT=1800"
- "WRITE_JITTER=1800"
- "WRITE_THREADS=4"
- "FLUSH_DEAD_DATA_INTERVAL=3600"
restart: always
msmtpd:
image: crazymax/msmtpd:latest
container_name: librenms_msmtpd
env_file:
- "./msmtpd.env"
restart: always
librenms:
image: librenms/librenms:latest
container_name: librenms
hostname: librenms
cap_add:
- NET_ADMIN
- NET_RAW
ports:
- target: 8000
published: 8000
protocol: tcp
depends_on:
- db
- redis
- rrdcached
- msmtpd
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
restart: always
dispatcher:
image: librenms/librenms:latest
container_name: librenms_dispatcher
hostname: librenms-dispatcher
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "DISPATCHER_NODE_ID=dispatcher1"
- "SIDECAR_DISPATCHER=1"
restart: always
syslogng:
image: librenms/librenms:latest
container_name: librenms_syslogng
hostname: librenms-syslogng
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
ports:
- target: 514
published: 514
protocol: tcp
- target: 514
published: 514
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SYSLOGNG=1"
restart: always
snmptrapd:
image: librenms/librenms:latest
container_name: librenms_snmptrapd
hostname: librenms-snmptrapd
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
ports:
- target: 162
published: 162
protocol: tcp
- target: 162
published: 162
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SNMPTRAPD=1"
restart: always

View file

@ -1,17 +0,0 @@
MEMORY_LIMIT=256M
MAX_INPUT_VARS=1000
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=remote_addr
CACHE_DRIVER=redis
SESSION_DRIVER=redis
REDIS_HOST=redis
LIBRENMS_SNMP_COMMUNITY=librenmsdocker
RRDCACHED_SERVER=rrdcached:42217
LIBRENMS_WEATHERMAP=false
LIBRENMS_WEATHERMAP_SCHEDULE=*/5 * * * *

View file

@ -1,10 +0,0 @@
# https://github.com/crazy-max/docker-msmtpd
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_TLS=on
SMTP_STARTTLS=on
SMTP_TLS_CHECKCERT=on
SMTP_AUTH=on
SMTP_USER=foo
SMTP_PASSWORD=bar
SMTP_FROM=foo@gmail.com

View file

@ -1,7 +0,0 @@
TZ=Europe/Paris
PUID=1000
PGID=1000
MYSQL_DATABASE=librenms
MYSQL_USER=librenms
MYSQL_PASSWORD=asupersecretpassword

View file

@ -1,184 +0,0 @@
name: librenms
services:
traefik:
image: traefik:2.5
container_name: traefik
command:
- "--global.checknewversion=false"
- "--global.sendanonymoususage=false"
- "--log=true"
- "--log.level=INFO"
- "--entrypoints.http=true"
- "--entrypoints.http.address=:80"
- "--entrypoints.http.http.redirections.entrypoint.to=https"
- "--entrypoints.http.http.redirections.entrypoint.scheme=https"
- "--entrypoints.https=true"
- "--entrypoints.https.address=:443"
- "--certificatesresolvers.letsencrypt"
- "--certificatesresolvers.letsencrypt.acme.storage=acme.json"
- "--certificatesresolvers.letsencrypt.acme.email=webmaster@example.com"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=http"
- "--providers.docker"
- "--providers.docker.watch=true"
- "--providers.docker.exposedbydefault=false"
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
container_name: librenms_db
command:
- "mysqld"
- "--innodb-file-per-table=1"
- "--lower-case-table-names=0"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
volumes:
- "./db:/var/lib/mysql"
environment:
- "TZ=${TZ}"
- "MARIADB_RANDOM_ROOT_PASSWORD=yes"
- "MYSQL_DATABASE=${MYSQL_DATABASE}"
- "MYSQL_USER=${MYSQL_USER}"
- "MYSQL_PASSWORD=${MYSQL_PASSWORD}"
restart: always
redis:
image: redis:7.2-alpine
container_name: librenms_redis
environment:
- "TZ=${TZ}"
restart: always
msmtpd:
image: crazymax/msmtpd:latest
container_name: librenms_msmtpd
env_file:
- "./msmtpd.env"
restart: always
librenms:
image: librenms/librenms:latest
container_name: librenms
hostname: librenms
depends_on:
- db
- redis
- msmtpd
volumes:
- "./librenms:/data"
labels:
- "traefik.enable=true"
- "traefik.http.routers.librenms.entrypoints=https"
- "traefik.http.routers.librenms.rule=Host(`librenms.example.com`)"
- "traefik.http.routers.librenms.tls=true"
- "traefik.http.routers.librenms.tls.certresolver=letsencrypt"
- "traefik.http.routers.librenms.tls.domains[0].main=librenms.example.com"
- "traefik.http.services.librenms.loadbalancer.server.port=8000"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
restart: always
dispatcher:
image: librenms/librenms:latest
container_name: librenms_dispatcher
hostname: librenms-dispatcher
depends_on:
- librenms
- redis
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "DISPATCHER_NODE_ID=dispatcher1"
- "SIDECAR_DISPATCHER=1"
restart: always
syslogng:
image: librenms/librenms:latest
container_name: librenms_syslog
hostname: librenms-syslogng
depends_on:
- librenms
- redis
ports:
- target: 514
published: 514
protocol: tcp
- target: 514
published: 514
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SYSLOGNG=1"
restart: always
snmptrapd:
image: librenms/librenms:latest
container_name: librenms_snmptrapd
hostname: librenms-snmptrapd
depends_on:
- librenms
- redis
ports:
- target: 162
published: 162
protocol: tcp
- target: 162
published: 162
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SNMPTRAPD=1"
restart: always

View file

@ -1,16 +0,0 @@
MEMORY_LIMIT=256M
MAX_INPUT_VARS=1000
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
CACHE_DRIVER=redis
SESSION_DRIVER=redis
REDIS_HOST=redis
LIBRENMS_SNMP_COMMUNITY=librenmsdocker
LIBRENMS_WEATHERMAP=false
LIBRENMS_WEATHERMAP_SCHEDULE=*/5 * * * *

View file

@ -1,10 +0,0 @@
# https://github.com/crazy-max/docker-msmtpd
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_TLS=on
SMTP_STARTTLS=on
SMTP_TLS_CHECKCERT=on
SMTP_AUTH=on
SMTP_USER=foo
SMTP_PASSWORD=bar
SMTP_FROM=foo@gmail.com

View file

@ -1,5 +0,0 @@
#!/usr/bin/with-contenv sh
# shellcheck shell=sh
# Fix access rights to stdout and stderr
chown ${PUID}:${PGID} /proc/self/fd/1 /proc/self/fd/2 || true

View file

@ -1,13 +0,0 @@
#!/usr/bin/with-contenv sh
# shellcheck shell=sh
set -e
if [ -n "${PGID}" ] && [ "${PGID}" != "$(id -g librenms)" ]; then
echo "Switching to PGID ${PGID}..."
sed -i -e "s/^librenms:\([^:]*\):[0-9]*/librenms:\1:${PGID}/" /etc/group
sed -i -e "s/^librenms:\([^:]*\):\([0-9]*\):[0-9]*/librenms:\1:\2:${PGID}/" /etc/passwd
fi
if [ -n "${PUID}" ] && [ "${PUID}" != "$(id -u librenms)" ]; then
echo "Switching to PUID ${PUID}..."
sed -i -e "s/^librenms:\([^:]*\):[0-9]*:\([0-9]*\)/librenms:\1:${PUID}:\2/" /etc/passwd
fi

View file

@ -1,22 +0,0 @@
#!/usr/bin/with-contenv sh
# shellcheck shell=sh
set -e
echo "Fixing perms..."
mkdir -p /data \
/var/run/nginx \
/var/run/php-fpm
chown librenms:librenms \
/data \
"${LIBRENMS_PATH}" \
"${LIBRENMS_PATH}/.env" \
"${LIBRENMS_PATH}/cache" \
"${LIBRENMS_PATH}/rrd"
chown -R librenms:librenms \
/home/librenms \
/tpls \
/var/lib/nginx \
/var/log/nginx \
/var/log/php83 \
/var/run/nginx \
/var/run/php-fpm

View file

@ -1,259 +0,0 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
set -e
# From https://github.com/docker-library/mariadb/blob/master/docker-entrypoint.sh#L21-L41
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(<"${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
TZ=${TZ:-UTC}
MEMORY_LIMIT=${MEMORY_LIMIT:-256M}
UPLOAD_MAX_SIZE=${UPLOAD_MAX_SIZE:-16M}
CLEAR_ENV=${CLEAR_ENV:-yes}
FPM_PM_MAX_CHILDREN=${FPM_PM_MAX_CHILDREN:-15}
FPM_PM_START_SERVERS=${FPM_PM_START_SERVERS:-2}
FPM_PM_MIN_SPARE_SERVERS=${FPM_PM_MIN_SPARE_SERVERS:-1}
FPM_PM_MAX_SPARE_SERVERS=${FPM_PM_MAX_SPARE_SERVERS:-6}
OPCACHE_MEM_SIZE=${OPCACHE_MEM_SIZE:-128}
LISTEN_IPV6=${LISTEN_IPV6:-true}
REAL_IP_FROM=${REAL_IP_FROM:-"0.0.0.0/32"}
REAL_IP_HEADER=${REAL_IP_HEADER:-"X-Forwarded-For"}
LOG_IP_VAR=${LOG_IP_VAR:-remote_addr}
MAX_INPUT_VARS=${MAX_INPUT_VARS:-1000}
MEMCACHED_PORT=${MEMCACHED_PORT:-11211}
DB_PORT=${DB_PORT:-3306}
DB_NAME=${DB_NAME:-librenms}
DB_USER=${DB_USER:-librenms}
DB_TIMEOUT=${DB_TIMEOUT:-30}
LIBRENMS_BASE_URL=${LIBRENMS_BASE_URL:-/}
# Timezone
echo "Setting timezone to ${TZ}..."
ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime
echo ${TZ} >/etc/timezone
# PHP
echo "Setting PHP-FPM configuration..."
sed -e "s/@MEMORY_LIMIT@/$MEMORY_LIMIT/g" \
-e "s/@UPLOAD_MAX_SIZE@/$UPLOAD_MAX_SIZE/g" \
-e "s/@CLEAR_ENV@/$CLEAR_ENV/g" \
-e "s/@FPM_PM_MAX_CHILDREN@/$FPM_PM_MAX_CHILDREN/g" \
-e "s/@FPM_PM_START_SERVERS@/$FPM_PM_START_SERVERS/g" \
-e "s/@FPM_PM_MIN_SPARE_SERVERS@/$FPM_PM_MIN_SPARE_SERVERS/g" \
-e "s/@FPM_PM_MAX_SPARE_SERVERS@/$FPM_PM_MAX_SPARE_SERVERS/g" \
/tpls/etc/php83/php-fpm.d/www.conf >/etc/php83/php-fpm.d/www.conf
echo "Setting PHP INI configuration..."
sed -i "s|memory_limit.*|memory_limit = ${MEMORY_LIMIT}|g" /etc/php83/php.ini
sed -i "s|;date\.timezone.*|date\.timezone = ${TZ}|g" /etc/php83/php.ini
sed -i "s|;max_input_vars.*|max_input_vars = ${MAX_INPUT_VARS}|g" /etc/php83/php.ini
# OpCache
echo "Setting OpCache configuration..."
sed -e "s/@OPCACHE_MEM_SIZE@/$OPCACHE_MEM_SIZE/g" \
/tpls/etc/php83/conf.d/opcache.ini >/etc/php83/conf.d/opcache.ini
# Nginx
echo "Setting Nginx configuration..."
sed -e "s#@UPLOAD_MAX_SIZE@#$UPLOAD_MAX_SIZE#g" \
-e "s#@REAL_IP_FROM@#$REAL_IP_FROM#g" \
-e "s#@REAL_IP_HEADER@#$REAL_IP_HEADER#g" \
-e "s#@LOG_IP_VAR@#$LOG_IP_VAR#g" \
/tpls/etc/nginx/nginx.conf >/etc/nginx/nginx.conf
if [ "$LISTEN_IPV6" != "true" ]; then
sed -e '/listen \[::\]:/d' -i /etc/nginx/nginx.conf
fi
# SNMP
echo "Updating SNMP community..."
file_env 'LIBRENMS_SNMP_COMMUNITY' 'librenmsdocker'
sed -i -e "s/RANDOMSTRINGGOESHERE/${LIBRENMS_SNMP_COMMUNITY}/" /etc/snmp/snmpd.conf
# Init files and folders
echo "Initializing LibreNMS files / folders..."
mkdir -p /data/config /data/logs /data/monitoring-plugins /data/plugins /data/rrd /data/weathermap /data/alert-templates
if [ -d "${LIBRENMS_PATH}/html/plugins/Weathermap" ]; then
if [ -d "${LIBRENMS_PATH}/html/plugins/Weathermap/configs" ] && [ ! -L "${LIBRENMS_PATH}/html/plugins/Weathermap/configs" ]; then
rm -rf ${LIBRENMS_PATH}/html/plugins/Weathermap/configs
fi
if [ ! -L "${LIBRENMS_PATH}/html/plugins/Weathermap/configs" ]; then
ln -sf /data/weathermap ${LIBRENMS_PATH}/html/plugins/Weathermap/configs
fi
chown -h librenms:librenms ${LIBRENMS_PATH}/html/plugins/Weathermap/configs
find /data/weathermap ${LIBRENMS_PATH}/html/plugins/Weathermap/output \( ! -user librenms -o ! -group librenms \) -exec chown librenms:librenms {} +
fi
# cleanup bad symlink: https://github.com/librenms/docker/issues/294#issuecomment-1190389960
if [ -L "/data/weathermap/weathermap" ]; then
rm /data/weathermap/weathermap
fi
touch /data/logs/librenms.log
rm -rf ${LIBRENMS_PATH}/logs
rm -f ${LIBRENMS_PATH}/config.d/*
mkdir -p /etc/logrotate.d
touch /etc/logrotate.d/librenms
echo "Setting LibreNMS configuration..."
# Env file
if [ -z "$DB_HOST" ]; then
echo >&2 "ERROR: DB_HOST must be defined"
exit 1
fi
file_env 'DB_PASSWORD'
if [ -z "$DB_PASSWORD" ]; then
echo >&2 "ERROR: Either DB_PASSWORD or DB_PASSWORD_FILE must be defined"
exit 1
fi
cat >${LIBRENMS_PATH}/.env <<EOL
APP_URL=${LIBRENMS_BASE_URL}
DB_HOST=${DB_HOST}
DB_PORT=${DB_PORT}
DB_DATABASE=${DB_NAME}
DB_USERNAME=${DB_USER}
DB_PASSWORD="${DB_PASSWORD}"
EOL
# Config : Directories
cat >${LIBRENMS_PATH}/database/seeders/config/directories.yaml <<EOL
install_dir: '${LIBRENMS_PATH}'
log_dir: /data/logs
rrd_dir: /data/rrd
EOL
ln -sf /data/logs ${LIBRENMS_PATH}/logs
# Config : Server
cat >${LIBRENMS_PATH}/database/seeders/config/server.yaml <<EOL
own_hostname: '$(hostname)'
base_url: '${LIBRENMS_BASE_URL}'
EOL
# Config : User
cat >${LIBRENMS_PATH}/database/seeders/config/user.yaml <<EOL
user: librenms
group: librenms
EOL
# Config : Fping
cat >${LIBRENMS_PATH}/database/seeders/config/fping.yaml <<EOL
fping: /usr/sbin/fping
fping6: /usr/sbin/fping6
EOL
# Config : ipmitool
cat >${LIBRENMS_PATH}/database/seeders/config/ipmitool.yaml <<EOL
ipmitool: /usr/sbin/ipmitool
EOL
# Config : Disable autoupdate (set in config.php so it cannot be overridden in the webui)
cat >${LIBRENMS_PATH}/config.d/autoupdate.php <<EOL
<?php
\$config['update'] = 0;
EOL
# Config : Services
cat >${LIBRENMS_PATH}/database/seeders/config/services.yaml <<EOL
show_services: true
nagios_plugins: /usr/lib/monitoring-plugins
EOL
# Config : RRDCached, apply RRDCACHED_SERVER as php as it would be expected to change with the variable
if [ -n "${RRDCACHED_SERVER}" ]; then
cat >${LIBRENMS_PATH}/config.d/rrdcached.php <<EOL
<?php
\$config['rrdcached'] = "${RRDCACHED_SERVER}";
EOL
fi
cat >${LIBRENMS_PATH}/database/seeders/config/rrdtool.yaml <<EOL
rrdtool_version: "1.7.2"
EOL
# Config : Dispatcher
cat >${LIBRENMS_PATH}/database/seeders/config/dispatcher.yaml <<EOL
service_update_enabled: false
service_watchdog_enabled: false
EOL
# Check plugins
echo "Checking LibreNMS plugins..."
plugins=$(ls -l /data/plugins | egrep '^d' | awk '{print $9}')
for plugin in ${plugins}; do
if [ "${plugin}" == "Weathermap" ]; then
echo " WARNING: Plugin Weathermap cannot be overriden. Skipping..."
continue
fi
echo " Linking plugin ${plugin}..."
if [ -d "${LIBRENMS_PATH}/html/plugins/${plugin}" ]; then
rm -rf "${LIBRENMS_PATH}/html/plugins/${plugin}"
fi
ln -sf "/data/plugins/${plugin}" "${LIBRENMS_PATH}/html/plugins/${plugin}"
chown -h librenms:librenms "${LIBRENMS_PATH}/html/plugins/${plugin}"
done
# Fix perms
echo "Fixing perms..."
chown librenms:librenms /data/config /data/monitoring-plugins /data/plugins /data/rrd /data/weathermap /data/alert-templates
find /data/logs ${LIBRENMS_PATH}/composer* ${LIBRENMS_PATH}/config.d ${LIBRENMS_PATH}/bootstrap ${LIBRENMS_PATH}/logs ${LIBRENMS_PATH}/storage ${LIBRENMS_PATH}/vendor \( ! -user librenms -o ! -group librenms \) -exec chown librenms:librenms {} +
chmod ug+rw /data/logs /data/rrd ${LIBRENMS_PATH}/bootstrap/cache ${LIBRENMS_PATH}/storage ${LIBRENMS_PATH}/storage/framework/*
# Check additional Monitoring plugins
echo "Checking additional Monitoring plugins..."
mon_plugins=$(ls -l /data/monitoring-plugins | egrep '^-' | awk '{print $9}')
for mon_plugin in ${mon_plugins}; do
if [ -f "/usr/lib/monitoring-plugins/${mon_plugin}" ]; then
echo " WARNING: Official Monitoring plugin ${mon_plugin} cannot be overriden. Skipping..."
continue
fi
if [[ ${mon_plugin} != check_* ]]; then
echo " WARNING: Monitoring plugin filename ${mon_plugin} invalid. It must start with 'check_'. Skipping..."
continue
fi
if [[ ! -x "/data/monitoring-plugins/${mon_plugin}" ]]; then
echo " WARNING: Monitoring plugin file ${mon_plugin} has to be executable. Skipping..."
continue
fi
echo " Adding ${mon_plugin} Monitoring plugin"
ln -sf /data/monitoring-plugins/${mon_plugin} /usr/lib/monitoring-plugins/${mon_plugin}
done
# Check alert templates
echo "Checking alert templates..."
templates=$(ls -l /data/alert-templates | egrep '^-' | awk '{print $9}')
for template in ${templates}; do
if [ -f "${LIBRENMS_PATH}/resources/views/alerts/templates/${template}" ]; then
echo " WARNING: Default alert template ${template} cannot be overriden. Skipping..."
continue
fi
if [[ ${template} != *.php ]]; then
echo " WARNING: Alert template filename ${template} invalid. It must end with '.php'. Skipping..."
continue
fi
echo " Adding ${template} alert template"
ln -sf /data/alert-templates/${template} ${LIBRENMS_PATH}/resources/views/alerts/templates/${template}
done

View file

@ -1,112 +0,0 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
set -e
# From https://github.com/docker-library/mariadb/blob/master/docker-entrypoint.sh#L21-L41
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(<"${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
DB_PORT=${DB_PORT:-3306}
DB_NAME=${DB_NAME:-librenms}
DB_USER=${DB_USER:-librenms}
DB_TIMEOUT=${DB_TIMEOUT:-60}
SIDECAR_DISPATCHER=${SIDECAR_DISPATCHER:-0}
SIDECAR_SYSLOGNG=${SIDECAR_SYSLOGNG:-0}
SIDECAR_SNMPTRAPD=${SIDECAR_SNMPTRAPD:-0}
if [ "$SIDECAR_DISPATCHER" = "1" ] || [ "$SIDECAR_SYSLOGNG" = "1" ] || [ "$SIDECAR_SNMPTRAPD" = "1" ]; then
exit 0
fi
# Handle .env
if [ ! -f "/data/.env" ]; then
echo "Generating APP_KEY and unique NODE_ID"
cat >"/data/.env" <<EOL
APP_KEY=$(artisan key:generate --no-interaction --force --show)
NODE_ID=$(php -r "echo uniqid();")
EOL
fi
cat "/data/.env" >>"${LIBRENMS_PATH}/.env"
chown librenms:librenms /data/.env "${LIBRENMS_PATH}/.env"
file_env 'DB_PASSWORD'
if [ -z "$DB_PASSWORD" ]; then
echo >&2 "ERROR: Either DB_PASSWORD or DB_PASSWORD_FILE must be defined"
exit 1
fi
dbcmd="mariadb -h ${DB_HOST} -P ${DB_PORT} -u "${DB_USER}" "-p${DB_PASSWORD}""
unset DB_PASSWORD
echo "Waiting ${DB_TIMEOUT}s for database to be ready..."
counter=1
while ! ${dbcmd} -e "show databases;" >/dev/null 2>&1; do
sleep 1
counter=$((counter + 1))
if [ ${counter} -gt ${DB_TIMEOUT} ]; then
echo >&2 "ERROR: Failed to connect to database on $DB_HOST"
exit 1
fi
done
echo "Database ready!"
# Enable first run wizard if db is empty
counttables=$(echo 'SHOW TABLES' | ${dbcmd} "$DB_NAME" | wc -l)
if [ "${counttables}" -eq "0" ]; then
echo "Enabling First Run Wizard..."
echo "INSTALL=user,finish" >>${LIBRENMS_PATH}/.env
fi
echo "Updating database schema..."
lnms migrate --force --no-ansi --no-interaction
artisan db:seed --force --no-ansi --no-interaction
echo "Clear cache"
artisan cache:clear --no-interaction
artisan config:cache --no-interaction
mkdir -p /etc/services.d/nginx
cat >/etc/services.d/nginx/run <<EOL
#!/usr/bin/execlineb -P
with-contenv
s6-setuidgid ${PUID}:${PGID}
nginx -g "daemon off;"
EOL
chmod +x /etc/services.d/nginx/run
mkdir -p /etc/services.d/php-fpm
cat >/etc/services.d/php-fpm/run <<EOL
#!/usr/bin/execlineb -P
with-contenv
s6-setuidgid ${PUID}:${PGID}
php-fpm83 -F
EOL
chmod +x /etc/services.d/php-fpm/run
mkdir -p /etc/services.d/snmpd
cat >/etc/services.d/snmpd/run <<EOL
#!/usr/bin/execlineb -P
with-contenv
/usr/sbin/snmpd -f -c /etc/snmp/snmpd.conf
EOL
chmod +x /etc/services.d/snmpd/run

View file

@ -1,127 +0,0 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
set -e
# From https://github.com/docker-library/mariadb/blob/master/docker-entrypoint.sh#L21-L41
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(<"${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
DB_PORT=${DB_PORT:-3306}
DB_NAME=${DB_NAME:-librenms}
DB_USER=${DB_USER:-librenms}
DB_TIMEOUT=${DB_TIMEOUT:-60}
SIDECAR_DISPATCHER=${SIDECAR_DISPATCHER:-0}
#DISPATCHER_NODE_ID=${DISPATCHER_NODE_ID:-dispatcher1}
#REDIS_HOST=${REDIS_HOST:-localhost}
REDIS_SCHEME=${REDIS_SCHEME:-tcp}
REDIS_PORT=${REDIS_PORT:-6379}
#REDIS_SENTINEL=${REDIS_SENTINEL:-localhost}
REDIS_SENTINEL_SERVICE=${REDIS_SENTINEL_SERVICE:-librenms}
file_env 'REDIS_PASSWORD'
REDIS_DB=${REDIS_DB:-0}
# Continue only if sidecar dispatcher container
if [ "$SIDECAR_DISPATCHER" != "1" ]; then
exit 0
fi
echo ">>"
echo ">> Sidecar dispatcher container detected"
echo ">>"
file_env 'DB_PASSWORD'
if [ -z "$DB_PASSWORD" ]; then
echo >&2 "ERROR: Either DB_PASSWORD or DB_PASSWORD_FILE must be defined"
exit 1
fi
dbcmd="mariadb -h ${DB_HOST} -P ${DB_PORT} -u "${DB_USER}" "-p${DB_PASSWORD}""
unset DB_PASSWORD
echo "Waiting ${DB_TIMEOUT}s for database to be ready..."
counter=1
while ! ${dbcmd} -e "show databases;" >/dev/null 2>&1; do
sleep 1
counter=$((counter + 1))
if [ ${counter} -gt ${DB_TIMEOUT} ]; then
echo >&2 "ERROR: Failed to connect to database on $DB_HOST"
exit 1
fi
done
echo "Database ready!"
while ! ${dbcmd} -e "desc $DB_NAME.poller_cluster;" >/dev/null 2>&1; do
sleep 1
counter=$((counter + 1))
if [ ${counter} -gt ${DB_TIMEOUT} ]; then
echo >&2 "ERROR: Table $DB_NAME.poller_cluster does not exist on $DB_HOST"
exit 1
fi
done
# Node ID
if [ ! -f "/data/.env" ]; then
echo >&2 "ERROR: /data/.env file does not exist. Please run the main container first"
exit 1
fi
cat "/data/.env" >>"${LIBRENMS_PATH}/.env"
if [ -n "$DISPATCHER_NODE_ID" ]; then
echo "NODE_ID: $DISPATCHER_NODE_ID"
sed -i "s|^NODE_ID=.*|NODE_ID=$DISPATCHER_NODE_ID|g" "${LIBRENMS_PATH}/.env"
fi
# Redis
if [ -z "$REDIS_HOST" ] && [ -z "$REDIS_SENTINEL" ]; then
echo >&2 "ERROR: REDIS_HOST or REDIS_SENTINEL must be defined"
exit 1
elif [ -n "$REDIS_SENTINEL" ]; then
echo "Setting Redis Sentinel"
cat >>${LIBRENMS_PATH}/.env <<EOL
REDIS_SENTINEL=${REDIS_SENTINEL}
REDIS_SENTINEL_SERVICE=${REDIS_SENTINEL_SERVICE}
REDIS_SCHEME=${REDIS_SCHEME}
REDIS_PORT=${REDIS_PORT}
REDIS_PASSWORD=${REDIS_PASSWORD}
REDIS_DB=${REDIS_DB}
EOL
elif [ -n "$REDIS_HOST" ]; then
echo "Setting Redis"
cat >>${LIBRENMS_PATH}/.env <<EOL
REDIS_HOST=${REDIS_HOST}
REDIS_SCHEME=${REDIS_SCHEME}
REDIS_PORT=${REDIS_PORT}
REDIS_PASSWORD=${REDIS_PASSWORD}
REDIS_DB=${REDIS_DB}
EOL
fi
# Create service
mkdir -p /etc/services.d/dispatcher
cat >/etc/services.d/dispatcher/run <<EOL
#!/usr/bin/execlineb -P
with-contenv
s6-setuidgid ${PUID}:${PGID}
cd /opt/librenms
./librenms-service.py ${DISPATCHER_ARGS}
EOL
chmod +x /etc/services.d/dispatcher/run

View file

@ -1,27 +0,0 @@
#!/usr/bin/with-contenv sh
# shellcheck shell=sh
set -e
SIDECAR_SYSLOGNG=${SIDECAR_SYSLOGNG:-0}
# Continue only if sidecar syslogng container
if [ "$SIDECAR_SYSLOGNG" != "1" ]; then
exit 0
fi
echo ">>"
echo ">> Sidecar syslog-ng container detected"
echo ">>"
mkdir -p /data/syslog-ng /run/syslog-ng
chown librenms:librenms /data/syslog-ng
chown -R librenms:librenms /run/syslog-ng
# Create service
mkdir -p /etc/services.d/syslogng
cat >/etc/services.d/syslogng/run <<EOL
#!/usr/bin/execlineb -P
with-contenv
/usr/sbin/syslog-ng -F
EOL
chmod +x /etc/services.d/syslogng/run

View file

@ -1,47 +0,0 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
set -e
CRONTAB_PATH="/var/spool/cron/crontabs"
LIBRENMS_WEATHERMAP=${LIBRENMS_WEATHERMAP:-false}
LIBRENMS_WEATHERMAP_SCHEDULE=${LIBRENMS_WEATHERMAP_SCHEDULE:-*/5 * * * *}
LIBRENMS_DAILY_SCHEDULE="15 0 * * *"
SIDECAR_DISPATCHER=${SIDECAR_DISPATCHER:-0}
SIDECAR_SYSLOGNG=${SIDECAR_SYSLOGNG:-0}
SIDECAR_SNMPTRAPD=${SIDECAR_SNMPTRAPD:-0}
if [ "$SIDECAR_DISPATCHER" = "1" ] || [ "$SIDECAR_SYSLOGNG" = "1" ] || [ "$SIDECAR_SNMPTRAPD" = "1" ]; then
exit 0
fi
# Init
rm -rf ${CRONTAB_PATH}
mkdir -m 0644 -p ${CRONTAB_PATH}
touch ${CRONTAB_PATH}/librenms
# Cron
echo "Creating LibreNMS daily.sh cron task with the following period fields: $LIBRENMS_DAILY_SCHEDULE"
echo "${LIBRENMS_DAILY_SCHEDULE} cd /opt/librenms/ && bash daily.sh" >>${CRONTAB_PATH}/librenms
if [ "$LIBRENMS_WEATHERMAP" = "true" ] && [ -n "$LIBRENMS_WEATHERMAP_SCHEDULE" ]; then
echo "Creating LibreNMS Weathermap cron task with the following period fields: $LIBRENMS_WEATHERMAP_SCHEDULE"
echo "${LIBRENMS_WEATHERMAP_SCHEDULE} php -f /opt/librenms/html/plugins/Weathermap/map-poller.php" >>${CRONTAB_PATH}/librenms
fi
echo "Creating LibreNMS cron artisan schedule:run"
echo "* * * * * php /opt/librenms/artisan schedule:run --no-ansi --no-interaction > /dev/null 2>&1" >>${CRONTAB_PATH}/librenms
# Fix perms
echo "Fixing crontabs permissions..."
chmod -R 0644 ${CRONTAB_PATH}
# Create service
mkdir -p /etc/services.d/cron
cat >/etc/services.d/cron/run <<EOL
#!/usr/bin/execlineb -P
with-contenv
exec busybox crond -f -L /dev/stdout
EOL
chmod +x /etc/services.d/cron/run

View file

@ -1,47 +0,0 @@
#!/usr/bin/with-contenv sh
# shellcheck shell=sh
set -e
SIDECAR_SNMPTRAPD=${SIDECAR_SNMPTRAPD:-0}
LIBRENMS_SNMP_COMMUNITY=${LIBRENMS_SNMP_COMMUNITY:-librenmsdocker}
SNMP_PROCESSING_TYPE=${SNMP_PROCESSING_TYPE:-log,execute,net}
SNMP_USER=${SNMP_USER:-librenms_user}
SNMP_AUTH=${SNMP_AUTH:-auth_pass}
SNMP_PRIV=${SNMP_PRIV:-priv_pass}
SNMP_AUTH_PROTO=${SNMP_AUTH_PROTO:-SHA}
SNMP_PRIV_PROTO=${SNMP_PRIV_PROTO:-AES}
SNMP_SECURITY_LEVEL=${SNMP_SECURITY_LEVEL:-priv}
SNMP_ENGINEID=${SNMP_ENGINEID:-1234567890}
SNMP_DISABLE_AUTHORIZATION=${SNMP_DISABLE_AUTHORIZATION:-yes}
# Continue only if sidecar snmptrapd container
if [ "$SIDECAR_SNMPTRAPD" != "1" ]; then
exit 0
fi
echo ">>"
echo ">> Sidecar snmptrapd container detected"
echo ">>"
mkdir -p /run/snmptrapd
chown -R librenms:librenms /run/snmptrapd
sed -ie "s/@LIBRENMS_SNMP_COMMUNITY@/${LIBRENMS_SNMP_COMMUNITY}/" /etc/snmp/snmptrapd.conf
sed -ie "s/@SNMP_PROCESSING_TYPE@/${SNMP_PROCESSING_TYPE}/" /etc/snmp/snmptrapd.conf
sed -ie "s/@SNMP_USER@/${SNMP_USER}/" /etc/snmp/snmptrapd.conf
sed -ie "s/@SNMP_AUTH@/${SNMP_AUTH}/" /etc/snmp/snmptrapd.conf
sed -ie "s/@SNMP_PRIV@/${SNMP_PRIV}/" /etc/snmp/snmptrapd.conf
sed -ie "s/@SNMP_AUTH_PROTO@/${SNMP_AUTH_PROTO}/" /etc/snmp/snmptrapd.conf
sed -ie "s/@SNMP_PRIV_PROTO@/${SNMP_PRIV_PROTO}/" /etc/snmp/snmptrapd.conf
sed -ie "s/@SNMP_SECURITY_LEVEL@/${SNMP_SECURITY_LEVEL}/" /etc/snmp/snmptrapd.conf
sed -ie "s/@SNMP_ENGINEID@/${SNMP_ENGINEID}/" /etc/snmp/snmptrapd.conf
sed -ie "s/@SNMP_DISABLE_AUTHORIZATION@/${SNMP_DISABLE_AUTHORIZATION}/" /etc/snmp/snmptrapd.conf
# Create service
mkdir -p /etc/services.d/snmptrapd
cat >/etc/services.d/snmptrapd/run <<EOL
#!/usr/bin/execlineb -P
with-contenv
/usr/sbin/snmptrapd -f -m ALL -M /opt/librenms/mibs:/opt/librenms/mibs/cisco:${SNMP_EXTRA_MIB_DIRS} udp:162 tcp:162
EOL
chmod +x /etc/services.d/snmptrapd/run

View file

@ -1,2 +0,0 @@
[client]
skip-ssl = true

View file

@ -1,5 +0,0 @@
disableAuthorization @SNMP_DISABLE_AUTHORIZATION@
createUser -e 0x@SNMP_ENGINEID@ @SNMP_USER@ @SNMP_AUTH_PROTO@ @SNMP_AUTH@ @SNMP_PRIV_PROTO@ @SNMP_PRIV@
authUser @SNMP_PROCESSING_TYPE@ @SNMP_USER@ @SNMP_SECURITY_LEVEL@
authCommunity @SNMP_PROCESSING_TYPE@ @LIBRENMS_SNMP_COMMUNITY@
traphandle default /opt/librenms/snmptrap.php

View file

@ -1,23 +0,0 @@
[global]
pid = /var/run/php-fpm/php-fpm.pid
daemonize = no
error_log = /proc/self/fd/2
[www]
listen = /var/run/php-fpm/php-fpm.sock
access.log = /dev/null
pm = dynamic
pm.max_children = @FPM_PM_MAX_CHILDREN@
pm.start_servers = @FPM_PM_START_SERVERS@
pm.min_spare_servers = @FPM_PM_MIN_SPARE_SERVERS@
pm.max_spare_servers = @FPM_PM_MAX_SPARE_SERVERS@
request_terminate_timeout = 0
clear_env = @CLEAR_ENV@
php_admin_value[post_max_size] = @UPLOAD_MAX_SIZE@
php_admin_value[upload_max_filesize] = @UPLOAD_MAX_SIZE@
php_admin_value[max_execution_time] = 10800
php_admin_value[max_input_time] = 3600
php_admin_value[expose_php] = Off
php_admin_value[memory_limit] = @MEMORY_LIMIT@

View file

@ -1,7 +0,0 @@
#!/usr/bin/env sh
if [ "$(id -u -n)" = "librenms" -a "$(id -g -n)" = "librenms" ]; then
php -f /opt/librenms/lnms "$@"
else
yasu librenms:librenms php -f /opt/librenms/lnms "$@"
fi

View file

@ -1,4 +0,0 @@
#!/usr/bin/env sh
cd /opt/librenms || exit 1
yasu librenms:librenms php artisan "$@"

View file

@ -1,7 +0,0 @@
TZ=Europe/Paris
PUID=1000
PGID=1000
MYSQL_DATABASE=librenms
MYSQL_USER=librenms
MYSQL_PASSWORD=asupersecretpassword

View file

@ -1,154 +0,0 @@
name: librenms
services:
db:
image: mariadb:10
container_name: librenms_db
command:
- "mysqld"
- "--innodb-file-per-table=1"
- "--lower-case-table-names=0"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
volumes:
- "librenms-db:/var/lib/mysql"
environment:
- "TZ=${TZ}"
- "MARIADB_RANDOM_ROOT_PASSWORD=yes"
- "MYSQL_DATABASE=${MYSQL_DATABASE}"
- "MYSQL_USER=${MYSQL_USER}"
- "MYSQL_PASSWORD=${MYSQL_PASSWORD}"
restart: always
redis:
image: redis:7.2-alpine
container_name: librenms_redis
environment:
- "TZ=${TZ}"
restart: always
librenms:
image: ${LIBRENMS_IMAGE:-librenms/librenms:latest}
container_name: ${LIBRENMS_CONTAINER:-librenms}
hostname: librenms
cap_add:
- NET_ADMIN
- NET_RAW
ports:
- target: 8000
published: 8000
protocol: tcp
depends_on:
- db
- redis
volumes:
- "librenms-data:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
restart: always
dispatcher:
image: ${LIBRENMS_IMAGE:-librenms/librenms:latest}
container_name: librenms_dispatcher
hostname: librenms-dispatcher
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
volumes:
- "librenms-data:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "DISPATCHER_NODE_ID=dispatcher1"
- "SIDECAR_DISPATCHER=1"
restart: always
syslogng:
image: ${LIBRENMS_IMAGE:-librenms/librenms:latest}
container_name: librenms_syslogng
hostname: librenms-syslogng
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
ports:
- target: 514
published: 514
protocol: tcp
- target: 514
published: 514
protocol: udp
volumes:
- "librenms-data:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SYSLOGNG=1"
restart: always
snmptrapd:
image: ${LIBRENMS_IMAGE:-librenms/librenms:latest}
container_name: librenms_snmptrapd
hostname: librenms-snmptrapd
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
ports:
- target: 162
published: 162
protocol: tcp
- target: 162
published: 162
protocol: udp
volumes:
- "librenms-data:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SNMPTRAPD=1"
restart: always
volumes:
librenms-db:
librenms-data:

View file

@ -1,16 +0,0 @@
MEMORY_LIMIT=256M
MAX_INPUT_VARS=1000
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=remote_addr
CACHE_DRIVER=redis
SESSION_DRIVER=redis
REDIS_HOST=redis
LIBRENMS_SNMP_COMMUNITY=librenmsdocker
LIBRENMS_WEATHERMAP=false
LIBRENMS_WEATHERMAP_SCHEDULE=*/5 * * * *