osp-mongo

List of configuration files

Filename

Short description

Format

Documentation

module.service

Each service is described in its own file and then assembled

yaml

See the Swarm administration or Official documentation

Compatibility

Warning

OnSphere requires MongoDB to be in Replica set mode in order to work.

The driver used for the connection is the MongoDB Java Reactive Streams. The full driver and MongoDB Compatibility list is available on the driver page.

OnSphere version

Driver version

Provided MongoDB version

0.4

4.2.0

4.4

0.5

4.4.1

4.4

0.6

4.5.0

4.4

0.7

4.5.0

4.4

1.0

4.5.0

4.4

1.1

4.5.1

4.4

1.2

4.10.2

5.0

Note

If you use an external MongoDB instance, check if its version is supported by the driver.

Configure mongo

MongoDB can be internal to the stack (default method) or externalized. The later is preferred since a database is better handled in his own environment.

Outside the swarm

To install and configure MongoDB outside the swarm, we recommend following the MongoDB documentation.

Inside the swarm

If you use the mongo server default provided by the stack, the only thing needed is to ensure the volume used by mongo is replicated between each node and persisted. As Swarm doesn’t provide file system replication follow Persistent storage for more information.

Warning

By default, only one node will be deployed. This is not recommended for a production environment.

During the initial deployment, it is possible to define a replica set with (This needs to be defined for each mongo instance):

${{service-name}}:
    image: ${{image-repository}}osp-mongodb${{image-version}}
    restart: always
    command: --replSet "sdn0"
    networks:
        - "mongo"
    volumes:
        - "osp-mongo-1:/data/db"
    environment:
        - SERVICE_NAME=${{service-name}}
        - REPLICAS=modules_mongodb_osp-mongo-1 modules_mongodb_osp-mongo-2 modules_mongodb_osp-mongo-3

If mongo is already running, the command rs.add("modules_mongodb_osp-mongo-2") can be used to add a new member to the replica set.

Healthcheck

Mongo is monitored by a db.runCommand({ping}) ensuring that the mongo instance is running locally.