version: "3.7"

networks:
  mother:
    external: true

volumes:
  mongo0:
  
services:
  mongoprimary:
    image: registry.vnfco.ir/library/bitnami/mongodb:4.4.11-debian-10-r5
    volumes:
      - mongo0:/bitnami/mongodb
    environment:
      # - MONGODB_REPLICA_SET_MODE=primary
      # - MONGODB_REPLICA_SET_NAME=igrep
      - MONGODB_ADVERTISED_HOSTNAME=mongoprimary
      - MONGODB_ROOT_PASSWORD=cWv1WQvWEp+LPdax9We/M6PeT7KgyTE9zKmC5y1ieqz4JtpLiVifJrQg0VHYhE6l
      # - MONGODB_REPLICA_SET_KEY=keyissetforlocalreplica
    deploy:
      update_config:
        parallelism: 1
        delay: 10s
        order: start-first
      restart_policy:
        condition: any
        delay: 5s
        max_attempts: 3
        window: 120s 
      replicas: 1
      mode: replicated
    ports:
      - "27011:27017"
    networks:
      - mother
      

  # mongosecondary:
  #   image: registry.vnfco.ir/library/bitnami/mongodb:4.4.11-debian-10-r5
  #   environment:
  #     - MONGODB_REPLICA_SET_MODE=secondary
  #     - MONGODB_REPLICA_SET_NAME=igrep
  #     - MONGODB_ADVERTISED_HOSTNAME=mongosecondary
  #     - MONGODB_INITIAL_PRIMARY_HOST=mongoprimary
  #     - MONGODB_INITIAL_PRIMARY_PORT_NUMBER=27017
  #     - MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD=cWv1WQvWEp+LPdax9We/M6PeT7KgyTE9zKmC5y1ieqz4JtpLiVifJrQg0VHYhE6l
  #     - MONGODB_REPLICA_SET_KEY=keyissetforlocalreplica
  #   volumes:
  #     - mongosecondary-data:/bitnami/mongodb
  #   deploy:
  #     update_config:
  #       parallelism: 1
  #       delay: 10s
  #       order: start-first
  #     restart_policy:
  #       condition: any
  #       delay: 5s
  #       max_attempts: 3
  #       window: 120s 
  #     mode: replicated
  #     replicas: 1
  #   ports:
  #     - "27012:27017"
  #   networks:
  #     - mother

      

  # mongoarbiter:
  #   image: registry.vnfco.ir/library/bitnami/mongodb:4.4.11-debian-10-r5
  #   environment:
  #     - MONGODB_REPLICA_SET_MODE=arbiter
  #     - MONGODB_REPLICA_SET_NAME=igrep
  #     - MONGODB_ADVERTISED_HOSTNAME=mongoarbiter
  #     - MONGODB_INITIAL_PRIMARY_HOST=mongoprimary
  #     - MONGODB_INITIAL_PRIMARY_PORT_NUMBER=27017
  #     - MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD=cWv1WQvWEp+LPdax9We/M6PeT7KgyTE9zKmC5y1ieqz4JtpLiVifJrQg0VHYhE6l
  #     - MONGODB_REPLICA_SET_KEY=keyissetforlocalreplica
  #   deploy:
  #     update_config:
  #       parallelism: 1
  #       delay: 10s
  #       order: start-first
  #     restart_policy:
  #       condition: any
  #       delay: 5s
  #       max_attempts: 3
  #       window: 120s 
  #     mode: replicated
  #     replicas: 1
  #   networks:
  #     - mother




