git: eea19244c574 - main - net-mgmt/unifi7: Update database dependency to mongodb44

From: Juraj Lutter <otis_at_FreeBSD.org>
Date: Fri, 10 Mar 2023 16:03:41 UTC
The branch main has been updated by otis:

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

commit eea19244c57483c14b4066c9ee583fbaf60dd05d
Author:     Juraj Lutter <otis@FreeBSD.org>
AuthorDate: 2023-02-23 16:32:42 +0000
Commit:     Juraj Lutter <otis@FreeBSD.org>
CommitDate: 2023-03-10 16:03:22 +0000

    net-mgmt/unifi7: Update database dependency to mongodb44
    
    As mongodb 3.6 is long out of support, switch to mongodb 4.4,
    even though not directly supported by upstream.
    
    See UPDATING entry for details about updating to this version.
---
 UPDATING                             | 24 ++++++++++++++++++++++++
 net-mgmt/unifi7/Makefile             | 10 +++++-----
 net-mgmt/unifi7/files/pkg-message.in | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 5 deletions(-)

diff --git a/UPDATING b/UPDATING
index 6ed925705fe7..ff02923b3a0d 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,30 @@ they are unavoidable.
 You should get into the habit of checking this file for changes each time
 you update your ports collection, before attempting any port upgrades.
 
+20230310:
+  AFFECTS: users of net-mgmt/unifi7
+  AUTHOR: otis@FreeBSD.org
+
+  The mongodb dependency has been changed from 36 to 44, as MongoDB 3.6
+  is long out out support and end of life.
+
+  The upgrade path should be as following:
+
+  1. Take a backup from within the unifi7 application PRIOR to
+     updating!
+
+  2. Stop the unifi7 service (if running)
+
+  3. Copy the "backup" directory from LOCALBASE/share/java/unifi/data/db
+     to a safe location.
+
+  4. Remove all files and directories under
+     LOCALBASE/share/java/unifi/data/db
+
+  5. Upgrade the package and start the service
+
+  6. Restore the configuration from backup
+
 20230310:
   AFFECTS: user of benchmarks/ddosify
   AUTHOR: fernape@FreeBSD.org
diff --git a/net-mgmt/unifi7/Makefile b/net-mgmt/unifi7/Makefile
index cfbd569b98ec..921d5dba4fe9 100644
--- a/net-mgmt/unifi7/Makefile
+++ b/net-mgmt/unifi7/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	unifi7
 PORTVERSION=	7.3.83
+PORTREVISION=	1
 CATEGORIES=	net-mgmt java
 MASTER_SITES=	http://dl.ubnt.com/unifi/%SUBDIR%/:unifi \
 		https://repo1.maven.org/maven2/%SUBDIR%/:jax
@@ -16,9 +17,6 @@ WWW=		https://help.ui.com/hc/en-us/categories/200320654-UniFi-Wireless
 
 RUN_DEPENDS=	snappyjava>0:archivers/snappy-java
 
-DEPRECATED=    Depends on upstream EOLed mongodb36
-EXPIRATION_DATE=       2023-03-31
-
 USES=		cpe
 
 CPE_VENDOR=	ui
@@ -38,6 +36,8 @@ EXTRACT_AFTER_ARGS=	data.tar.xz | ${TAR} -xf -
 
 NO_ARCH=	yes
 NO_BUILD=	yes
+
+SUB_FILES=	pkg-message
 SUB_LIST+=	GROUPS=${GROUPS} \
 		JAVA=${JAVA} \
 		JAVA_HOME=${JAVA_HOME} \
@@ -52,9 +52,9 @@ GROUPS=		unifi
 OPTIONS_DEFINE=	EXTERNALDB
 
 EXTERNALDB_DESC=	Use external MongoDB server
-EXTERNALDB_VARS=	PKGMESSAGE=${WRKSRC}/pkg-message.extdb \
+EXTERNALDB_VARS=	PKGMESSAGE+=${WRKSRC}/pkg-message.extdb \
 			SUB_FILES+=pkg-message.extdb
-EXTERNALDB_VARS_OFF=	RUN_DEPENDS+=mongodb36>0:databases/mongodb36
+EXTERNALDB_VARS_OFF=	RUN_DEPENDS+=mongodb44>0:databases/mongodb44
 
 _DIR_LIST=	conf data logs run work
 _JAX_DISTNAME=	javax.activation-api
diff --git a/net-mgmt/unifi7/files/pkg-message.in b/net-mgmt/unifi7/files/pkg-message.in
new file mode 100644
index 000000000000..34b97e7333bf
--- /dev/null
+++ b/net-mgmt/unifi7/files/pkg-message.in
@@ -0,0 +1,34 @@
+[
+{
+  type: upgrade
+  maximum_version: "7.3.83"
+  message <<EEOOMM
+ATTENTION: The mongodb dependency has been changed from 36 to 44, as MongoDB
+3.6 is long out out support and end of life.
+
+One of implications is that the instance MUST be restored from backup.
+
+The upgrade path can be as following:
+
+- Take a backup from within the unifi7 application BEFORE stopping or
+  restarting the service.
+
+- Stop the unifi7 service.
+
+- Copy the "backup" directory from %%LOCALBASE%%/share/java/unifi/data/db
+  to a safe location.
+
+- Remove all files and directories under
+  %%LOCALBASE%%/share/java/unifi/data/db
+
+- Upgrade the package
+
+- Copy the "backup" directory from the safe place to
+  %%LOCALBASE%%/share/java/unifi/data/db
+
+- Start the service.
+
+- Restore the configuration from backup.
+EEOOMM
+}
+]