4

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"]
iik
  • 73
  • 1
  • 9

0 Answers0