osp-mongo

List of configuration files

Filename

Short description

Format

Documentation

module.service

Each service is defined in a separate file and then combined into a unified compose stack file

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

1.3

5.1.2

6.0

1.4

5.2.1

7.0

2.0

5.7.0

8.0

2.1

5.10.0

8.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 latter is preferred since a database is better handled in its 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
    hostname: ${{service-name}}
    command: --replSet "sdn0" --wiredTigerCacheSizeGB 8
    deploy:
        resources:
            limits:
                memory: 10G
    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.

Environment Variables

All modules env variables

Variable Name

Default Value

Usage

PROMETHEUS_PORT

9100

The internal port used for Openmetrics exposition.

DISPATCHER_HOST

modules_configuration-dispatcher_main

The hostname on which the modules can fetch the configuration.

DISPATCHER_PORT

10000

The port used by the module to listen for configuration request.

USE_LEGACY_RESTART

Not set

When this flag is enabled, the container will terminate itself whenever a restart is needed (for example, after a configuration change). This is the legacy restart (before version 2.1.0). Otherwise, the system will simply restart the process running inside the container.

CUSTOM_JVM_OPTIONS

Not set

Allow to inject JVM options. See Configuration changes for more information.

ALLOW_VERSION_MISMATCH

Not set

Allow to disable the version check when a new configuration is published to a module. By default, a module will not be restarted if its configuration does not match its version.

Dedicated variables

Replicas configuration see official docker