Skip to content

Wrong check connection in connecton retry #115

@rtritto

Description

@rtritto

How to reproduce

Run the image.

Actual behavior

Even if ME_CONFIG_MONGODB_URL env var is correct, in docker-entrypoint.sh the connection check fails, and the connection retry starts until the end of all tries (10 by default). After the retries, the server starts correcly.

Pattern of placeholder <CLUSTER>: cluster0-<CLUSTER_ID>.mongodb.net

Waiting for <CLUSTER>:<PORT>...
/docker-entrypoint.sh: line 15: <CLUSTER>: Name has no usable address
/docker-entrypoint.sh: line 15: /dev/tcp/<CLUSTER>/<PORT>: Invalid argument
Sun Jan  7 01:47:59 UTC 2024 retrying to connect to <CLUSTER>:<PORT> (2/10)
/docker-entrypoint.sh: line 15: <CLUSTER>: Name has no usable address
/docker-entrypoint.sh: line 15: /dev/tcp/<CLUSTER>/<PORT>: Invalid argument
Sun Jan  7 01:48:01 UTC 2024 retrying to connect to <CLUSTER>:<PORT> (3/10)
...
/docker-entrypoint.sh: line 15: <CLUSTER>: Name has no usable address
/docker-entrypoint.sh: line 15: /dev/tcp/<CLUSTER>/<PORT>: Invalid argument
Sun Jan  7 01:48:08 UTC 2024 retrying to connect to <CLUSTER>:<PORT> (10/10)
/docker-entrypoint.sh: line 15: <CLUSTER>: Name has no usable address
/docker-entrypoint.sh: line 15: /dev/tcp/<CLUSTER>/<PORT>: Invalid argument
No custom config.js found, loading config.default.js
Welcome to mongo-express 1.0.2
------------------------


Mongo Express server listening at http://0.0.0.0:8081
Server is open to allow connections from anyone (0.0.0.0)

Expected behavior

After the first connection check, the server starts without any connection retry.

Possible solution

In docker-entrypoint.sh change the code:

exec 6<>/dev/tcp/$host/$port

Documentations/guides:

Issues

Related (?): #49
Similr errors but with ME_CONFIG_MONGODB_SERVER instead of ME_CONFIG_MONGODB_URL: #21
Code introduced with: #12
Code commented with: #65

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions