From 97099891e1923e679e58da09c53bd7268f70fc76 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 1 Jun 2020 10:11:21 +0200 Subject: [PATCH] LibreNMS 1.64 Python 2 removed (librenms/librenms#11531) --- CHANGELOG.md | 5 +++ Dockerfile | 56 +++++++++++--------------- README.md | 2 +- doc/notes/validate.md | 11 +++-- rootfs/etc/cont-init.d/02-fix-perms.sh | 1 + 5 files changed, 36 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ff3352..f3511a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.64-RC1 (2020/06/01) + +* LibreNMS 1.64 +* Python 2 removed (librenms/librenms#11531) + ## 1.63-RC7 (2020/05/28) * Use recommended `lnms` command diff --git a/Dockerfile b/Dockerfile index b207eaf..89fdb68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,6 @@ LABEL maintainer="CrazyMax" \ org.opencontainers.image.description="LibreNMS" \ org.opencontainers.image.licenses="MIT" -ENV SYSLOGNG_VERSION="3.22.1-r2" - RUN apk --update --no-cache add \ busybox-extras \ acl \ @@ -68,14 +66,12 @@ RUN apk --update --no-cache add \ php7-tokenizer \ php7-xml \ php7-zip \ - python \ - py2-pip \ python3 \ rrdtool \ runit \ shadow \ su-exec \ - syslog-ng=${SYSLOGNG_VERSION} \ + syslog-ng=3.22.1-r2 \ ttf-dejavu \ tzdata \ util-linux \ @@ -85,56 +81,52 @@ RUN apk --update --no-cache add \ make \ mariadb-dev \ musl-dev \ - python-dev \ python3-dev \ - && pip2 install --upgrade pip \ - && pip2 install python-memcached mysqlclient \ && pip3 install --upgrade pip \ - && pip3 install python-memcached mysqlclient \ + && pip3 install python-memcached mysqlclient --upgrade \ && wget -q "https://github.com/just-containers/s6-overlay/releases/latest/download/s6-overlay-amd64.tar.gz" -qO "/tmp/s6-overlay-amd64.tar.gz" \ && tar xzf /tmp/s6-overlay-amd64.tar.gz -C / \ + && curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \ && apk del build-dependencies \ && rm -rf /var/cache/apk/* /var/www/* /tmp/* \ && setcap cap_net_raw+ep /usr/bin/nmap \ && setcap cap_net_raw+ep /usr/sbin/fping ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2" \ - LIBRENMS_VERSION="1.63" \ + LIBRENMS_VERSION="1.64" \ LIBRENMS_PATH="/opt/librenms" \ LIBRENMS_DOCKER="1" \ TZ="UTC" \ PUID="1000" \ PGID="1000" -RUN mkdir -p /opt \ - && curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \ - && git clone --branch ${LIBRENMS_VERSION} https://github.com/librenms/librenms.git ${LIBRENMS_PATH} \ - && COMPOSER_CACHE_DIR="/tmp" composer install --no-dev --no-interaction --no-ansi --working-dir=${LIBRENMS_PATH} \ +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 \ - && mkdir -p ${LIBRENMS_PATH}/config.d \ - && cp ${LIBRENMS_PATH}/config.php.default ${LIBRENMS_PATH}/config.php \ - && cp ${LIBRENMS_PATH}/snmpd.conf.example /etc/snmp/snmpd.conf \ - && sed -i "1s|.*|#!/usr/bin/env python3|" ${LIBRENMS_PATH}/snmp-scan.py \ - && echo "foreach (glob(\"/data/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 \ - && pip3 install -r ${LIBRENMS_PATH}/requirements.txt \ - && git clone https://github.com/librenms-plugins/Weathermap.git ${LIBRENMS_PATH}/html/plugins/Weathermap \ + && chmod +x /usr/bin/distro + +WORKDIR ${LIBRENMS_PATH} +RUN git clone --branch ${LIBRENMS_VERSION} https://github.com/librenms/librenms.git . \ + && pip3 install -r requirements.txt --upgrade \ + && COMPOSER_CACHE_DIR="/tmp" composer install --no-dev --no-interaction --no-ansi \ + && 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 \ + && git clone https://github.com/librenms-plugins/Weathermap.git ./html/plugins/Weathermap \ && chown -R nobody.nogroup ${LIBRENMS_PATH} \ - && rm -rf ${LIBRENMS_PATH}/.git \ - ${LIBRENMS_PATH}/html/plugins/Test \ - ${LIBRENMS_PATH}/html/plugins/Weathermap/.git \ - ${LIBRENMS_PATH}/html/plugins/Weathermap/configs \ + && rm -rf .git \ + html/plugins/Test \ + html/plugins/Weathermap/.git \ + html/plugins/Weathermap/configs \ /tmp/* COPY rootfs / - -RUN addgroup -g ${PGID} librenms \ - && adduser -D -h ${LIBRENMS_PATH} -u ${PUID} -G librenms -s /bin/sh -D librenms \ - && chmod a+x /usr/local/bin/* +RUN chmod a+x /usr/local/bin/* EXPOSE 8000 514 514/udp -WORKDIR ${LIBRENMS_PATH} VOLUME [ "/data" ] ENTRYPOINT [ "/init" ] diff --git a/README.md b/README.md index ee2fcf7..dee1dc5 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ## About 🐳 [LibreNMS](https://www.librenms.org/) Docker image based on Alpine Linux and Nginx.
-It's a fork of [CrazyMax's LibreNMS Docker image repository](https://github.com/crazy-max/docker-librenms). If you are interested, [check out](https://hub.docker.com/r/crazymax/) his other 🐳 Docker images! +If you are interested, [check out](https://hub.docker.com/r/crazymax/) my other Docker images! 💡 Want to be notified of new releases? Check out 🔔 [Diun (Docker Image Update Notifier)](https://github.com/crazy-max/diun) project! diff --git a/doc/notes/validate.md b/doc/notes/validate.md index 1a0c97e..38d85b5 100644 --- a/doc/notes/validate.md +++ b/doc/notes/validate.md @@ -7,10 +7,11 @@ $ docker-compose exec --user librenms librenms php validate.php ==================================== Component | Version --------- | ------- -LibreNMS | 1.58 -DB Schema | 2019_10_03_211702_serialize_config (147) -PHP | 7.3.11 -MySQL | 10.4.8-MariaDB-1:10.4.8+maria~bionic +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 ==================================== @@ -18,8 +19,6 @@ SNMP | NET-SNMP 5.8 [OK] Installed from the official Docker image; no Composer required [OK] Database connection successful [OK] Database schema correct -[WARN] You have not added any devices yet. - [FIX] You can add a device in the webui or with ./addhost.php [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 ``` diff --git a/rootfs/etc/cont-init.d/02-fix-perms.sh b/rootfs/etc/cont-init.d/02-fix-perms.sh index 485c1de..f1eefda 100644 --- a/rootfs/etc/cont-init.d/02-fix-perms.sh +++ b/rootfs/etc/cont-init.d/02-fix-perms.sh @@ -9,6 +9,7 @@ chown librenms. \ "${LIBRENMS_PATH}" \ "${LIBRENMS_PATH}/html/plugins/Weathermap/output" chown -R librenms. \ + /home/librenms \ /tpls \ /var/lib/nginx \ /var/log/nginx \