Created attachment 250696 [details] git diff: update mongodb dependency In October 2024 MongoDB 5.0 goes EOL. Lets have the Unifi port in a good shape in time for this. The patch updates the dependency. Plus it changes PORTVERSION to DISTVERSION as advised in the porters handbook.
If I understood correctly, unifi8.1 and upwards only support MongoDB 7.0 (and 3.6, 4.4) but no 5.x or 6.x >> * UniFi Network Application 7.5 and newer requires MongoDB 3.6 and Java 17. >> * Version 7.5 till 8.0 supports up to MongoDB 4.4. >> * Version 8.1 and newer supports up to MongoDB 7.0. >> Does that imply >8.1 supports all versions between 3.6 and 7.0? Or only 3.6, 4.4 >> and 7.0? So no 5.x or 6.x? > .From UI release notes on mongodb, that is what I believe. "Or only 3.6, 4.4 and > 7.0? So no 5.x or 6.x?" Plus there has not been anything specific 5.X or 6.X in > any release notes going way back. Plus it is only on the self-hosted (Linux) > installs, others have been asking about Windows updating to mongodb 7.X, nothing > mentioned about MacOS either. Console devices are still on 3.6 or 4.4.
(In reply to mca_two from comment #1) I don't think you understood correctly. To me "up to MongoDB 7.0" implies it supports all versions between and including 3.6 and 7.0.
(In reply to Ronald Klop from comment #2) > To me "up to MongoDB 7.0" implies That's indeed the issue, the changelogs aren't crystal clear. Maybe it's a problem on my end, but the issue below made me believe unifi8 doesn't work with mongoDB 5.0 (and 6.0) https://forums.FreeBSD.org/threads/unifi-controller-works-fine-but-mongo-keeps-crashing-in-jail.93088/
(In reply to mca_two from comment #3) That MongoDB 5.0 crash had to do with the non-AVX CPU. See: https://www.freshports.org/databases/mongodb50/#history It had nothing to do with the question if Unifi 8.1 can run using MongoDB 5.0.
While testing this in runtime I found an issue. My MongoDB is running 5.0 but it was still configured with featureCompatibilityVersion=4.4 which does not work when running 6.0. {"t":{"$date":"2024-05-22T10:36:42.574+02:00"},"s":"F", "c":"CONTROL", "id":20573, "ctx":"initandlisten","msg":"Wrong mongod version","attr":{"error":"UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: Location4926900: Invalid featureCompatibilityVersion document in admin.system.version: { _id: \"featureCompatibilityVersion\", version: \"4.4\" }. See https://docs.mongodb.com/master/release-notes/5.0-compatibility/#feature-compatibility. :: caused by :: Invalid feature compatibility version value, expected '5.0' or '5.3' or '6.0. See https://docs.mongodb.com/master/release-notes/5.0-compatibility/#feature-compatibility.). If the current featureCompatibilityVersion is below 5.0, see the documentation on upgrading at https://docs.mongodb.com/master/release-notes/5.0/#upgrade-procedures."}} I think this needs some more documentation somewhere. https://www.mongodb.com/docs/v6.0/release-notes/6.0-upgrade-standalone/ On a running Unifi instance run: # mongo --port 27117 MongoDB shell version v5.0.26 connecting to: mongodb://127.0.0.1:27117/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("5a997bc5-667f-4f96-954b-84ca929d3a6c") } MongoDB server version: 5.0.26 ================ Warning: the "mongo" shell has been superseded by "mongosh", which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in an upcoming release. For installation instructions, see https://docs.mongodb.com/mongodb-shell/install/ ================ Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see https://docs.mongodb.com/ Questions? Try the MongoDB Developer Community Forums https://community.mongodb.com --- The server generated these startup warnings when booting: 2024-05-22T10:49:54.474+02:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted 2024-05-22T10:49:54.475+02:00: Soft rlimits for open file descriptors too low 2024-05-22T10:49:54.475+02:00: currentValue: 26676 2024-05-22T10:49:54.475+02:00: recommendedMinimum: 64000 --- > db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) { "featureCompatibilityVersion" : { "version" : "4.4" }, "ok" : 1 } > db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } ) { "ok" : 1 } > exit bye This works. Just a dump of my progress. Have to do some $work now.
Created attachment 250874 [details] git diff: update mongodb dependency Updated the UPDATING entry with a remark about featureCompatibilityVersion. Unifi8 is now running on MongoDB 6 at my home using an in-place upgrade of mongodb.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=33c9c139acad33ccd35f28dbc7f585cc353302e4 commit 33c9c139acad33ccd35f28dbc7f585cc353302e4 Author: Juraj Lutter <otis@FreeBSD.org> AuthorDate: 2024-06-06 04:55:11 +0000 Commit: Juraj Lutter <otis@FreeBSD.org> CommitDate: 2024-06-06 04:59:45 +0000 net-mgmt/unifi8: Update to 8.2.93 - Update to 8.2.93 - Switch to MongoDB 6.0 (see UPDATING entry) [1] PR: 279029 [1] UPDATING | 15 +++++++++++++++ net-mgmt/unifi8/Makefile | 4 ++-- net-mgmt/unifi8/distinfo | 10 +++++----- 3 files changed, 22 insertions(+), 7 deletions(-)
Thanks for your work on this port. 🏆
While we are here, could you please rephrase the UPDATING entry to be more specific, in terms of when to run db.adminCommand, how to connect to the mongodb instnace and similar? Thanks.
Hello, how am I supposed to fix the issue if I didn't change the string on the database before restarting the unifi service? My mongodb service doesn't start anymore due to this limitation. Thank you!
(In reply to Emanuele from comment #10) Just install mongodb50 again and it starts. It didn't migrate any tables yet. Mongodb50 contains a 'mongo' CLI shell program. On the machine or jail running mongod run the following command to connect to the Mongo DB. $ mongo --port 27117 After setting the right featureCompatibilityVersion you can install mongodb60 again.
The other option is (provided that you have the backup .unf files) to save the backup files to a safe location, delete the database and start with clean installation, restoring the instance from .unf files.
(In reply to Juraj Lutter from comment #12) I have an updated unf backup file (from a daily auto-backup) so I tried to create a new jail (13.3-RELEASE-p3) from scratch and install unifi8 (unifi8-8.2.93) but it fails to start and no logs are created within /usr/local/share/java/unifi/logs.
(In reply to Emanuele from comment #13) I tried to create a new 13.3-RELEASE-p3 jail (once again) but tried installing unifi8-8.1.113 which requires (and installs) mongodb50-5.0.26_2 but I don't know why the UniFi service is unable to start and I can't find any reason/log under /var/log. No file gets created on /usr/local/share/java/unifi/data/ and /usr/local/share/java/unifi/logs/ It seems like if a fresh new install of unifi8 doesn't work anymore (but can't tell why). I don't know if I can do something more in order to debug it :-S
(In reply to Juraj Lutter from comment #9) What do you think about this change to UPDATING? diff --git a/UPDATING b/UPDATING index cd95246f6aa0..80a98a7dd50f 100644 --- a/UPDATING +++ b/UPDATING @@ -55,6 +55,10 @@ you update your ports collection, before attempting any port upgrades. For an in-place upgrade it is important that the MongoDB 'featureCompatibilityVersion' is set to 5.0. See: https://www.mongodb.com/docs/v6.0/release-notes/6.0-upgrade-standalone/#feature-compatibility-version + Run these commands in mongodb50 before upgrading: + $ mongo --port 27117 + > db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } ) + > exit See updating entry 20230310 for a backup/restore upgrade.
(In reply to Ronald Klop from comment #15) Yes, please go ahead.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=5ac0b01d93bc16fbcaa136aacacf1fb50ea1f9a5 commit 5ac0b01d93bc16fbcaa136aacacf1fb50ea1f9a5 Author: Ronald Klop <ronald@FreeBSD.org> AuthorDate: 2024-06-25 19:07:40 +0000 Commit: Ronald Klop <ronald@FreeBSD.org> CommitDate: 2024-07-01 17:17:40 +0000 UPDATING: clarify unifi8 + mongodb60 in place upgrade PR: 279029 UPDATING | 4 ++++ 1 file changed, 4 insertions(+)
(In reply to Emanuele from comment #14) Did you ever figure out a solution to this issue? Im seeing the same behavior, unifi8 fails in a brand new jail
(In reply to Ryan from comment #18) Does your jail have allow.mlock enabled? NB: if this suggestion does help, are you able to open a new PR issue for this?
(In reply to Ronald Klop from comment #19) Mmm, I meant “… does NOT help …”