Mongodb replica sets in .gitlab-ci.yml

I was not able to set up replica sets for mongodb in gitlab ci while locally replica sets it ran successfully. How do I modify .gitlab-ci.yml file to make it work in my gitlab pipeline?

Locally I am running 3 mongodb for replica sets following the official instructions. I am replicating the same steps in gitlab ci. I have created 3 config files for each mongodb and make them alias in services. How do I install mongo and execute mongo , rs.initiate like step 2 and 3 in the instructions?

services: - name: mongo:latest alias: mongo_1 command: ["mongod","--config", "./mongodb_replica_sets/configs/mongod_1.conf"] - name: mongo:latest alias: mongo_2 command: ["mongod","--config", "./mongodb_replica_sets/configs/mongod_2.conf"] - name: mongo:latest alias: mongo_3 command: ["mongod","--config", "./mongodb_replica_sets/configs/mongod_3.conf"]

1 Like

Did you find any solution to it?

is there any solution for this?

i want exec rs.initiate() too

1 Like

Did you find any solution for this?

I have find a way to resolve this. see my opened issue: Failed to deploy mongoDB replica set with 3 mongo containers with gitlab ci service (#333636) · Issues · GitLab.org / GitLab · GitLab

see my opened issue: Failed to deploy mongoDB replica set with 3 mongo containers with gitlab ci service (#333636) · Issues · GitLab.org / GitLab · GitLab