linuxserver / docker-unifi-network-application

GNU General Public License v3.0
553 stars 41 forks source link

[BUG] Unable to load unifi network application webpage #17

Closed hnjoshi closed 9 months ago

hnjoshi commented 9 months ago

Is there an existing issue for this?

Current Behavior

Unable to start the server.

hnjoshi@cosmos:~/docker/compose/unifi-network-application$ docker-compose up
[+] Running 1/0
 ✔ Container unifi-network-application  Created                                                                                                                                                                                                                            0.0s
Attaching to unifi-network-application
unifi-network-application  | [migrations] started
unifi-network-application  | [migrations] no migrations found
unifi-network-application  | usermod: no changes
unifi-network-application  | ───────────────────────────────────────
unifi-network-application  |
unifi-network-application  |       ██╗     ███████╗██╗ ██████╗
unifi-network-application  |       ██║     ██╔════╝██║██╔═══██╗
unifi-network-application  |       ██║     ███████╗██║██║   ██║
unifi-network-application  |       ██║     ╚════██║██║██║   ██║
unifi-network-application  |       ███████╗███████║██║╚██████╔╝
unifi-network-application  |       ╚══════╝╚══════╝╚═╝ ╚═════╝
unifi-network-application  |
unifi-network-application  |    Brought to you by linuxserver.io
unifi-network-application  | ───────────────────────────────────────
unifi-network-application  |
unifi-network-application  | To support LSIO projects visit:
unifi-network-application  | https://www.linuxserver.io/donate/
unifi-network-application  |
unifi-network-application  | ───────────────────────────────────────
unifi-network-application  | GID/UID
unifi-network-application  | ───────────────────────────────────────
unifi-network-application  |
unifi-network-application  | User UID:    1000
unifi-network-application  | User GID:    1000
unifi-network-application  | ───────────────────────────────────────
unifi-network-application  |
unifi-network-application  | [custom-init] No custom files found, skipping...
unifi-network-application  | 14:25:21,304 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Could NOT configuration file [/usr/lib/unifi/logback-access.xml] using property "catalina.base"
unifi-network-application  | 14:25:21,304 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Could NOT configuration file [/usr/lib/unifi/logback-access.xml] using property "catalina.home"
unifi-network-application  | 14:25:21,304 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Found [logback-access.xml] as a resource.
unifi-network-application  | 14:25:21,305 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@327ed9f5 - URL [jar:file:/usr/lib/unifi/lib/ace.jar!/logback-access.xml] is not of type file
unifi-network-application  | 14:25:21,317 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - debug attribute not set
unifi-network-application  | 14:25:21,317 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
unifi-network-application  | 14:25:21,317 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [access_log]
unifi-network-application  | 14:25:21,318 |-INFO in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@67594471 - No compression will be used
unifi-network-application  | 14:25:21,319 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.access.PatternLayoutEncoder] for [encoder] property
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[access_log] - Active log file name: logs/access.log
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[access_log] - File property is set to [logs/access.log]
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [access_log] to ch.qos.logback.access.tomcat.LogbackValve[null]
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - End of configuration.
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.access.joran.JoranConfigurator@756b58a7 - Registering current configuration as safe fallback point
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Done configuring

Trying to hit https://192.168.1.200:8443/ will give error message "HTTP status 404 not found"

Expected Behavior

After the line

unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Done configuring

usually there is one more line that says done in unifi-controller image before the webpage can load fine.

Steps To Reproduce

  1. Create a docker-compose.yml with following content
    
    ---
    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=America/Chicago
      - MONGO_USER=unifi
      - MONGO_PASS=unifi-mongo
      - MONGO_HOST=unifi-db
      - MONGO_PORT=27017
      - MONGO_DBNAME=unifi
      - MEM_LIMIT=2048 #optional
      - MEM_STARTUP=1024 #optional
    volumes:
      - /home/hnjoshi/docker/unifi:/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
2. run `docker-compose up`

Check logs or try load the unifi webpage on port 8443.
Notice no webpage.

### Environment

```markdown
- OS:Ubuntu
- How docker service was installed: command line

CPU architecture

x86-64

Docker creation

docker-compose up

Container logs

hnjoshi@cosmos:~/docker/compose/unifi-network-application$ docker-compose up
[+] Running 1/0
 ✔ Container unifi-network-application  Created                                                                                                                                                                                                                            0.0s
Attaching to unifi-network-application
unifi-network-application  | [migrations] started
unifi-network-application  | [migrations] no migrations found
unifi-network-application  | usermod: no changes
unifi-network-application  | ───────────────────────────────────────
unifi-network-application  |
unifi-network-application  |       ██╗     ███████╗██╗ ██████╗
unifi-network-application  |       ██║     ██╔════╝██║██╔═══██╗
unifi-network-application  |       ██║     ███████╗██║██║   ██║
unifi-network-application  |       ██║     ╚════██║██║██║   ██║
unifi-network-application  |       ███████╗███████║██║╚██████╔╝
unifi-network-application  |       ╚══════╝╚══════╝╚═╝ ╚═════╝
unifi-network-application  |
unifi-network-application  |    Brought to you by linuxserver.io
unifi-network-application  | ───────────────────────────────────────
unifi-network-application  |
unifi-network-application  | To support LSIO projects visit:
unifi-network-application  | https://www.linuxserver.io/donate/
unifi-network-application  |
unifi-network-application  | ───────────────────────────────────────
unifi-network-application  | GID/UID
unifi-network-application  | ───────────────────────────────────────
unifi-network-application  |
unifi-network-application  | User UID:    1000
unifi-network-application  | User GID:    1000
unifi-network-application  | ───────────────────────────────────────
unifi-network-application  |
unifi-network-application  | [custom-init] No custom files found, skipping...
unifi-network-application  | 14:25:21,304 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Could NOT configuration file [/usr/lib/unifi/logback-access.xml] using property "catalina.base"
unifi-network-application  | 14:25:21,304 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Could NOT configuration file [/usr/lib/unifi/logback-access.xml] using property "catalina.home"
unifi-network-application  | 14:25:21,304 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Found [logback-access.xml] as a resource.
unifi-network-application  | 14:25:21,305 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@327ed9f5 - URL [jar:file:/usr/lib/unifi/lib/ace.jar!/logback-access.xml] is not of type file
unifi-network-application  | 14:25:21,317 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - debug attribute not set
unifi-network-application  | 14:25:21,317 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
unifi-network-application  | 14:25:21,317 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [access_log]
unifi-network-application  | 14:25:21,318 |-INFO in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@67594471 - No compression will be used
unifi-network-application  | 14:25:21,319 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.access.PatternLayoutEncoder] for [encoder] property
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[access_log] - Active log file name: logs/access.log
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[access_log] - File property is set to [logs/access.log]
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [access_log] to ch.qos.logback.access.tomcat.LogbackValve[null]
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - End of configuration.
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.access.joran.JoranConfigurator@756b58a7 - Registering current configuration as safe fallback point
unifi-network-application  | 14:25:21,326 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Done configuring
github-actions[bot] commented 9 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.

j0nnymoe commented 9 months ago

Did you setup the mongodb correctly?

hnjoshi commented 9 months ago

No I didn't seutp mongodb separately. Any steps how to setup? will be container as well?

I will give it a try and come back. thank you for quick response.

j0nnymoe commented 9 months ago

Grab the compose for the mongodb from their documentation and follow the instructions in our application setup section.

hnjoshi commented 9 months ago

@j0nnymoe

I am not familier with mongodb and docker but here is what i have in the files init-mongo.js and mongo docker compose:

hnjoshi@cosmos:~/sm-usb/docker/compose/mongo$ cat init-mongo.js
db.getSiblingDB("unifi").createUser({user: "unifi", pwd: "unifi4home", roles: [{role: "readWrite", db: "unifi"}]});
db.getSiblingDB("unifi_stat").createUser({user: "unifi", pwd: "unifi4home", roles: [{role: "readWrite", db: "unifi_stat"}]});

hnjoshi@cosmos:~/sm-usb/docker/compose/mongo$ cat docker-compose.yml
version: '4.4'

services:
    mongodb:
        image: mongo:4.4.18
        container_name: mongodb
        restart: always
        environment:
            MONGO_INITDB_ROOT_USERNAME: <admin-user>
            MONGO_INITDB_ROOT_PASSWORD: <admin-password>
            MONGO_INITDB_DATABASE: <database to create>
        ports:
            - 27017:27017
        volumes:
            - ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro

hnjoshi@cosmos:~/sm-usb/docker/compose/mongo$
  1. do I need remove those environment variables as I am passing init-mongo entrypoint?
  2. do I need mongo express section in compose file? If yes please guide me on the environment section.
mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8081:8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: example
      ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/

Also here is what my unifi network application docker compose file look like:

 hnjoshi@cosmos:~/sm-usb/docker/compose/unifi-network-application$ cat docker-compose.yml
---
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=America/Chicago
      - MONGO_USER=unifi
      - MONGO_PASS=unifi4home
      - MONGO_HOST=unifi-db
      - MONGO_PORT=27017
      - MONGO_DBNAME=unifi
      - MEM_LIMIT=2048 #optional
      - MEM_STARTUP=1024 #optional
    volumes:
      - /home/hnjoshi/sm-usb/docker/volumes/unifi:/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

I am getting close with your help. Really appreciate for your help in advance. Thank you.

aptalca commented 9 months ago

do I need remove those environment variables as I am passing init-mongo entrypoint?

Yes, as described in the readme

do I need mongo express section in compose file? If yes please guide me on the environment section.

No, you don't need mongo-express

hnjoshi commented 9 months ago

Ok so i removed the environment section as entry point is passed for mongo.

Here is what the files looks like now:

hnjoshi@cosmos:~/sm-usb/docker/compose/unifi-network-application$hnjoshi@cosmos:~/sm-usb/docker/compose/unifi-network-application$ cat ../mongo/init-mongo.js
db.getSiblingDB("unifi").createUser({user: "unifi", pwd: "unifi4home", roles: [{role: "readWrite", db: "unifi"}]});
db.getSiblingDB("unifi_stat").createUser({user: "unifi", pwd: "unifi4home", roles: [{role: "readWrite", db: "unifi_stat"}]});

hnjoshi@cosmos:~/sm-usb/docker/compose/unifi-network-application$ cat ../mongo/docker-compose.yml
version: '4.4'

services:
    mongodb:
        image: mongo:4.4.18
        container_name: mongodb
        restart: always
        ports:
            - 27017:27017
        volumes:
            - ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro

hnjoshi@cosmos:~/sm-usb/docker/compose/unifi-network-application$ cat docker-compose.yml
---
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=America/Chicago
      - MONGO_USER=unifi
      - MONGO_PASS=unifi4home
      - MONGO_HOST=unifi-db
      - MONGO_PORT=27017
      - MONGO_DBNAME=unifi
      - MEM_LIMIT=2048 #optional
      - MEM_STARTUP=1024 #optional
    volumes:
      - /home/hnjoshi/sm-usb/docker/volumes/unifi:/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

hnjoshi@cosmos:~/sm-usb/docker/compose/unifi-network-application$

Unifi logs still stuck at following:

14:49:49,265 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[access_log] - File property is set to [logs/access.log]
14:49:49,265 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [access_log] to ch.qos.logback.access.tomcat.LogbackValve[null]
14:49:49,265 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - End of configuration.
14:49:49,265 |-INFO in ch.qos.logback.access.joran.JoranConfigurator@756b58a7 - Registering current configuration as safe fallback point
14:49:49,265 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Done configuring

Not seeing that last line that says done. Not able to load UI yet for unifi network application.

Command used to bring up mongo db: docker-compose up --build -d mongodb

Command used to bring up unifi network application: docker-compose up -d

Can someone please guide what am I doing wrong here? It seems unifi is till unable to talk to mongodb

hnjoshi commented 9 months ago

mongodb log looks like following:

t={"$date":"2023-09-24T19:48:16.908+00:00"} s=I c=STORAGE id=20536 ctx=initandlisten msg=Flow Control is enabled on this deployment
t={"$date":"2023-09-24T19:48:16.912+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":"2023-09-24T19:48:16.912+00:00"} s=I c=REPL id=6015317 ctx=initandlisten msg=Setting new configuration state attr={"newState":"ConfigReplicationDisabled","oldState":"ConfigPreStart"}
t={"$date":"2023-09-24T19:48:16.913+00:00"} s=I c=NETWORK id=23015 ctx=listener msg=Listening on attr={"address":"/tmp/mongodb-27017.sock"}
t={"$date":"2023-09-24T19:48:16.914+00:00"} s=I c=NETWORK id=23015 ctx=listener msg=Listening on attr={"address":"0.0.0.0"}
t={"$date":"2023-09-24T19:48:16.914+00:00"} s=I c=NETWORK id=23016 ctx=listener msg=Waiting for connections attr={"port":27017,"ssl":"off"}

date":"2023-09-24T19:48:17.041+00:00"},"s":"I",  "c":"FTDC",     "id":20631,   "ctx":"ftdc","msg":"Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost","attr":{"error":{"code":0,"codeName":"OK"}}}
t={"$date":"2023-09-24T19:49:16.883+00:00"} s=I c=STORAGE id=22430 ctx=WTCheckpointThread msg=WiredTiger message attr={"message":"[1695584956:883244][1:0x7f0504d71700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 5, snapshot max: 5 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 142"}
aptalca commented 9 months ago

You need a persistent folder for your mongodb data otherwise you will lose the entire database when the container is recreated.

Also, don't use relative paths in compose. Always use absolute paths so you know exactly what they refer to and the context never changes.

hnjoshi commented 9 months ago

As per suggestion I have updated the compose file using absolute path and recreated the mongo container.

hnjoshi@cosmos:~/sm-usb/docker/compose/mongo$ cat docker-compose.yml
version: '4.4'

services:
    mongodb:
        image: mongo:4.4.18
        container_name: mongodb
        restart: always
        ports:
            - 27017:27017
        volumes:
            - /home/hnjoshi/sm-usb/docker/compose/mongo/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
            - /home/hnjoshi/sm-usb/docker/volumes/mongo/db:/data/db
            - /home/hnjoshi/sm-usb/docker/volumes/mongo/configdb:/data/configdb

Any suggestion why unifi network application still not loading webpage? I continue to see following: image

hnjoshi commented 9 months ago

Update:

root@2583a6f282b6:/# ls
bin  boot  data  dev  docker-entrypoint-initdb.d  etc  home  js-yaml.js  lib  lib32  lib64  libx32  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@2583a6f282b6:/# mongo
MongoDB shell version v4.4.18
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("2900bf0f-e967-452b-9d95-fa19bd6ce2c3") }
MongoDB server version: 4.4.18
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
    https://docs.mongodb.com/
Questions? Try the MongoDB Developer Community Forums
    https://community.mongodb.com
---
The server generated these startup warnings when booting:
        2023-09-24T20:18:25.900+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
        2023-09-24T20:18:27.097+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
---
---
        Enable MongoDB's free cloud-based monitoring service, which will then receive and display
        metrics about your deployment (disk utilization, CPU, operation statistics, etc).

        The monitoring data will be available on a MongoDB website with a unique URL accessible to you
        and anyone you share the URL with. MongoDB may use this information to make product
        improvements and to suggest MongoDB products and deployment options to you.

        To enable free monitoring, run the following command: db.enableFreeMonitoring()
        To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
> show databases
admin   0.000GB
config  0.000GB
local   0.000GB
> use unifi
switched to db unifi
> show collections
>

Unifi db is not configured as expected.

hnjoshi commented 9 months ago

I am going to give this a try: https://github.com/linuxserver/docker-unifi-network-application/issues/8#issuecomment-1719926682

hnjoshi commented 9 months ago

My issue was resolved. Thank you!!!