On-Prem Charts installation: Failed to test connection to metadata DB

I’m trying to install Charts on a Ubuntu 20.4 GCP instance with port 80 and 443 open. I’ve installed the metadata MongoDB on the same instance, binding ip to 0.0.0.0 and enabling authentication. Connecting to the metadata DB with the root DB user and performing “show dbs” using “mongo” works locally.

However, I’m currently unable to connect to the metadata DB using the test script:

docker run --rm Quay charts-cli test-connection ‘mongodb://user:pwd@127.17.0.1:27017/?authSource=admin’

This is the error response. I’ve spent 1-2 days and can’t get Charts to work :frowning:

Unable to connect to MongoDB using the specified URI.
The following error was returned while attempting to connect:
MongoNetworkError: failed to connect to server [127.17.0.1:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.17.0.1:27017]
The result from pinging the specified server “127.17.0.1” from within the container is:
PING 127.17.0.1 (127.17.0.1) 56(84) bytes of data.
64 bytes from 127.17.0.1: icmp_seq=1 ttl=64 time=0.026 ms
— 127.17.0.1 ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.026/0.026/0.026/0.000 ms
Possible reasons for this error include:
- The hostname you specified is incorrect
- MongoDB is not running on the server
- The Docker container was unable to resolve the hostname specified in the URI
- The Docker container was unable to resolve the hostnames of replica set members as configured on the server
Things you can try:
- Check that the hostname is correct and MongoDB is running on the host.
- Try connecting using the host IP address instead of the hostname. This may require changes to your mongod or replica set configuration
- Configure Docker to use a custom DNS server that can resolve the hostname. For example, if your DNS server is 1.2.3.4:
- As a parameter to this “docker run” command, add the following after -it: --dns=1.2.3.4
- After successfully validating the connection, in the Docker Compose file for launching Charts, add this line as a child of charts: dns: 1.2.3.4
- Configure Docker with explicit mappings between hostnames and IP addresses. For example if the host “myhost1” is reachable at 4.3.2.1 and “myhost2” is reachable at 4.3.2.2:
- As a parameter to this “docker run” command, add the following after -it: --add-host myhost1:4.3.2.1 --add-host myhost2:4.3.2.2
- After successfully validating the connection, in the Docker Compose file for launching Charts, add these lines as a child of charts:
extra_hosts:
- “myhost1:4.3.2.1”
- “myhost2:4.3.2.2”

Any idea would be super appreciated :cry:

Hello Minh,

Are you sure that IP is correct in the connection-uri? I think for standard Linux installation it should be : 172.17.0.1