linuxserver / docker-unifi-network-application

GNU General Public License v3.0
551 stars 40 forks source link

How to migrate mongo DB from version 4.4 to 7.0? #85

Closed schneich closed 2 months ago

schneich commented 2 months ago

Is this a new feature request?

Wanted change

Well, is there any best practice on how to upgrade the underlying mongo db to a newer version? I would very much appreciate some words on your main page. Is there something easier then:

  1. perform a full backup from within the Unifi Application GUI
  2. stop both containers
  3. rebuild mongo db container in new version 7.0
  4. rebuild unifi application container
  5. restore backup

Reason for change

A documentation for people not that familiar with containers, linux and mongo db's would be very helpfull

Proposed code change

No response

github-actions[bot] commented 2 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

thespad commented 2 months ago

See https://www.mongodb.com/docs/v7.0/release-notes/7.0/ and all previous steps. You need to go one major version at a time from 4.4 to 5.0 all the way to 7.0.

schneich commented 2 months ago

For the record:

I changed the version of the underlying mongoDB in these steps:

  1. log in into the Unifi Network Application and export a full backup
  2. stop both containers: Unifi Application and Mongo DB
  3. empty all folders of your persistent data (-> copy the data somewhere else - in case something goes wrong)
  4. copy the init-mongo.js back into the correct folder (-> check your docker compose.yaml)
  5. change the mongoDB version within the compose.yaml to "7"
  6. start the conainers again
  7. When everything is up and running, log into the Unifi Network Application and import the backup

Note: I use portainer to manage my docker containers/stacks.