update to LibreNMS 1.40 - note the new addition to the pkg-readme,

repeated below.

(upstream's normal setup these days is to provide only their own code
and rely on composer to fetch the dependencies. this isn't suitable for
OS packaging so I'm pregenerating a separate distfile with dependencies
instead. unfortunately the hook to copy across existing config to the
.env file is done from composer, so that doesn't work for us, so you
have to copy it yourself.)

Updating from 1.39 or earlier
=============================
As of 1.40, LibreNMS now uses the Laravel framework which requires some
additional setup. Upstream has code to copy this across from an existing
configuration initially, but it's not functional in this packaged
environment.

Generate an APP_KEY:

# cd /var/www/librenms
# doas -u _librenms /usr/local/bin/php-7.0 artisan key:generate

Copy this to the clipboard, then edit /var/www/librenms/.env and fill in the
relevant details.

It may also be necessary to raise max_connections in /etc/my.cnf;
https://community.librenms.org/t/new-requirements-for-1-40/4057
suggests doubling this value.
This commit is contained in:
sthen 2018-05-31 20:40:41 +00:00
parent 4248be7cc5
commit 27607e4bbe
8 changed files with 5258 additions and 200 deletions

View File

@ -1,13 +1,12 @@
# $OpenBSD: Makefile,v 1.65 2018/05/22 08:19:06 sthen Exp $
# $OpenBSD: Makefile,v 1.66 2018/05/31 20:40:41 sthen Exp $
COMMENT = auto-discovering network management/monitoring system
GH_ACCOUNT = librenms
GH_PROJECT = librenms
GH_TAGNAME = 1.39
GH_TAGNAME = 1.40
DISTFILES = librenms-${GH_TAGNAME}.tar.gz librenms-vendor-${GH_TAGNAME}.tar.xz:0
EPOCH = 0
REVISION = 0
CATEGORIES = net www
@ -65,10 +64,13 @@ post-extract:
find ${WRKSRC} -type f -print0 | xargs -r0 perl -pi -e '$R'
sed -i 's, librenms , _librenms ,' ${WRKSRC}/librenms.nonroot.cron
do-configure:
${SUBST_CMD} ${WRKSRC}/.env.example
do-install:
${INSTALL_DATA_DIR} ${INSTDIR}
cd ${WRKSRC}; pax -rw . ${INSTDIR}
find ${INSTDIR} -name '*.orig' -print0 | xargs -r0 rm
find ${INSTDIR} -name '*.orig' -delete
mkdir -p ${INSTDIR}/{rrd,logs}
cd ${INSTDIR}; \
sed -i 's,%PHP%,${MODPHP_BIN},' daily.sh *-wrapper.py *-service.py validate.php LibreNMS/Validations/Php.php html/includes/output/capture.inc.php scripts/composer_wrapper.php; \
@ -83,6 +85,7 @@ dist: /usr/ports/distfiles/librenms-${GH_TAGNAME}.tar.gz
cd $$t; \
tar xzf ${FULLDISTDIR}/${DISTNAME}.tar.gz; \
cd librenms-${GH_TAGNAME}; \
[ -r .env ] || cp .env.example .env; \
composer install --no-dev; \
tar cf - vendor | xz -T 0 > $$f; \
scp $$f naiad:mirrors/; \

View File

@ -1,4 +1,4 @@
SHA256 (librenms-1.39.tar.gz) = Ibfb5VYfzOwhlpTLY21bP0xNlbdJtP+iJRDIg0U2BsU=
SHA256 (librenms-vendor-1.39.tar.xz) = zcoa1RAedbj2sOWwMSee3TyMHEq67IGbrP6Kms5hTRs=
SIZE (librenms-1.39.tar.gz) = 30271545
SIZE (librenms-vendor-1.39.tar.xz) = 24586424
SHA256 (librenms-1.40.tar.gz) = MNetdow9orLSSwg91Z1A8tXzOMDKK5OgGF1sbIWcAIE=
SHA256 (librenms-vendor-1.40.tar.xz) = xfjEPhvgojLGbv3dt7U9mtNYAzXazK4RdI8AB9zhOA0=
SIZE (librenms-1.40.tar.gz) = 31138309
SIZE (librenms-vendor-1.40.tar.xz) = 26578160

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-LibreNMS_Config_php,v 1.1 2018/05/31 20:40:41 sthen Exp $
Index: LibreNMS/Config.php
--- LibreNMS/Config.php.orig
+++ LibreNMS/Config.php
@@ -532,7 +532,7 @@ class Config
public static function locateBinary($binary)
{
if (!str_contains($binary, '/')) {
- $output = `whereis -b $binary`;
+ $output = `whereis $binary`;
$list = trim(substr($output, strpos($output, ':') + 1));
$targets = explode(' ', $list);
foreach ($targets as $target) {

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-_env_example,v 1.1 2018/05/31 20:40:41 sthen Exp $
Index: .env.example
--- .env.example.orig
+++ .env.example
@@ -1,8 +1,14 @@
-APP_KEY=
+#APP_KEY=<< insert from "${MODPHP_BIN} artisan key:generate" >>
+#APP_URL=https://librenms.example.com
-#DB_HOST=
-#DB_DATABASE=
-#DB_USERNAME=
-#DB_PASSWORD=
+#NODE_ID=hostname.example.com
-#APP_URL=
+#DB_HOST=localhost
+#DB_DATABASE=librenms
+#DB_USERNAME=librenms
+#DB_PASSWORD=password
+#DB_PORT=<< optional >>
+#DB_SOCKET=<< optional >>
+
+LIBRENMS_USER=_librenms
+LIBRENMS_GROUP=_librenms

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-includes_defaults_inc_php,v 1.33 2018/04/23 11:00:08 sthen Exp $
$OpenBSD: patch-includes_defaults_inc_php,v 1.34 2018/05/31 20:40:41 sthen Exp $
Some substitutions are done in the ports Makefile to reduce patch conflicts
during updates.
@ -48,12 +48,3 @@ Index: includes/defaults.inc.php
// $config['nfsen_suffix'] = "_yourdomain_com";
// Location Mapping
// Use this feature to map ugly locations to pretty locations
@@ -858,7 +859,7 @@ $config['api_demo'] = 0;
// Set this to 1 if you want to disable some untrusting features for the API
// Distributed Poller-Settings
$config['distributed_poller'] = false;
-$config['distributed_poller_name'] = trim(file_get_contents('/proc/sys/kernel/hostname'));
+$config['distributed_poller_name'] = trim(file_get_contents('/etc/myname'));
$config['distributed_poller_group'] = 0;
$config['distributed_poller_memcached_host'] = 'example.net';
$config['distributed_poller_memcached_port'] = '11211';

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-includes_functions_php,v 1.19 2018/05/09 20:24:21 sthen Exp $
$OpenBSD: patch-includes_functions_php,v 1.20 2018/05/31 20:40:41 sthen Exp $
Index: includes/functions.php
--- includes/functions.php.orig
@ -12,12 +12,3 @@ Index: includes/functions.php
$tmp = explode("\n", $ex);
if ($tmp[sizeof($tmp)-1] != "OK") {
$ret .= "Could not remove files:\n$ex\n";
@@ -2426,7 +2426,7 @@ function return_num($entry)
function locate_binary($binary)
{
if (!str_contains($binary, '/')) {
- $output = `whereis -b $binary`;
+ $output = `whereis $binary`;
$list = trim(substr($output, strpos($output, ':') + 1));
$targets = explode(' ', $list);

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
$OpenBSD: README,v 1.8 2018/01/05 14:51:42 sthen Exp $
$OpenBSD: README,v 1.9 2018/05/31 20:40:41 sthen Exp $
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
@ -8,10 +8,11 @@ LibreNMS is primarily PHP-based, however it relies on running a number of
other programs during normal operation. As such it is not suitable for
running in the typical chroot jail used by default on OpenBSD (a chrooted
web server process is OK, provided that PHP is run separately, e.g. via
FastCGI, and PHP itself is not chrooted).
FastCGI, and PHP itself is not chrooted).
System loads during SNMP polling can be heavy; beyond initial testing and
evaluation, it is probably happier run on a dedicated system.
System loads during SNMP polling and graph generation can be heavy;
if monitoring more than a handful of systems beyond initial testing and
evaluation it is probably best to run on a dedicated system.
Database configuration
======================
@ -30,7 +31,7 @@ exit
Webserver configuration
=======================
LibreNMS should be run on a dedicated vhost. Sample configuration sections
Run LibreNMS on a dedicated virtual host. Sample configuration sections
for NGINX and Apache httpd 2.x are shown below.
If using php-fpm, disable any "chroot" line from ${SYSCONFDIR}/php-fpm.conf,
@ -160,3 +161,22 @@ Rotate LibreNMS' logs in newsyslog.conf, e.g.:
Upstream documentation is present in ${INSTDIR}/doc and also online at
http://docs.librenms.org/.
Updating from 1.39 or earlier
=============================
As of 1.40, LibreNMS now uses the Laravel framework which requires some
additional setup. Upstream has code to copy this across from an existing
configuration initially, but it's not functional in this packaged
environment.
Generate an APP_KEY:
# cd /var/www/librenms
# doas -u _librenms ${MODPHP_BIN} artisan key:generate
Copy this to the clipboard, then edit ${INSTDIR}/.env and fill in the
relevant details.
It may also be necessary to raise max_connections in ${SYSCONFDIR}/my.cnf;
https://community.librenms.org/t/new-requirements-for-1-40/4057
recommends doubling this value.