# Dashboard container doesn't work

**URL:** <https://openvidu.discourse.group/t/dashboard-container-doesnt-work/5272>\
**Category:** Issues with deployments\
**Created:** [January 18, 2025, 5:56pm UTC](https://openvidu.discourse.group/t/dashboard-container-doesnt-work/5272 "2025-01-18T17:56:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![KinDo](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/kindo/32/2524_2.png) [@KinDo](https://openvidu.discourse.group/u/KinDo)\
**Post date:** [January 18, 2025, 5:56pm UTC](https://openvidu.discourse.group/t/dashboard-container-doesnt-work/5272/1 "2025-01-18T17:56:03Z")

</div>

Hello Team,

I hope this message finds you well. Congratulations on the launch of OpenVidu version 3! I am excited about the updates and am currently in the process of deploying the new version as a single node on-premises, following the instructions from [OpenVidu Single Node installation on-premises - openVidu](https://openvidu.io/latest/docs/self-hosting/single-node/on-premises/install/).

However, I am encountering an issue with the dashboard container. When I initiate the deployment using the command `systemctl start openvidu`, the process initially runs smoothly. Unfortunately, the dashboard container does not maintain stability and restarts every 30 seconds. This repetitive restarting happens without fail—30 seconds of uptime followed by a restart.

Upon examining the logs via `docker logs -f dashboard`, the primary error seems to be related to a connection failure with MongoDB. Here is the pertinent log information:

```auto
2025-01-16 19:59:35.461 info: Pinging MongoDB...
2025-01-16 20:00:05.469 error: Error while trying to connect to MongoDB: connect ECONNREFUSED ::1:20000
{"reason":{"type":"Unknown","servers":{"localhost:20000":{"address":"localhost:20000","type":"Unknown","hosts":[],"passives":[],"arbiters":[],"tags":{},"minWireVersion":0,"maxWireVersion":0,"roundTripTime":-1,"minRoundTripTime":0,"lastUpdateTime":46050652,"lastWriteDate":0,"error":{},"topologyVersion":null,"setName":null,"setVersion":null,"electionId":null,"logicalSessionTimeoutMinutes":null,"maxMessageSizeBytes":null,"maxWriteBatchSize":null,"maxBsonObjectSize":null,"primary":null,"me":null,"$clusterTime":null,"iscryptd":false}},"stale":false,"compatible":true,"heartbeatFrequencyMS":10000,"localThresholdMS":15,"setName":null,"maxElectionId":null,"maxSetVersion":null,"commonWireVersion":0,"logicalSessionTimeoutMinutes":null},"cause":{}}
MongoServerSelectionError: connect ECONNREFUSED ::1:20000
    at Topology.selectServer (/snapshot/backend/node_modules/mongodb/lib/sdam/topology.js:320:38)
    at async Topology._connect (/snapshot/backend/node_modules/mongodb/lib/sdam/topology.js:204:28)
    at async Topology.connect (/snapshot/backend/node_modules/mongodb/lib/sdam/topology.js:156:13)
    at async topologyConnect (/snapshot/backend/node_modules/mongodb/lib/mongo_client.js:233:17)
    at async MongoClient._connect (/snapshot/backend/node_modules/mongodb/lib/mongo_client.js:246:13)
    at async MongoClient.connect (/snapshot/backend/node_modules/mongodb/lib/mongo_client.js:171:13)
2025-01-16 20:00:05.470 error: Shutting down OpenVidu Dashboard

```

Could you please assist me in resolving this issue? Any guidance on configuring MongoDB correctly or troubleshooting potential network issues that might be causing this connection refusal would be greatly appreciated.

Thank you for your support.

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [January 19, 2025, 12:38am UTC](https://openvidu.discourse.group/t/dashboard-container-doesnt-work/5272/2 "2025-01-19T00:38:10Z")

</div>

It looks like a network issue. Do you have IPv6 on your machine?

I think that `localhost` is being translated to `::1` instead of `127.0.0.1` which is causing that problem.

Can you confirm to me that changing this parameter in `/opt/openvidu/config/dashboard.env` fix the issue?

```auto
DATABASE_URL=mongodb://${openvidu.MONGO_ADMIN_USERNAME:?mandatory}:${openvidu.MONGO_ADMIN_PASSWORD:?mandatory}@127.0.0.1:${openvidu.MONGO_INTERNAL_PORT:?mandatory}/?replicaSet=rs0&readPreference=primaryPreferred

```

Simply change `localhost` to `127.0.0.1`

---

<div class="post-metadata">

**Author:** ![KinDo](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/kindo/32/2524_2.png) [@KinDo](https://openvidu.discourse.group/u/KinDo)\
**Post date:** [January 19, 2025, 6:29am UTC](https://openvidu.discourse.group/t/dashboard-container-doesnt-work/5272/3 "2025-01-19T06:29:42Z")

</div>

Yes, IPv6 is enabled on the machine. I’ve updated the `dashboard.env` as requested and then restarted OpenVidu using the command `systemctl restart openvidu`. However, I’m still facing the same issue:

```auto
2025-01-19 06:20:41.503 error: Error while trying to connect to MongoDB: connect ECONNREFUSED ::1:20000
{"reason":{"type":"ReplicaSetNoPrimary","servers":{"localhost:20000":{"address":"localhost:20000","type":"Unknown","hosts":[],"passives":[],"arbiters":[],"tags":{},"minWireVersion":0,"maxWireVersion":0,"roundTripTime":-1,"minRoundTripTime":0,"lastUpdateTime":256086701,"lastWriteDate":0,"error":{},"topologyVersion":null,"setName":null,"setVersion":null,"electionId":null,"logicalSessionTimeoutMinutes":null,"maxMessageSizeBytes":null,"maxWriteBatchSize":null,"maxBsonObjectSize":null,"primary":null,"me":null,"$clusterTime":null,"iscryptd":false}},"stale":false,"compatible":true,"heartbeatFrequencyMS":10000,"localThresholdMS":15,"setName":"rs0","maxElectionId":{"$oid":"7fffffff0000000000000004"},"maxSetVersion":1,"commonWireVersion":0,"logicalSessionTimeoutMinutes":null},"cause":{}}
MongoServerSelectionError: connect ECONNREFUSED ::1:20000
    at Topology.selectServer (/snapshot/backend/node_modules/mongodb/lib/sdam/topology.js:320:38)
    at async Topology._connect (/snapshot/backend/node_modules/mongodb/lib/sdam/topology.js:204:28)
    at async Topology.connect (/snapshot/backend/node_modules/mongodb/lib/sdam/topology.js:156:13)
    at async topologyConnect (/snapshot/backend/node_modules/mongodb/lib/mongo_client.js:233:17)
    at async MongoClient._connect (/snapshot/backend/node_modules/mongodb/lib/mongo_client.js:246:13)
    at async MongoClient.connect (/snapshot/backend/node_modules/mongodb/lib/mongo_client.js:171:13)
2025-01-19 06:20:41.504 error: Shutting down OpenVidu Dashboard

```

is it possbile that the issue with mongo container ?

---

<div class="post-metadata">

**Author:** ![KinDo](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/kindo/32/2524_2.png) [@KinDo](https://openvidu.discourse.group/u/KinDo)\
**Post date:** [January 19, 2025, 9:29am UTC](https://openvidu.discourse.group/t/dashboard-container-doesnt-work/5272/4 "2025-01-19T09:29:44Z")

</div>

**Hello**

I’ve tackled the MongoDB connection issue we were facing with OpenVidu v3. Here’s a quick rundown of what was fixed and how:

**What was wrong?**  
Our app was having a tough time connecting to MongoDB because it was trying to use `localhost` which wasn’t playing nice with our configuration.

**How we fixed it:**

1. **Updated `dashboard.env` File:**  
I adjusted the `DATABASE_URL` to make sure we’re connecting through the loopback IP address. Here’s the new setup:

2. **Tweaked `docker-compose.yaml`:**  
Switched the `MONGO_LOCAL_HOST` from `localhost` to `127.0.0.1`. Now it looks like this:

**Result:**  
These changes have gotten us back on track with a smooth connection to MongoDB.  
Thanks mr @cruizba for your kind support 😁

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [January 19, 2025, 5:01pm UTC](https://openvidu.discourse.group/t/dashboard-container-doesnt-work/5272/5 "2025-01-19T17:01:58Z")

</div>

Thanks for the heads up! It is clear that localhost is not very reliable, I think we will change to 127.0.0.1 in our deployments for this kind of local connections to avoid this problem with future users.
