Unifi Network App (migration)

Soo since the previous ghcr.io/linuxserver/unifi-controller:latest is going End of life 2024-01-01 its time to migrate.

"Official" Docs: https://github.com/linuxserver/docker-unifi-network-application

I run my stuff using Portainer so the guide will be made for that, but its still docker-compose files so its should work elsewhere as well

  1. Make sure you know you AP password, if not I found mine under

So make sure you jot that down for future use as well....

  1. Export configuration by going to Settings -> System -> Backups

If you want historic data with you, choose how many days back you want to download

  1. In Portainer shut down you previous Stack

  2. SSH to your Portainer host and create this file /tmp/init-mongo.js

db.getSiblingDB("unifi").createUser({user: "unifi", pwd: "myFunnyPassword", roles: [{role: "dbOwner", db: "unifi"}]});
db.getSiblingDB("unifi_stat").createUser({user: "unifi", pwd: "myFunnyPassword", roles: [{role: "dbOwner", db: "unifi_stat"}]});

Change "myFunnyPassword" to something else

  1. Create a new Stack with this docker-compose

---
version: "2.1"
services:
  unifi-network-application:
    image: lscr.io/linuxserver/unifi-network-application:latest
    container_name: unifi-network-application
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - MONGO_USER=unifi
      - MONGO_PASS=myFunnyPassword
      - MONGO_HOST=unifi-db
      - MONGO_PORT=27017
      - MONGO_DBNAME=unifi
      - MEM_LIMIT=1024 #optional
      - MEM_STARTUP=1024 #optional
      - MONGO_TLS= #optional
      - MONGO_AUTHSOURCE= #optional
    volumes:
      - 'unifi_app_config:/config'
    ports:
      - 8443:8443
      - 3478:3478/udp
      - 10001:10001/udp
      - 8080:8080
      - 1900:1900/udp #optional
      - 8843:8843 #optional
      - 8880:8880 #optional
      - 6789:6789 #optional
      - 5514:5514/udp #optional
    restart: unless-stopped
  unifi-db:
    image: docker.io/mongo:4.4
    container_name: unifi-db
    volumes:
      - 'unifi_db_data:/data/db'
      - /tmp/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
    restart: unless-stopped
volumes:
  unifi_app_config:
  unifi_db_data:
  1. Start the stack

  2. You should now be able to access your UI, choose restore from backup. Once the backup has been restored, you should be able to login using your old credentials.

  3. SSH to your APs, ssh username@<ip>

  4. run set-inform http://ip-to-controller:8080/inform

Done and done

Cleaning up

Once all set up, you should delete the init-mongo.js file from the portainer hos and remove the line from the Portainer Stack

Last updated