typegoose/mongodb-memory-server

Can't connect to dockerized mongodb-memory-server replica set running as a service in GitLab

Open

#815 geöffnet am 18. Okt. 2023

Auf GitHub ansehen
 (11 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (188 Forks)github user discovery
help wantedquestion

Repository-Metriken

Stars
 (2.828 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

NodeJS: 18 mongodb-memory-server-*: 9.0.1 mongodb(the binary version): ? mongodb(the js package): 6.1.0 system: Linux / Docker package: mongo-memory-server

What is your question?

I wonder if there is any mongodb-memory-server configuration that might be involved in the fact that I can't connect to the server when running within a docker container as a GitLab CI/CD service in a pipeline's job.

I created this question in StackOverflow with full details https://stackoverflow.com/q/77315673/2948212 but basically I have dockerized the application here https://gitlab.com/sunnyatticsoftware/mongodb-rs binding IPs to all and using a replica set, and it's all good when I test it locally

docker run --name mongodbrs -p 27017:27017 registry.gitlab.com/sunnyatticsoftware/mongodb-rs

and I can properly connect to mongodb://127.0.0.1:27017/?replicaSet=rs0

And it's also good when I run the docker container and I connect to the application through a hostname alias like mongors where there is an entry on my /etc/hosts pointing mongors to 127.0.0.1 so that I can use connection string

mongodb://mongors:27017/?replicaSet=rs0

But in GitLab CI/CD the connectivity fails. See https://gitlab.com/sunnyatticsoftware/mongodb-rs-tester/-/jobs/5319052214

Is this something related to mongodb-memory-server configuration?

Contributor Guide