Open Dehumanizer77 opened 1 year ago
it seems that unifi needs to be upgrade piecemeal to the new mongodb version in at least some instances, starting at the version used previously. this may require temporarily pulling mongodb from older releases, cf https://github.com/NixOS/nixpkgs/pull/207382#issuecomment-1371303817
I confirm that upgrading unifi gradually to mongodb 3.6, 4.0 and 4.2 before upgrading nixos to 23.05 fixes the issue. After upgrading to mongo 4.0 I also had to change featureCompatibilityVersion to 4.0 as per https://www.mongodb.com/docs/manual/release-notes/4.2-upgrade-standalone/ , otherwise the mongodb refused to start after upgrade to 4.2
After noticing strange behavior following my upgrade to 23.05, I set unifiPackage = pkgs.unifi6;
, mongodbPackage = pkgs.mongodb-4_2;
, and followed the manual mongodb upgrade instructions, and now Unifi seems to be more broken than ever: it opens a socket, but returns "HTTP Status 404 – Not Found" for all requests, and the log files don't seem to get written so I don't have anything else to go on. Mongodb does not seem to be running at all. Help?
Edit: Looks like I just got the permissions wrong on the db, and was looking at an obsolete log file path.
Does it take a long time for Monodb to build? or can this issue affect build time also in a clean build (i.e. could I be looping in build)?
It's long, but it's not like several hours... Depending on the HW where you build it ofc.
Thank you, it seems I hit a lot of warnings, but not errors. And it was running for 15 min so I cancelled. I will try again
it's certainly longer then 15 mins. I can't remember exactly but even one hour would be reasonable with weaker HW IMHO.
ouch haha. I have an i7 and 16gb of ram on this machine. Is it possible to create an FHS version to just install debian package?
mongodb takes around 80 minutes to build on my rather elderly server. If you want to save yourself some time, or if you, like me, wound up unable to roll back after taking drastic measures to make enough room for mongo to build, this is what worked for me: grab the most recent autobackup and save it off, set your unifi package to unifi7, your mongodbPackage to mongodb-4_4, and blow away /var/lib/unifi/data/db. After the app comes up you should be able to restore from the backup.
This was a rough one.
mongodb takes around 80 minutes to build on my rather elderly server. If you want to save yourself some time, or if you, like me, wound up unable to roll back after taking drastic measures to make enough room for mongo to build, this is what worked for me: grab the most recent autobackup and save it off, set your unifi package to unifi7, your mongodbPackage to mongodb-4_4, and blow away /var/lib/unifi/data/db. After the app comes up you should be able to restore from the backup.
This was a rough one.
I ended up leaving mine building and walked away for a while. I dk how long it took at end of day, but everything I read about building mongodb pointed at "A LONG TIME" HAHA.
Same problem with 23.11 but I haven't found a solution (yet) :-/
Still working fine for me on 23.11 after fixing things on 23.05 (setting unifiPackage = pkgs.unifi7; mongodbPackage = pkgs.mongodb-4_4;
and performing manual migration).
I haven't set unifiPackage = pkgs.unifi7; but I suppose it's default... What do you mean by manual migration?
My notes say I followed the instructions at https://github.com/NixOS/nixpkgs/pull/207382#issuecomment-1371303817. I think the official mongodb documentation for migrations is also a good reference.
@Ralith oh I see, thank you, yes, recreating the mongo database helped.
Oh god what pain. I had a unifi setup that apparently had been running mongodb 4.2, you can only migrate that to 4.4, I didn't notice that in time, and mongodb-4_4 has been removed from NixOS 24.05.. Currently waiting for this monster to build to try the upgrade:
NIXPKGS_ALLOW_UNFREE=1 nix \
--extra-experimental-features nix-command \
--extra-experimental-features flakes \
shell --impure \
github:nixos/nixpkgs/nixos-23.11#mongodb-4_4
I think the way to go here is:
That's what I did for my 24.05 update. Saves the laborious and error-prone series of manual database upgrades.
Unfortunately a combo of 1) I don't really check this Unifi controller often and 2) I was tight on disk space means the old generation is already gone.
Describe the bug
Unifi controller does not start after NixOS upgrade.
Steps To Reproduce
Steps to reproduce the behavior:
Additional context
mongodb is restarting in a loop, producing these logs:
services.unifi.mongodbPackage is not set, so the mongodb is default at 4.2. With our previous generation, mongodb was 3.4
Notify maintainers
@globin @Patryk27 @pennae
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.