linuxserver / docker-unifi-network-application

GNU General Public License v3.0
633 stars 47 forks source link

no more login to docker unifi-network-application with mongo db #101

Open shredman01 opened 1 month ago

shredman01 commented 1 month ago

Is there an existing issue for this?

Current Behavior

I migrated from unifi controller 8.0.24 to 8.2.93 or latest version of docker unifi-networking-application. I followed the instructions exactly and imported a previously created backup of the old controller after starting the container for the first time. Everything is ok so far, but I can only log in for a few hours and then nothing works. Incorrect user or password. The server.log file is full of strange error messages. when these messages come up in the log, login is not possible anymore.

Expected Behavior

I've tried all sorts of mongo db versions, different unifi docker tags but always the same. Migration successful and after a few hours of operation the web interface no longer lets me log in. I probably have to go back to the unifi-controller version, which doesn't get any updates anymore but at least it works. What could be the cause?

Steps To Reproduce

see current behavior

Environment

- OS: 
dPRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian

Hardware: Intel Product Name: NUC12WSBi3

services:

  unifi-db:
    image: mongo:5.0
    container_name: unifi-db
    hostname: mongo-unifi
    mem_limit: 2g
    ports:
      - 27017:27017
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
       - /data/docker/container/unifi-network/mongo:/data/db:rw
       - /data/docker/container/unifi-network/mongo:/var/lib/mongo:rw
       - /data/docker/container/unifi-network/mongo:/data/configdb:rw
       - /data/docker/container/unifi-network/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
    #command: [ --auth ]
    restart: unless-stopped

  unifi-network-application:
    image: lscr.io/linuxserver/unifi-network-application:8.2.93
    container_name: unifi-network-application
    depends_on:
      - unifi-db
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - MONGO_USER=unifi
      - MONGO_PASS=password123
      - MONGO_HOST=mongo-unifi
      - MONGO_PORT=27017
      - MONGO_DBNAME=unifi
      - MEM_LIMIT=1024
      - MEM_STARTUP=1024
      - MONGO_TLS=false
      #- MONGO_AUTHSOURCE= unifi 
    volumes:
      - /data/docker/container/unifi-network/config:/config
    ports:
     - '3478:3478/udp'
     - '10001:10001/udp'
       #- '1900:1900/udp'
     - '6789:6789/tcp'
     - '9080:8080/tcp'
     - '8880:8880/tcp'
     - '9443:8443/tcp'
     - '8843:8843/tcp'
     - '5514:5514/tcp'

db.getSiblingDB("admin").createUser({user: "admin", pwd: "password", roles: [{role: "userAdminAnyDatabase", db: "admin"}]});
db.getSiblingDB("unifi").createUser({user: "unifi", pwd: "password123", roles: [{role: "readWrite", db: "unifi"}]});
db.getSiblingDB("unifi_stat").createUser({user: "unifi", pwd: "password123", roles: [{role: "readWrite", db: "unifi_stat"}]});

CPU architecture

x86-64

Docker creation

normal with docker compose up -d

Container logs

unifi-networking-application logs:

[2024-07-25 18:21:07,233] <inform_stat-2> ERROR uap    - inconsistent vap, offending essid=shredman_guest
[2024-07-25 18:21:07,233] <inform_stat-2> WARN  uap    - invalid id (5b2006351c71283b15f425dd) in vap, searching by essid=shredman_wlan in site 5b2000d81c71283b15f425c6
[2024-07-25 18:21:07,234] <inform_stat-2> ERROR uap    - inconsistent vap, offending essid=shredman_wlan
[2024-07-25 18:21:07,234] <inform_stat-2> WARN  uap    - invalid id (5be72e1c3cdd3502e1011de1) in vap, searching by essid=shredman_radius in site 5b2000d81c71283b15f425c6
[2024-07-25 18:21:07,235] <inform_stat-2> ERROR uap    - inconsistent vap, offending essid=shredman_radius
[2024-07-25 18:21:07,235] <inform_stat-2> WARN  uap    - invalid id (5da2382b3cdd35031b3afbeb) in vap, searching by essid=RaidbossGER in site 5b2000d81c71283b15f425c6
[2024-07-25 18:21:07,235] <inform_stat-2> ERROR uap    - inconsistent vap, offending essid=RaidbossGER
[2024-07-25 18:21:17,356] <inform_stat-3> WARN  uap    - invalid id (5ee9122b3cdd35324a33b6d0) in vap, searching by essid=element-2cb7dd835fcfc0da in site 5b2000d81c71283b15f425c6

mongo-db logs:

{"t":{"$date":"2024-07-25T16:28:27.904+00:00"},"s":"I",  "c":"ACCESS",   "id":20250,   "ctx":"conn606","msg":"Authentication succeeded","attr":{"mechanism":"SCRAM-SHA-256","speculative":true,"principalName":"unifi","authenticationDatabase":"unifi","remote":"172.30.3.3:48912","extraInfo":{}}}
{"t":{"$date":"2024-07-25T16:28:38.267+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":"[1721924918:267107][1:0x7fd93083f700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 7208, snapshot max: 7208 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 802"}}
{"t":{"$date":"2024-07-25T16:29:38.275+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":"[1721924978:275477][1:0x7fd93083f700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 7210, snapshot max: 7210 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 802"}}
{"t":{"$date":"2024-07-25T16:30:38.282+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":"[1721925038:282100][1:0x7fd93083f700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 7213, snapshot max: 7213 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 802"}}
{"t":{"$date":"2024-07-25T16:31:27.897+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn602","msg":"Connection ended","attr":{"remote":"172.30.3.3:45282","uuid":"e2f4193a-ef3e-49ac-bed0-82248591ed06","connectionId":602,"connectionCount":6}}
github-actions[bot] commented 1 month ago

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

brandorian commented 3 weeks ago

did you find a solution? i have the same issue!

shredman01 commented 2 weeks ago

No, not really. I tried everything, multiple installations with different mongo-db versions, docker-compose.yml settings but nothing worked. The container runs smoothly at the beginning, you can log in, everything is ok, but after a few hours nothing works anymore. No possibility to log in anymore. I suspect it's a problem with the separate mongodb database. Hopefully the Github team will take a closer look at this error. I'm still on the latest unifi-controller docker version, which at least runs stable.

shredman01 commented 1 week ago

did you find a solution? i have the same issue!

Solution found, everything works now. I looked at the github page https://github.com/linuxserver/docker-unifi-network-application again and saw that the initialization of the mongo db is no longer done with the init-mongo.js script but with an init-mongo.sh script. Important! First, delete the content of the database and the config directory. Then, create the init-mongo.sh script as described in the HowTo, set u+x, build a suitable docker-compose.yml and start the containers with docker compose up -d and it should work. Logs can be checked with a docker logs -f unifi-network-application

services:

unifi-db: image: mongo:6.0.16 container_name: unifi-db hostname: mongo-unifi mem_limit: 2g environment:

networks: default: driver: bridge ipam: driver: default config:

The docker conatiners run since 2 days and login is possible every time.

Regards, Frank