linuxserver / docker-unifi-network-application

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

Unifi 404 - Container dont start #64

Closed corincorvus closed 4 months ago

corincorvus commented 4 months ago

Is there an existing issue for this?

Current Behavior

I try to deploy the container, the container starts, a cert will created, but i only get 404 on webbrowser. I tried to restart the controller container, but its not coming up. I also removed the containers, deleted the volumes and tried again. same problem. I tried to first start only db, second the controller. dont work also (i saw it in other issue)

After Deploy on db Container is visible the initscript is used, the db container restarts after. Connection with Controller and db comes up, but nothing work

Before i set an strong password, i use "unifipass"

image

Expected Behavior

The Unifi controller is visible

Steps To Reproduce

  1. Deploy
  2. Open Web Browser

Environment

- OS: Debian 12
- How docker service was installed: Docker

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

CPU architecture

x86-64

Docker creation

---
version: "2.1"

services:
  unifi-controller:
    image: lscr.io/linuxserver/unifi-network-application:latest
    environment:
      - PUID=1001
      - PGID=1001
      - MONGO_USER="unifi"
      - MONGO_PASS="unifipass"
      - MONGO_HOST=unifi-db
      - MONGO_PORT=27017
      - MONGO_DBNAME="unifi"
      - TZ=Europe/Berlin
      - MEM_LIMIT=4096 #optional
      - MEM_STARTUP=2048 #optional
    volumes:
      - unifi-data:/config
    ports:
      - 3478:3478/udp   # Unifi STUN port
      - 10001:10001/udp # Required for AP discovery
      - 8080:8080       # Required for device communication
      - 8081:8081
      - 8443:8443       # Unifi web admin port
      - 1900:1900/udp  # optional Required for Make controller discoverable on L2 network option
      - 8843:8843       # Unifi guest portal HTTPS redirect port
      - 8880:8880       # Unifi guest portal HTTP redirect port
      - 6789:6789       # For mobile throughput test
      - 5514:5514/udp   # optional Remote syslog port
    restart: unless-stopped
    depends_on:
     - unifi-db
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  unifi-db:
    image: docker.io/mongo:4.4
    container_name: unifi-db
    volumes:
      - unifi-db:/data/db
      - /opt/ct/unifi/db/init/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
    restart: unless-stopped

volumes:
  unifi-db:
  unifi-data:

Container logs

Controller:
[migrations] started
[migrations] no migrations found
───────────────────────────────────────
      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝
   Brought to you by linuxserver.io
───────────────────────────────────────
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID:    1001
User GID:    1001
───────────────────────────────────────
*** Waiting for MONGO_HOST unifi-db to be reachable. ***
Generating 4,096 bit RSA key pair and self-signed certificate (SHA384withRSA) with a validity of 3,650 days
    for: CN=unifi
[custom-init] No custom files found, skipping...
[migrations] started
[migrations] no migrations found
usermod: no changes
───────────────────────────────────────
      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝
   Brought to you by linuxserver.io
───────────────────────────────────────
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID:    1001
User GID:    1001
───────────────────────────────────────
[custom-init] No custom files found, skipping...

DB:
t={"$date":"2024-02-01T10:59:57.574+00:00"} s=I c=STORAGE id=22430 ctx=initandlisten msg=WiredTiger message attr={"message":"[1706785197:574058][1:0x7f22c319fcc0], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 2 through 2"}
t={"$date":"2024-02-01T10:59:57.714+00:00"} s=I c=STORAGE id=22430 ctx=initandlisten msg=WiredTiger message attr={"message":"[1706785197:714507][1:0x7f22c319fcc0], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Set global recovery timestamp: (0, 0)"}
t={"$date":"2024-02-01T10:59:57.715+00:00"} s=I c=STORAGE id=22430 ctx=initandlisten msg=WiredTiger message attr={"message":"[1706785197:715847][1:0x7f22c319fcc0], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Set global oldest timestamp: (0, 0)"}
t={"$date":"2024-02-01T10:59:57.724+00:00"} s=I c=STORAGE id=22430 ctx=initandlisten msg=WiredTiger message attr={"message":"[1706785197:724110][1:0x7f22c319fcc0], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 1, snapshot max: 1 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 7"}
t={"$date":"2024-02-01T10:59:57.763+00:00"} s=I c=STORAGE id=4795906 ctx=initandlisten msg=WiredTiger opened attr={"durationMillis":2558}
t={"$date":"2024-02-01T10:59:57.764+00:00"} s=I c=RECOVERY id=23987 ctx=initandlisten msg=WiredTiger recoveryTimestamp attr={"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}
t={"$date":"2024-02-01T10:59:57.779+00:00"} s=I c=STORAGE id=22262 ctx=initandlisten msg=Timestamp monitor starting
t={"$date":"2024-02-01T10:59:57.797+00:00"} s=W c=CONTROL id=22120 ctx=initandlisten msg=Access control is not enabled for the database. Read and write access to data and configuration is unrestricted tags=["startupWarnings"]
t={"$date":"2024-02-01T10:59:57.797+00:00"} s=W c=CONTROL id=22178 ctx=initandlisten msg=/sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never' tags=["startupWarnings"]
t={"$date":"2024-02-01T10:59:57.807+00:00"} s=I c=STORAGE id=20536 ctx=initandlisten msg=Flow Control is enabled on this deployment
t={"$date":"2024-02-01T10:59:57.811+00:00"} s=I c=FTDC id=20625 ctx=initandlisten msg=Initializing full-time diagnostic data capture attr={"dataDirectory":"/data/db/diagnostic.data"}
t={"$date":"2024-02-01T10:59:57.812+00:00"} s=I c=REPL id=6015317 ctx=initandlisten msg=Setting new configuration state attr={"newState":"ConfigReplicationDisabled","oldState":"ConfigPreStart"}
t={"$date":"2024-02-01T10:59:57.815+00:00"} s=I c=NETWORK id=23015 ctx=listener msg=Listening on attr={"address":"/tmp/mongodb-27017.sock"}
t={"$date":"2024-02-01T10:59:57.815+00:00"} s=I c=NETWORK id=23015 ctx=listener msg=Listening on attr={"address":"0.0.0.0"}
t={"$date":"2024-02-01T10:59:57.816+00:00"} s=I c=NETWORK id=23016 ctx=listener msg=Waiting for connections attr={"port":27017,"ssl":"off"}
t={"$date":"2024-02-01T11:00:16.805+00:00"} s=I c=NETWORK id=22943 ctx=listener msg=Connection accepted attr={"remote":"172.19.0.3:60420","connectionId":1,"connectionCount":1}
t={"$date":"2024-02-01T11:00:17.808+00:00"} s=I c=NETWORK id=22944 ctx=conn1 msg=Connection ended attr={"remote":"172.19.0.3:60420","connectionId":1,"connectionCount":0}
t={"$date":"2024-02-01T11:00:57.784+00:00"} s=I c=STORAGE id=22430 ctx=WTCheckpointThread msg=WiredTiger message attr={"message":"[1706785257:784349][1:0x7f22bc190700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 3, snapshot max: 3 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 7"}
t={"$date":"2024-02-01T11:01:58.049+00:00"} s=I c=STORAGE id=22430 ctx=WTCheckpointThread msg=WiredTiger message attr={"message":"[1706785318:49308][1:0x7f22bc190700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 6, snapshot max: 6 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 7"}
t={"$date":"2024-02-01T11:02:58.133+00:00"} s=I c=STORAGE id=22430 ctx=WTCheckpointThread msg=WiredTiger message attr={"message":"[1706785378:133174][1:0x7f22bc190700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 8, snapshot max: 8 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 7"}
github-actions[bot] commented 4 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.

corincorvus commented 4 months ago

Edit: Serverlog of Controller Container send:

[2024-02-01 12:28:46,944] <launcher> INFO  db     - db connection established...
[2024-02-01 12:28:47,520] <launcher> ERROR db     - Got error while connecting to db: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName=''unifi'', source=''unifi'', password=<hidden>, mechanismProperties=<hidden>}

how? i used a very easy password... i tried with '', with "" and without "" on Compose. Every time the Same.-

j0nnymoe commented 4 months ago

You're putting " 's where they shouldn't be in your compose.

corincorvus commented 4 months ago

You're putting " 's where they shouldn't be in your compose.

Same issue:

---
services:
  unifi-controller:
    image: lscr.io/linuxserver/unifi-network-application:latest
    environment:
      - PUID=1001
      - PGID=1001
      - MONGO_USER=unifi
      - MONGO_PASS=unifipass
      - MONGO_HOST=unifi-db
      - MONGO_PORT=27017
      - MONGO_DBNAME=unifi
      - TZ=Europe/Berlin
      - MEM_LIMIT=4096 #optional
      - MEM_STARTUP=2048 #optional
    volumes:
      - unifi-data:/config
    ports:
      - 3478:3478/udp   # Unifi STUN port
      - 10001:10001/udp # Required for AP discovery
      - 8080:8080       # Required for device communication
      - 8081:8081
      - 8443:8443       # Unifi web admin port
      - 1900:1900/udp  # optional Required for Make controller discoverable on L2 network option
      - 8843:8843       # Unifi guest portal HTTPS redirect port
      - 8880:8880       # Unifi guest portal HTTP redirect port
      - 6789:6789       # For mobile throughput test
      - 5514:5514/udp   # optional Remote syslog port
    restart: unless-stopped
    depends_on:
     - unifi-db

  unifi-db:
    image: docker.io/mongo:4.4
    container_name: unifi-db
    volumes:
      - unifi-db:/data/db
      - /opt/ct/unifi/db/init/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
    restart: unless-stopped

volumes:
  unifi-db:
  unifi-data:
j0nnymoe commented 4 months ago

MONGO_PASS="unifipass

I would at this point suggest starting fresh as I don't believe they change after first deployment.

corincorvus commented 4 months ago

MONGO_PASS="unifipass

I would at this point suggest starting fresh as I don't believe they change after first deployment.

RemoteDesktopManager_dQ67bIKX44 image


services:
  unifi-controller:
    image: lscr.io/linuxserver/unifi-network-application:latest
    environment:
      - PUID=1001
      - PGID=1001
      - MONGO_USER=unifi
      - MONGO_PASS=unifi
      - MONGO_HOST=unifi-db
      - MONGO_PORT=27017
      - MONGO_DBNAME=unifi
      - TZ=Europe/Berlin
      - MEM_LIMIT=4096 #optional
      - MEM_STARTUP=2048 #optional
    volumes:
      - /opt/ct/unifi/config:/config
    ports:
      - 3478:3478/udp   # Unifi STUN port
      - 10001:10001/udp # Required for AP discovery
      - 8080:8080       # Required for device communication
      - 8081:8081
      - 8443:8443       # Unifi web admin port
      - 1900:1900/udp  # optional Required for Make controller discoverable on L2 network option
      - 8843:8843       # Unifi guest portal HTTPS redirect port
      - 8880:8880       # Unifi guest portal HTTP redirect port
      - 6789:6789       # For mobile throughput test
      - 5514:5514/udp   # optional Remote syslog port
    restart: unless-stopped
    depends_on:
     - unifi-db

  unifi-db:
    image: docker.io/mongo:4.4.28
    environment:
      - MONGO_DBNAME=unifi
      - MONGO_USER=unifi
      - MONGO_PASS=unifi
    volumes:
      - unifi-db:/data/db
      - /opt/ct/unifi/db/init/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
    restart: unless-stopped

volumes:
  unifi-db:
  unifi-data:

Deployed on another machine with fresh init.

j0nnymoe commented 4 months ago

As per our docs, we don't suggest using both env's for user/pass + the init file.

corincorvus commented 4 months ago

As per our docs, we don't suggest using both env's for user/pass + the init file.

yea at the moment i am looking for solutions in the issues, where users said: "it works", cause the docs not work.

The docs not work.

Resettet Test Machine: Compose:

services:
  unifi-controller:
    image: lscr.io/linuxserver/unifi-network-application:latest
    environment:
      - PUID=1001
      - PGID=1001
      - MONGO_USER=unifi
      - MONGO_PASS=unifi
      - MONGO_HOST=unifi-db
      - MONGO_PORT=27017
      - MONGO_DBNAME=unifi
      - TZ=Europe/Berlin
      - MEM_LIMIT=4096 #optional
      - MEM_STARTUP=2048 #optional
    volumes:
      - /opt/ct/unifi/config:/config
    ports:
      - 3478:3478/udp   # Unifi STUN port
      - 10001:10001/udp # Required for AP discovery
      - 8080:8080       # Required for device communication
      - 8081:8081
      - 8443:8443       # Unifi web admin port
      - 1900:1900/udp  # optional Required for Make controller discoverable on L2 network option
      - 8843:8843       # Unifi guest portal HTTPS redirect port
      - 8880:8880       # Unifi guest portal HTTP redirect port
      - 6789:6789       # For mobile throughput test
      - 5514:5514/udp   # optional Remote syslog port
    restart: unless-stopped
    depends_on:
     - unifi-db

  unifi-db:
    image: docker.io/mongo:4.4
    volumes:
      - unifi-db:/data/db
      - /opt/ct/unifi/db/init/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
    restart: unless-stopped

volumes:
  unifi-db:
  unifi-data:

No Volumes of Unifi: image root@network:/opt/ct/unifi/db/init# docker volume list DRIVER VOLUME NAME local portainer_data root@network:/opt/ct/unifi/db/init#

Config folger for controller is empty: drwxrwx--- 4 unifi unifi 4096 Feb 1 12:26 .. drwxrwx--- 2 unifi unifi 4096 Feb 1 12:51 . root@network:/opt/ct/unifi/config#

init: root@network:/opt/ct/unifi/db/init# ls init-mongo.js root@network:/opt/ct/unifi/db/init# cat init-mongo.js db.getSiblingDB("unifi").createUser({user: "unifi", pwd: "unifi", roles: [{role: "dbOwner", db: "unifi"}]}); db.getSiblingDB("unifi_stat").createUser({user: "unifi", pwd: "unifi", roles: [{role: "dbOwner", db: "unifi_stat"}]}); root@network:/opt/ct/unifi/db/init#

I Deploy:

Log Controller

[migrations] started
[migrations] no migrations found
───────────────────────────────────────
      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝
   Brought to you by linuxserver.io
───────────────────────────────────────
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID:    1001
User GID:    1001
───────────────────────────────────────
*** Waiting for MONGO_HOST unifi-db to be reachable. ***
Generating 4,096 bit RSA key pair and self-signed certificate (SHA384withRSA) with a validity of 3,650 days
    for: CN=unifi
[custom-init] No custom files found, skipping...

Serverlog:

same....

[2024-02-01 12:55:59,450] <launcher> INFO  db     - db connection established...
[2024-02-01 12:55:59,976] <launcher> ERROR db     - Got error while connecting to db: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='unifi', source='unifi', password=<hidden>, mechanismProperties=<hidden>}
[2024-02-01 12:56:00,477] <launcher> INFO  db     - db connection established...
[2024-02-01 12:56:00,999] <launcher> ERROR db     - Got error while connecting to db: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='unifi', source='unifi', password=<hidden>, mechanismProperties=<hidden>}
[2024-02-01 12:56:01,500] <launcher> INFO  db     - db connection established...
drizuid commented 4 months ago

You are welcome to test whatever you like. The docs work for thousands of other people just fine. I would suggest that if you need further assistance, you visit discord to ask for help as a github issue is not the appropriate place to seek guidance.

As a note, we do not support or recommend using portainer to deploy our containers. https://docs.linuxserver.io/misc/support-policy/