Deploy with Docker-compose

The whole Optimization Server can be deployed from docker-compose, this page explains how to do it.

Prerequisites

The Optimization Server Docker images are available for the platforms amd64 and arm64-v8 (Apple Mac with M1/M2 chip only).

Make sure you have already installed :

You should already know about docker and docker-compose basics.

You must have downloaded the dbos-deployment.zip archive that contains the installation files and uncompressed it.

You must have access to the Optimization Server Docker registry. If you want to install the optional CPLEX workers, you must also have access to the CPLEX registry. Below their URL:

  • Optimization Server registry: product-dbos-prod-docker-group.decisionbrain.cloud/dbos

  • CPLEX registry :product-dbos-cplex-prod-docker-group.decisionbrain.cloud/dbos

Step 1: Configuration

With the installation files, there is a prefilled .env file that you must adapt to your environment. The default values allows you to install locally, you must update the file if you install on a server. Below the default .env content and explanations for each parameter:

# Image registry for DBOS and infrastructure
DECISIONBRAIN_DBOS_REGISTRY=product-dbos-prod-docker-group.decisionbrain.cloud
# Image registry for CPLEX workers
DECISIONBRAIN_CPLEX_REGISTRY=product-dbos-cplex-prod-docker-group.decisionbrain.cloud

# DBOS and infrastructure versions
DBOS_VERSION=4.4.0
DBOS_RABBITMQ_DOCKER_TAG=4.0.2-management-alpine
DBOS_MONGO_VERSION=6.0.5
DBOS_KEYCLOAK_VERSION=26.0.2-RC1-SNAPSHOT

# URL used to access Keycloak. Use a public DNS domain in production  (ex: https://keycloak.yourdomain.com).
KEYCLOAK_AUTH_SERVER_URL=http://localhost:8081
# URL used to access DBOS. Use a public DNS domain in production (ex: https://dbos.yourdomain.com).
CLIENT_URL=http://localhost

# Random private security key. You MUST change it in production.
OPTIMSERVER_JWTKEY=ohxeiTiv2vaiGeichoceiChee9siweiL

Step 2: Docker login

Before installing, you must be logg in to the image registry with the following command:

docker login product-dbos-prod-docker-group.decisionbrain.cloud

If you want to install the optional CPLEX workers, you must logg in to the second image registry with:

docker login product-dbos-cplex-prod-docker-group.decisionbrain.cloud

Step 3: Startup the application.

You can now start the whole Optimization Server environment with the following command line :

docker-compose up -d

Then to make Optimization Server usefull, you must deploy some workers.

Start CPLEX workers (optional)

To start the pre-packaged Cplex / CpOptimizer / OPL workers, use the following command:

docker-compose -f docker-compose-workers.yml up -d

This starts one container per pre-packaged worker. You can scale up workers, for instance if you want 3 running cplex-cpo-worker, run the following command:

docker-compose -f docker-compose-workers.yml up -d --scale cplex-cpo-worker=3

Embedded keycloak

The Optimization Server Keycloak image is based on the jboss/keycloak image and contains:

  • The DecisionBrain graphical theme for login and account pages.

  • A pre-configured realm, client, group, and users configuration.

You can use this image and configure it the way you want via the admin interface or use any Keycloak system you may already have.

Step 4 : Application parameters.

The OptimizationServer master application is a spring-boot application: you can use the standard spring boot parameters as environment parameters in the docker container. Java workers (pre-packaged or custom ones) are also spring-boot applications, so the same parameters may apply.

Please note that a parameter is formatted in upper case, with '_' characters instead of '.' (For example spring.rabbitmq.host becomes SPRING_RABBITMQ_HOST in docker).

This is a list of the common useful parameters to use :

Parameter name Description default
SPRING_RABBITMQ_USERNAME Rabbit MQ user name. decisionbrain
SPRING_RABBITMQ_PASSWORD Rabbit MQ password. decisionbrain
SPRING_RABBITMQ_HOST Rabbit MQ host : this should be a valid service name in the docker compose network. localhost
SPRING_RABBITMQ_PORT Rabbit MQ port. 5672
SPRING_RABBITMQ_WSPORT Rabbit MQ stomp port, used for websockets. 61613
SPRING_RABBITMQ_MANAGEMENTPORT Rabbit MQ management console port. 15672
SPRING_DATA_MONGODB_HOST Mongo db host (this should be a valid service name in the docker compose network). localhost
SPRING_DATA_MONGODB_PORT Mongo db port. 27017
SPRING_DATA_MONGODB_DATABASE Mongo db database. optimserver-master-db
LOGGING_LEVEL_COM_DECISIONBRAIN Global logging level (WARN, INFO, ERROR, DEBUG). INFO
JAVA_TOOL_OPTIONS JVM options (example: -Xmx500m -Xms10m).
OPTIMSERVER_MONGO_ENTITIES_TTL The mongo entities time to live (in seconds) -1
OPTIMSERVER_STARTJOBEXECUTION_DEFAULTASYNCJOBTTL This value is used when a job is created without any timeout value. A job will be abandoned if no worker can resolve it within this value (in seconds). 3600 * 24 * 7
OPTIMSERVER_JWTKEY The secret key used to sign JTW tokens (32 characters string) ohxeiTiv2vaiGeichoceiChee9siweiL
OPTIMSERVER_SCHEDULER_CLEANOLDDATA The frequency at which the old data cleaning operation runs (in seconds) 300
OPTIMSERVER_SCHEDULER_CLEANTEMPORARYFILES The frequency at which the temporary files cleaning operation runs (in seconds) 300

Step 5 : Containers parameters.

The containers can also be tuned by using the cpu and memory parameters (Full documentation )

For example, the following parameters limit the usage of the CPU and set the maximum available memory

    cpu_percent: 75
    mem_limit: 500M