Closed myazaki closed 11 months ago
Have you confirmed your mongo db container is running correctly?
Have you confirmed your mongo db container is running correctly?
It does not seem to be any issue there at least from the logs.
If you restart the unifi container after my mongodb has started up, does it work?
If you restart the unifi container after my mongodb has started up, does it work?
That is something which came to my mind too once I got to the thread where this topic was discussed. Tried that and did not helped and it did not help with the config above as well. Still the same error in unifi-app log *** Defined MONGO_HOST unifi-db is not reachable, cannot proceed. ***
I also checked the password special characters thread, so I made sure the password for MongoDB only includes upper and lower case alphabet characters and numbers to prevent some encoding problems.
I'm having the exact same issue and seem to have done everything correctly.
Same issue here, when trying to setup the new container to ensure I can keep moving forward with updates in 2024. The whole MongonDB thing makes little sense currently how to get it work with this new Unifi docker stuff.
I had the same issue but got it working with the following docker-compose.yml
on a Synology DS1019+ (only changed the password to something else):
---
version: "2.1"
services:
unifi-network-application:
image: lscr.io/linuxserver/unifi-network-application:latest
container_name: unifi-network-application
depends_on:
- unifi-db
environment:
- PUID=1026
- PGID=101
- TZ=Europe/Amsterdam
- MONGO_USER=unifi
- MONGO_PASS=unifi
- 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:
- ./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
unifi-db:
# WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
image: docker.io/mongo:4
container_name: unifi-db
volumes:
- ./mongodb/data:/data/db
- ./mongodb/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "mongo", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 10s
retries: 5
start_period: 20s
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"}]})
And I imported a backup from my old 7.3 controller, it seems to work fine.
I had the same issue but got it working with the following
docker-compose.yml
on a Synology DS1019+ (only changed the password to something else):--- version: "2.1" services: unifi-network-application: image: lscr.io/linuxserver/unifi-network-application:latest container_name: unifi-network-application depends_on: - unifi-db environment: - PUID=1026 - PGID=101 - TZ=Europe/Amsterdam - MONGO_USER=unifi - MONGO_PASS=unifi - 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: - ./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 unifi-db: # WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that! image: docker.io/mongo:4 container_name: unifi-db volumes: - ./mongodb/data:/data/db - ./mongodb/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro restart: unless-stopped healthcheck: test: ["CMD", "mongo", "--eval", "db.adminCommand('ping')"] interval: 10s timeout: 10s retries: 5 start_period: 20s
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"}]})
And I imported a backup from my old 7.3 controller, it seems to work fine.
That just worked for me, thanks a lot!
I had the same issue but got it working with the following
docker-compose.yml
on a Synology DS1019+ (only changed the password to something else):--- version: "2.1" services: unifi-network-application: image: lscr.io/linuxserver/unifi-network-application:latest container_name: unifi-network-application depends_on: - unifi-db environment: - PUID=1026 - PGID=101 - TZ=Europe/Amsterdam - MONGO_USER=unifi - MONGO_PASS=unifi - 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: - ./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 unifi-db: # WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that! image: docker.io/mongo:4 container_name: unifi-db volumes: - ./mongodb/data:/data/db - ./mongodb/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro restart: unless-stopped healthcheck: test: ["CMD", "mongo", "--eval", "db.adminCommand('ping')"] interval: 10s timeout: 10s retries: 5 start_period: 20s
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"}]})
And I imported a backup from my old 7.3 controller, it seems to work fine.
So you just replaced the password and that is it?
So you just replaced the password and that is it?
Sorry, I meant the password in the docker-compose.yml
is not the one I actually use. Just make sure it is the same as in the init-mongo.js
file.
And also make sure to use the correct PUID
and PGID
values, see the docs for more info.
So you just replaced the password and that is it?
Sorry, I meant the password in the
docker-compose.yml
is not the one I actually use. Just make sure it is the same as in theinit-mongo.js
file. And also make sure to use the correctPUID
andPGID
values, see the docs for more info.
Hi thanx, so far not much successful. I noticed only (correct me if I am wrong) 4 differences you have in you compose file comparing to mine.
PUID
& PGID
- Changed that to reflect my local settings on Synology, it did not make any changes.PUID
& GUID
set to 1000 and did not help. I will retest it with new PUID
& PGID
. So I tested all above and did not get into any working solution. I am still on the same MongoDB not reachable.
Gave up trying. This pushed me to investigate installation of the app natively on RPi4. And to my surprise it went flawlessly. It took around 2 minutes.
Gave up trying. This pushed me to investigate installation of the app natively on RPi4. And to my surprise it went flawlessly. It took around 2 minutes.
Same, but I tried this instead, works well! https://github.com/jacobalberty/unifi-docker
Is it possible to connect to a standalone instance of mongodb? how?
Is it possible to connect to a standalone instance of mongodb? how?
yes it is possible, but I believe it is not scope of this repo.
Is it possible to connect to a standalone instance of mongodb? how?
yes it is possible, but I believe it is not scope of this repo.
I've found that the standalone instance is not reachable too,it's confusing
this solution worked for me as well. One thing that might not be obvious is that the author has put both mongo and unifi network manager in the same docker compose so you dont need to start another docker container which is what I was attempting to do previously. Also, i recommend starting the container the first time with out -d e.g. docker-compose up
. Then you will see all of the live logs. One thing that caught me is I went to the https://ip:8443 and got a 404 error. But then I noticed in the logs 30s later that the container was still building the database. If you wait a good 3-4 mins (at least on the mac mini I am using) then it comes up. I actually had the same issue with the https://github.com/jacobalberty/unifi-docker solution.
A bit late to the party, but seeing you are using Synology, perhaps you have enabled Firewall? This thing does pretty good job at stopping incoming connections even when containers are on the same subnet.
Select your Docker unifi-db
listed under applications and in source IP input your unifi-net
subnet made by docker. This will permit anything in unifi-net
network to access unifi-db
container. (Since it's just unifi-network-application
you might as well just go with single IP rule or perhaps even 27017 port rule)
A bit late to the party, but seeing you are using Synology, perhaps you have enabled Firewall? This thing does pretty good job at stopping incoming connections even when containers are on the same subnet.
Select your
Docker unifi-db
listed under applications and in source IP input yourunifi-net
subnet made by docker. This will permit anything inunifi-net
network to accessunifi-db
container. (Since it's justunifi-network-application
you might as well just go with single IP rule or perhaps even 27017 port rule)
Hi @Xeevis good catch. It did the trick. It did not came to my mind as I am having similar setup for other application (two containers deployed from one docker compose file in Portainer using default bridged network settings). It is not allowed in Synology Firewall, but it works, both containers are communicating on the same network.
So, I freshly deployed the unifi-network-application
docker compose file once again in Portainer, it of course resulted into the same error. So I allowed the unifi-net
subnet access in Synology firewall, restarted unifi-app
and it connected to MongoDB. It just took about 3-5 minutes for unifi-app
to initialise (showing 404 error in the browser) itself for the first time. Many thanks!
Glad you got it working👍. Docker implementation by Synology sometimes works in strange ways. Bridged network might be whitelisted by default while custom networks are unknown to the code and firewall won't permit any cross-container communication.
Also watch out for changing IPs, just stopped/started stack in Portainer and it recreated the network and changed the subnet IP.
Glad you got it working👍. Docker implementation by Synology sometimes works in strange ways. Bridged network might be whitelisted by default while custom networks are unknown to the code and firewall won't permit any cross-container communication.
Also watch out for changing IPs, just stopped/started stack in Portainer and it recreated the network and changed the subnet IP.
Good to know definitely for other Docker deployments on Synology as well 👍. Anyway, I gave up on this setup and transitioned to RPi4 install. Btw not easy too, as you need to figure out yourself that it won't work on MongoDB 4.4.19 and higher due to processor requirements. Now waiting for my UDM-SE device, so will drop the RPi4 install as well.
Anyway, I gave up on this setup and transitioned to RPi4 install. Btw not easy too, as you need to figure out yourself that it won't work on MongoDB 4.4.19 and higher due to processor requirements. Now waiting for my UDM-SE device, so will drop the RPi4 install as well.
AVX support is a requirement from MongoDB 5.0+ and as stated in README.md formally only mongodb 3.6 through 4.4 are supported by this repository, so it shouldn't be an issue for the time being. UDM is one way to solve this, but quite pricey too and I'm not aware of any benefits for SOHO application where I have couple Lite APs, PoE switches and UXG-Lite gateway.
Anyway, I gave up on this setup and transitioned to RPi4 install. Btw not easy too, as you need to figure out yourself that it won't work on MongoDB 4.4.19 and higher due to processor requirements. Now waiting for my UDM-SE device, so will drop the RPi4 install as well.
AVX support is a requirement from MongoDB 5.0+ and as stated in README.md formally only mongodb 3.6 through 4.4 are supported by this repository, so it shouldn't be an issue for the time being. UDM is one way to solve this, but quite pricey too and I'm not aware of any benefits for SOHO application where I have couple Lite APs, PoE switches and UXG-Lite gateway.
I am aware about AVX requirement for MongoDB 5.0+. But there seems to be also ARMv8.2-A requirement for mongo 4.4.19 and higher. That is why 4.4.18 version is the last one working on RPi4. It is also mentioned here https://github.com/linuxserver/docker-unifi-network-application/issues/4. You are of course right mentioning only the small benefits of using UDM in SOHO application, it is a matter of personal preference.
A bit late to the party, but seeing you are using Synology, perhaps you have enabled Firewall? This thing does pretty good job at stopping incoming connections even when containers are on the same subnet.
Select your
Docker unifi-db
listed under applications and in source IP input yourunifi-net
subnet made by docker. This will permit anything inunifi-net
network to accessunifi-db
container. (Since it's justunifi-network-application
you might as well just go with single IP rule or perhaps even 27017 port rule)
I also got it working. Thanks to Xeevis. That is the Synology Firewall problem.
Is there an existing issue for this?
Current Behavior
Hello, I am trying to migrate from Controller which will be EOL in Jan 2024 to this new version and I am having following error
*** Defined MONGO_HOST unifi-db is not reachable, cannot proceed. ***
in the unifi-app container log. unifi-db is running just fine no errors in the log -> user, DBs etc created just fine. Web UI on https://ip:8443 gives "This site can’t be reached" ERR_CONNECTION_CLOSED.docker-compose.yml
andinit-mongo.js
files below. I browsed all the issues back and forth and could not get into any working config for me. Any ideas what I am doing wrong?docker-compose.yml file
init-mongo.js
Expected Behavior
unif-app conects to unifi-db and Web-UI is loaded.
Steps To Reproduce
*** Defined MONGO_HOST unifi-db is not reachable, cannot proceed. ***
in container Logs.Environment
CPU architecture
x86-64
Docker creation
Container logs