typegoose / typegoose/mongodb-memory-server

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

Open
#815 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted question
Dominant language
TypeScript
Stars
2.8k
Forks
191
Avg merge
4h 25m
Merged PRs (30d)
10

Description

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Stack Overflow question and GitLab job 5319052214, then compare the working local Docker command with the GitLab CI/CD service setup and replica-set connection hostname. Done means determining whether mongodb-memory-server configuration is involved and documenting a reproducible connection setup or a clear external cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, gitlab, mongodb, nodejs
Domain
ci-cd, databases, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.