Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Feb 2023 18:30:33 GMT
From:      Jochen Neumeister <joneum@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 446cd084d5ff - main - net-mgmt/icingaweb2-module-director: Enable Icinga Director Background Daemon
Message-ID:  <202302061830.316IUXB4028085@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by joneum:

URL: https://cgit.FreeBSD.org/ports/commit/?id=446cd084d5ffbc2c421f5d1875a82c66544ac58d

commit 446cd084d5ffbc2c421f5d1875a82c66544ac58d
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2023-02-06 18:22:03 +0000
Commit:     Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2023-02-06 18:30:27 +0000

    net-mgmt/icingaweb2-module-director: Enable Icinga Director Background Daemon
    
    Deploys in the director don't work/finish since the last update. The
    reason is, that the update didn't enable the Icinga Director Background
    Daemon, that has been mandatory since 1.7.0, see
    https://github.com/Icinga/icingaweb2-module-director/blob/master/doc/75-Background-Daemon.md
    
    PR: 269227
    Reported by: flo
    Sponsored by: Netzkommune GmbH
---
 GIDs                                               |  2 +-
 UIDs                                               |  2 +-
 net-mgmt/icingaweb2-module-director/Makefile       | 18 ++++++++++++--
 .../files/icinga-director.in                       | 29 ++++++++++++++++++++++
 net-mgmt/icingaweb2-module-director/pkg-plist      |  1 +
 5 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/GIDs b/GIDs
index 23d9c2564c1b..4b5cb168fbc5 100644
--- a/GIDs
+++ b/GIDs
@@ -258,7 +258,7 @@ promscale:*:314:
 lavinmq:*:315:
 nut:*:316:
 hedgedoc:*:317:
-# free: 318
+# free: 318, UID used by icingadirector
 # free: 319
 # free: 320
 # free: 321
diff --git a/UIDs b/UIDs
index b41b0f6ccb9c..c2ecbb8c766b 100644
--- a/UIDs
+++ b/UIDs
@@ -263,7 +263,7 @@ promscale:*:314:314::0:0:Promscale:/nonexistent:/usr/sbin/nologin
 lavinmq:*:315:315::0:0:LavinMQ user:/nonexistent:/usr/sbin/nologin
 nut:*:316:316::0:0:Network UPS Tools user:/nonexistent:/usr/sbin/nologin
 hedgedoc:*:317:317::0:0:HedgeDoc user:/nonexistent:/usr/sbin/nologin
-# free: 318
+icingadirector:*:318:183::0:0:icingadirector user:/nonexistent:/usr/sbin/nologin
 # free: 319
 # free: 320
 # free: 321
diff --git a/net-mgmt/icingaweb2-module-director/Makefile b/net-mgmt/icingaweb2-module-director/Makefile
index 7ad9e7cf7cd1..db0d3a986dbd 100644
--- a/net-mgmt/icingaweb2-module-director/Makefile
+++ b/net-mgmt/icingaweb2-module-director/Makefile
@@ -15,6 +15,19 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 RUN_DEPENDS=	icingaweb2${PHP_PKGNAMESUFFIX}>=2.11.4:net-mgmt/icingaweb2@${PHP_FLAVOR}
 
 USES=		php:web,flavors
+USE_PHP=	pcntl
+USE_RC_SUBR=	icinga-director
+
+DIRECTOR_USER?=		icingadirector
+DIRECTOR_GROUP?=	icinga
+
+USERS=		${DIRECTOR_USER}
+GROUPS=		${DIRECTOR_GROUP}
+
+SUB_LIST+=	DIRECTOR_GROUP=${DIRECTOR_GROUP} \
+		DIRECTOR_USER=${DIRECTOR_USER}
+PLIST_SUB+=	DIRECTOR_GROUP=${DIRECTOR_GROUP} \
+		DIRECTOR_USER=${DIRECTOR_USER}
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	icinga
@@ -22,14 +35,15 @@ GH_ACCOUNT=	icinga
 NO_BUILD=	yes
 NO_ARCH=	yes
 
-OPTIONS_DEFINE=		NLS
+OPTIONS_DEFINE=	NLS
 
 NLS_USES=	gettext
-NLS_USE=	php=intl
+NLS_USE=	PHP=intl
 
 WWWDIR?=	${PREFIX}/www/icingaweb2/modules/${PORTNAME:C/^.*-//}
 
 do-install:
+	@${MKDIR} ${STAGEDIR}/var/run/icinga-director
 	@${MKDIR} ${STAGEDIR}${WWWDIR}
 	(cd ${WRKSRC} && \
 		${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR})
diff --git a/net-mgmt/icingaweb2-module-director/files/icinga-director.in b/net-mgmt/icingaweb2-module-director/files/icinga-director.in
new file mode 100644
index 000000000000..2f29fe26506e
--- /dev/null
+++ b/net-mgmt/icingaweb2-module-director/files/icinga-director.in
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# PROVIDE: icinga_director
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add these lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# icinga_director_enable (bool):	Set to NO by default.
+#					Set it to YES to enable icinga_director.
+# icinga_director_user:        		The user account used to run the daemon.
+#					Default: %%DIRECTOR_USER%%
+
+. /etc/rc.subr
+
+name=icinga_director
+rcvar=icinga_director_enable
+
+load_rc_config $name
+
+: ${icinga_director_enable:="NO"}
+: ${icinga_director_user:="%%DIRECTOR_USER%%"}
+
+pidfile=/var/run/icinga-director/${name}.pid
+command=/usr/sbin/daemon
+command_args="-c -f -P $pidfile %%PREFIX%%/bin/icingacli director daemon run"
+
+run_rc_command "$1"
diff --git a/net-mgmt/icingaweb2-module-director/pkg-plist b/net-mgmt/icingaweb2-module-director/pkg-plist
index 0a5c0a5869d9..f94b39325970 100644
--- a/net-mgmt/icingaweb2-module-director/pkg-plist
+++ b/net-mgmt/icingaweb2-module-director/pkg-plist
@@ -1129,3 +1129,4 @@
 %%WWWDIR%%/test/phpunit-compat.php
 %%WWWDIR%%/test/setup_vendor.sh
 %%WWWDIR%%/test/travis-prepare.sh
+@dir(%%DIRECTOR_USER%%,DIRECTOR_GROUP%%,0775) /var/run/icinga-director



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302061830.316IUXB4028085>