git: 395d57a73b08 - main - net-im/jitsi-videobridge: update to 2.1-681

From: Jose Alonso Cardenas Marquez <acm_at_FreeBSD.org>
Date: Tue, 24 May 2022 03:03:13 UTC
The branch main has been updated by acm:

URL: https://cgit.FreeBSD.org/ports/commit/?id=395d57a73b08f1986309bd299575d64126062c79

commit 395d57a73b08f1986309bd299575d64126062c79
Author:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
AuthorDate: 2022-05-24 02:56:52 +0000
Commit:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
CommitDate: 2022-05-24 02:56:52 +0000

    net-im/jitsi-videobridge: update to 2.1-681
    
    - Add config samples
    - Now jitsi-videobridge is init using jvb user
    - Modify pkg-message file
    PR:             257232
    Reported by:    grembo
---
 net-im/jitsi-videobridge/Makefile                  | 39 ++++++-------
 net-im/jitsi-videobridge/distinfo                  | 10 ++--
 .../files/jitsi-videobridge.conf.sample            | 51 +++++++++++++++++
 .../jitsi-videobridge/files/jitsi-videobridge.in   | 66 +++++++++++-----------
 net-im/jitsi-videobridge/files/pkg-message.in      | 12 ++--
 .../files/sip-communicator.properties.sample       |  5 ++
 net-im/jitsi-videobridge/pkg-plist                 |  6 ++
 7 files changed, 125 insertions(+), 64 deletions(-)

diff --git a/net-im/jitsi-videobridge/Makefile b/net-im/jitsi-videobridge/Makefile
index 8d97edc96357..2626818d1908 100644
--- a/net-im/jitsi-videobridge/Makefile
+++ b/net-im/jitsi-videobridge/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	jitsi
-DISTVERSION=	2.1-183
-PORTREVISION=	3
+DISTVERSION=	2.1-681
 CATEGORIES=	net-im java
 PKGNAMESUFFIX=	-videobridge
 
@@ -9,15 +8,17 @@ COMMENT=	WebRTC compatible video router or SFU
 
 LICENSE=	APACHE20
 
+ONLY_FOR_ARCHS=	i386 amd64 powerpc64 powerpc64le
+
 BUILD_DEPENDS=	${LOCALBASE}/share/java/maven/bin/mvn:devel/maven
 RUN_DEPENDS=	${LOCALBASE}/bin/bash:shells/bash
 
-ONLY_FOR_ARCHS=	i386 amd64 powerpc64 powerpc64le
 
 USE_GITHUB=	yes
 GH_PROJECT=	${PORTNAME}${PKGNAMESUFFIX}
-GH_TAGNAME=	dbddd16
+GH_TAGNAME=	3544ed05
 USE_JAVA=	yes
+JAVA_VERSION=	11
 
 DATADIR=	${JAVASHAREDIR}/${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}
 USE_RC_SUBR=	${PORTNAME}${PKGNAMESUFFIX}
@@ -26,6 +27,9 @@ SUB_FILES+=	pkg-message
 SUB_LIST+=	JAVA=${JAVA}
 ETCDIR=		${PREFIX}/etc/jitsi/videobridge
 
+USERS=		jvb ${PORTNAME}
+GROUPS=		${USERS}
+
 DEV_UPDATE_MODE=	no
 
 .if (${DEV_UPDATE_MODE} == "yes")
@@ -33,7 +37,8 @@ post-build:
 	@cd ${WRKDIR} && ${TAR} czf ${DISTDIR}/${PORTNAME}${PKGNAMESUFFIX}-${DISTVERSION}-deps${EXTRACT_SUFX} m2
 	@${ECHO} "(!!!) Please upload the maven deps archive: ${DISTDIR}/${PORTNAME}${PKGNAMESUFFIX}-${DISTVERSION}-deps${EXTRACT_SUFX}"
 .else
-MASTER_SITES+=	LOCAL/acm/:maven
+MASTER_SITES+=	LOCAL/acm/:maven \
+		LOCAL/grembo/:maven
 DISTFILES+=	${PORTNAME}${PKGNAMESUFFIX}-${DISTVERSION}-deps${EXTRACT_SUFX}:maven
 MAVEN_ARGS=	--offline
 .endif
@@ -41,28 +46,20 @@ MAVEN_ARGS=	--offline
 MAVEN_ARGS+=	-PbuildFatJar -DskipTests -Dassembly.skipAssembly=false
 MAVEN_REPO=	-Dmaven.repo.local=${WRKDIR}/m2
 
-post-patch:
-	@${REINPLACE_CMD} -e 's|1.0-20190319.172750-1|1.0-0-ge979298|g' ${WRKSRC}/pom.xml
-
 do-build:
 	cd ${WRKSRC}; \
-		${SETENV} mvn ${MAVEN_REPO} ${MAVEN_ARGS} package
+		${SETENV} JAVA_VERSION=${JAVA_VERSION} mvn ${MAVEN_REPO} ${MAVEN_ARGS} package
 
 do-install:
 	@${MKDIR} ${STAGEDIR}${DATADIR}/lib
 	@${MKDIR} ${STAGEDIR}${ETCDIR}
-	cd ${WRKSRC}/lib \
+	cd ${WRKSRC}/jvb/lib \
 		&& ${FIND} . -type f -exec ${INSTALL_DATA} {} ${STAGEDIR}${DATADIR}/lib/{} \;
-
-	@(echo "JVB_XMPP_HOST=localhost"; \
-	echo "JVB_XMPP_DOMAIN=jitsi.example.com"; \
-	echo "JVB_XMPP_PORT=5347"; \
-	echo "JVB_XMPP_SECRET=YOURSECRET1"; \
-	echo ""; \
-	echo "VIDEOBRIDGE_MAX_MEMORY=3072m"; \
-	echo "# VIDEOBRIDGE_DEBUG_OPTIONS=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000\" "; \
-	) > ${STAGEDIR}${ETCDIR}/${PORTNAME}${PKGNAMESUFFIX}.conf.sample
-
-	${INSTALL_DATA} ${WRKSRC}/target/${PORTNAME}${PKGNAMESUFFIX}-2.1-SNAPSHOT-jar-with-dependencies.jar ${STAGEDIR}${JAVAJARDIR}/${PORTNAME}${PKGNAMESUFFIX}.jar
+	${INSTALL_DATA} ${FILESDIR}/${PORTNAME}${PKGNAMESUFFIX}.conf.sample \
+		${STAGEDIR}${ETCDIR}/${PORTNAME}${PKGNAMESUFFIX}.conf.sample
+	${INSTALL_DATA} ${FILESDIR}/sip-communicator.properties.sample \
+		${STAGEDIR}${ETCDIR}/sip-communicator.properties.sample
+	${INSTALL_DATA} ${WRKSRC}/jvb/target/${PORTNAME}${PKGNAMESUFFIX}-2.1-SNAPSHOT-jar-with-dependencies.jar \
+		${STAGEDIR}${JAVAJARDIR}/${PORTNAME}${PKGNAMESUFFIX}.jar
  	
 .include <bsd.port.mk>
diff --git a/net-im/jitsi-videobridge/distinfo b/net-im/jitsi-videobridge/distinfo
index 9f91808a5178..18c371425eaf 100644
--- a/net-im/jitsi-videobridge/distinfo
+++ b/net-im/jitsi-videobridge/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1587857041
-SHA256 (jitsi-videobridge-2.1-183-deps.tar.gz) = 20c2c63d4ab3936245b69a9c4400c3855945c512ab86a9bfde3365cfdba89b27
-SIZE (jitsi-videobridge-2.1-183-deps.tar.gz) = 159703250
-SHA256 (jitsi-jitsi-videobridge-2.1-183-dbddd16_GH0.tar.gz) = e8da60e17f4825f06629e66dee8b9236d641fb2b3ba22a9c7da0f12a1e189349
-SIZE (jitsi-jitsi-videobridge-2.1-183-dbddd16_GH0.tar.gz) = 277281
+TIMESTAMP = 1653273596
+SHA256 (jitsi-videobridge-2.1-681-deps.tar.gz) = 8cd50855acd89cc2bc2d324c454ddc902489389de1297a95f66a758dfd2a77e3
+SIZE (jitsi-videobridge-2.1-681-deps.tar.gz) = 243043143
+SHA256 (jitsi-jitsi-videobridge-2.1-681-3544ed05_GH0.tar.gz) = 7370050eeb89be0f677b01756c53225f896ff3fdc1f054ec85b0e24cc152627b
+SIZE (jitsi-jitsi-videobridge-2.1-681-3544ed05_GH0.tar.gz) = 379386
diff --git a/net-im/jitsi-videobridge/files/jitsi-videobridge.conf.sample b/net-im/jitsi-videobridge/files/jitsi-videobridge.conf.sample
new file mode 100644
index 000000000000..0cfcb3834dde
--- /dev/null
+++ b/net-im/jitsi-videobridge/files/jitsi-videobridge.conf.sample
@@ -0,0 +1,51 @@
+videobridge {
+  http-servers {
+      public {
+          port = 9090
+      }
+  }
+  websockets {
+      enabled = true
+      domain = "jitsi.example.com:443"
+      tls = true
+      server-id = "default-id"
+  }
+  sctp {
+       enabled = false
+  }
+
+  stats {
+    # Enable broadcasting stats/presence in a MUC
+    enabled = true
+    transports = [
+      { type = "colibri" }
+    ]
+  }
+
+  apis {
+    xmpp-client {
+      configs {
+        xmpp-server-1 {
+          hostname="localhost"
+          domain = "auth.jitsi.example.com"
+          username = "jvb"
+          password = "supersecret"
+          muc_jids = "JvbBrewery@internal.auth.jitsi.example.com"
+          muc_nickname = "unique-instance-id"
+          # disable_certificate_verification = true
+        }
+      }
+    }
+  }
+
+  ice {
+    tcp {
+      enabled = true
+      port = 4443
+    }
+
+    udp {
+      port = 10000
+    }      
+  }
+}
diff --git a/net-im/jitsi-videobridge/files/jitsi-videobridge.in b/net-im/jitsi-videobridge/files/jitsi-videobridge.in
index 324e9a61c8fb..8c2d7ce777e4 100644
--- a/net-im/jitsi-videobridge/files/jitsi-videobridge.in
+++ b/net-im/jitsi-videobridge/files/jitsi-videobridge.in
@@ -7,6 +7,7 @@
 # Configuration settings for jitsi-videobridge in /etc/rc.conf:
 #
 # jitsi_videobridge_enable:	run jitsi_videobridge server (default=NO)
+# jitsi_videobridge_maxmem:	maximum memory used (default=3072m)
 # jitsi_videobridge_flags:	additional flags for jitsi_videobridge server (default="")
 #
 
@@ -15,19 +16,21 @@
 name="jitsi_videobridge"
 rcvar=${name}_enable
 
-jitsi_videobridge_env_file="%%ETCDIR%%/jitsi-videobridge.conf"
+jitsi_videobridge_config="%%ETCDIR%%/jitsi-videobridge.conf"
 jitsi_videobridge_jar="%%JAVAJARDIR%%/jitsi-videobridge.jar"
 jitsi_videobridge_logging_config="%%DATADIR%%/lib/logging.properties"
+jitsi_videobridge_user="jvb"
 
 load_rc_config "${name}"
 
 : ${jitsi_videobridge_enable="NO"}
+: ${jitsi_videobridge_maxmem="3072m"}
 : ${jitsi_videobridge_flags=""}
 
 command="%%JAVA%%"
 
 pidfile="/var/run/jitsi-videobridge.pid"
-required_files="${jitsi_videobridge_env_file}"
+required_files="${jitsi_videobridge_config}"
 start_cmd=${name}_start
 stop_cmd=${name}_stop
 status_cmd=${name}_status
@@ -35,48 +38,47 @@ restart_cmd=${name}_restart
 
 jitsi_videobridge_start()
 {
-	daemon -p ${pidfile} -o /var/log/jitsi-videobridge.log \
-		${command} -Xmx${VIDEOBRIDGE_MAX_MEMORY} \
-                -XX:+UseConcMarkSweepGC \
-                -XX:+HeapDumpOnOutOfMemoryError \
-                -XX:HeapDumpPath=/tmp \
-                -Djava.util.logging.config.file=${jitsi_videobridge_logging_config} \
-                -Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=%%LOCALBASE%%/etc/jitsi \
-                -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=videobridge \
-                -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/ \
-                -cp ${jitsi_videobridge_jar} \
-                org.jitsi.videobridge.Main \
-                --host=${JVB_XMPP_HOST} \
-                --domain=${JVB_XMPP_DOMAIN} \
-                --port=${JVB_XMPP_PORT} \
-                --secret=${JVB_XMPP_SECRET} ${jitsi_videobridge_flags}
-                echo "Started"
+	daemon -u ${jitsi_videobridge_user} -p ${pidfile} -o /var/log/jitsi-videobridge.log \
+		${command} -Xmx${jitsi_videobridge_maxmem} \
+		-XX:+UseConcMarkSweepGC \
+		-XX:+HeapDumpOnOutOfMemoryError \
+		-XX:HeapDumpPath=/tmp \
+		-Djava.util.logging.config.file=${jitsi_videobridge_logging_config} \
+		-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=%%LOCALBASE%%/etc/jitsi \
+		-Dnet.java.sip.communicator.SC_HOME_DIR_NAME=videobridge \
+		-Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/ \
+		-Dconfig.file=${jitsi_videobridge_config} \
+		-cp ${jitsi_videobridge_jar} \
+		org.jitsi.videobridge.MainKt \
+		${jitsi_videobridge_flags}
+
+		echo "Starting ${name}"
 }
 
 jitsi_videobridge_stop()
 {
-        if [ -f ${pidfile} ]
-        then
-                kill `cat ${pidfile}`
-                rm ${pidfile}
-		echo "Stopped"
-        fi
+	if [ -f ${pidfile} ]
+	then
+		kill `cat ${pidfile}`
+		rm ${pidfile}
+		echo "Stopping ${name}"
+	fi
 }
 
 jitsi_videobridge_status()
 {
-        # If running, show pid
-        if [ -f ${pidfile} ]
-        then
-                echo "${name} is running as pid" `cat ${pidfile}`
-        else
-                echo "${name} is not running"
-        fi
+	# If running, show pid
+	if [ -f ${pidfile} ]
+	then
+		echo "${name} is running as pid" `cat ${pidfile}`
+	else
+		echo "${name} is not running"
+	fi
 }
 
 jitsi_videobridge_restart()
 {
-	echo "Performing restart"
+	echo "Performing restart ${name}"
 	jitsi_videobridge_stop
 	sleep 5
 	jitsi_videobridge_start
diff --git a/net-im/jitsi-videobridge/files/pkg-message.in b/net-im/jitsi-videobridge/files/pkg-message.in
index 90470b003ed3..816b5282b6c0 100644
--- a/net-im/jitsi-videobridge/files/pkg-message.in
+++ b/net-im/jitsi-videobridge/files/pkg-message.in
@@ -3,27 +3,27 @@
   message: <<EOM
 Jitsi Video Bridge was installed
 
-1) The configuration file is used by the startup rcfile and located at:
+1) Edit the configuration file located at:
    
    %%ETCDIR%%/jitsi-videobridge.conf
 
-2) Add jitsi_videobridge_enable="YES" to /etc/rc.conf.
+2) Enable the service:
+
+   # service jitsi-videobridge enable
 
 3) Additional jitsi-videobridge properties to control the TCP-related 
    functionality can be defined at:
 
    %%ETCDIR%%/sip-communicator.properties
 
-   This file not exists by default
-
 4) If jitsi-videobridge server is running behind NAT, you must add the 
-   following lines to sip-comunnicator.properties file
+   following lines to the sip-comunnicator.properties file
 
    org.ice4j.ice.harvest.NAT_HARVESTER_LOCAL_ADDRESS=Local_IP_Address
    org.ice4j.ice.harvest.NAT_HARVESTER_PUBLIC_ADDRESS=Public_IP_Address
 
    Also, you must redirect TCP/4443 and UDP/10000 ports to jitsi-videobridge 
-   server
+   server.
 
 5) More about jitsi-videobridge properties at:
 
diff --git a/net-im/jitsi-videobridge/files/sip-communicator.properties.sample b/net-im/jitsi-videobridge/files/sip-communicator.properties.sample
new file mode 100644
index 000000000000..b928779fd501
--- /dev/null
+++ b/net-im/jitsi-videobridge/files/sip-communicator.properties.sample
@@ -0,0 +1,5 @@
+org.ice4j.ice.harvest.DISABLE_AWS_HARVESTER=true
+
+# NAT
+#org.ice4j.ice.harvest.NAT_HARVESTER_LOCAL_ADDRESS=10.1.1.17
+#org.ice4j.ice.harvest.NAT_HARVESTER_PUBLIC_ADDRESS=1.2.3.4
diff --git a/net-im/jitsi-videobridge/pkg-plist b/net-im/jitsi-videobridge/pkg-plist
index 6c6d41a5db76..27a9405ef813 100644
--- a/net-im/jitsi-videobridge/pkg-plist
+++ b/net-im/jitsi-videobridge/pkg-plist
@@ -1,4 +1,10 @@
+@owner jvb
+@group jitsi
 @sample %%ETCDIR%%/jitsi-videobridge.conf.sample
+@sample %%ETCDIR%%/sip-communicator.properties.sample
 %%JAVAJARDIR%%/jitsi-videobridge.jar
 %%DATADIR%%/lib/logging.properties
 %%DATADIR%%/lib/videobridge.rc
+@dir(jvb,jitsi,750) %%ETCDIR%%
+@owner
+@group