Page MenuHometicket.majava.org

unifi: figure out what to do with mongodb repositories
Closed, ResolvedPublic

Event Timeline

taavi triaged this task as Medium priority.

MongoDB versions

The Unifi package only supports MongoDB versions older than 4.0. (The latest is 6.0).

Depends: binutils, coreutils, adduser, libcap2, curl,
 mongodb-server (>= 2.4.10) | mongodb-10gen (>= 2.4.14) | mongodb-org-server (>= 2.6.0),
 mongodb-server (<< 1:4.0.0) | mongodb-10gen (<< 4.0.0) | mongodb-org-server (<< 4.0.0),
 openjdk-11-jre-headless, logrotate

The latest release in the 3.x series, 3.6, only ships with packages for Debian 8 and 9. We're currently using Debian 11.

There are rumours of 4.x working, but no official communications from Ubiquiti. :(

Package mirroring

Apt repositories contain two files with package metadata: Release and InRelease, with InRelease being the newer one. At least by default Reprepro uses InRelease for fetching data for mirroring.

However MongoDB repositories only have a Release file:

$ curl https://repo.mongodb.org/apt/debian/dists/stretch/mongodb-org/3.6/InRelease
<html>
<head><title>404 Not Found</title></head>
$ curl https://repo.mongodb.org/apt/debian/dists/stretch/mongodb-org/3.6/Release
Origin: mongodb

Apparently Reprepro has a config option that will pull Release instead of InRelease:

GetInRelease: no
    IF this is present, no InRelease file is downloaded but only Release (and Release.gpg ) are tried.

Ok, added mirroring for 3.6 with this commit:

commit 2c35eb77e808b9b6def6ea1eb4a84d789d20daa3
Author: Taavi Väänänen <hi@taavi.wtf>
Date:   Sun Jan 22 10:33:47 2023 +0000

    hieradata: mirror the mongodb repository for unifi

Still would be nice to use newer versions but that's all we can do for now.

The package supports now MongoDB up to 4.4. Looking at how to upgrade now. It needs going through 4.0 and 4.2 first, both of which seem to have issues with curl and openssl versions on Bullseye.

Yeah, I can't get 4.0 or 4.2 to run on the host, 4.4 thankfully seems fine. Using a Docker trick to upgrade.

:# Start the server in a container
root@unifi02:~# docker run --rm -it --mount type=bind,source=/usr/lib/unifi,target=/usr/lib/unifi --mount type=bind,source=/var/lib/unifi,target=/var/lib/unifi --mount type=bind,source=/var/log/unifi,target=/var/log/unifi --entrypoint bash mongo:4.0
root@fc90064ba7cc:/# mongod --dbpath /usr/lib/unifi/data/db

:# Run the upgrade command
root@unifi02 ~ # docker exec -it inspiring_elgamal mongo
> db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
{ "featureCompatibilityVersion" : { "version" : "3.6" }, "ok" : 1 }
> db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )
{ "ok" : 1 }
> db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
{ "featureCompatibilityVersion" : { "version" : "4.0" }, "ok" : 1 }

:# Fix the file permissions afterwards
root@unifi02:~# chown -R unifi:unifi /usr/lib/unifi/
commit fe96d588ff2e38dcb4bbc8d05088d25fc93bd0b7 (HEAD -> master, origin/master, origin/HEAD)
Author:     Taavi Väänänen <hi@taavi.wtf>
AuthorDate: Sun Sep 24 14:42:46 2023 +0000
Commit:     Taavi Väänänen <hi@taavi.wtf>
CommitDate: Sun Sep 24 14:42:46 2023 +0000

    hieradata: update mongodb to 4.4

Note that 4.4 still runs off of Buster repos even though the server is on Bullseye. :/

taavi claimed this task.
taavi moved this task from Stalled to In progress on the Infra board.

And upgraded to 7.0 which is the latest upstream release at the moment.

taavi shifted this object from the Restricted Space space to the S6 Public space.Oct 12 2024, 11:41