Skip to content

Biomolecule Toolkit Docker Setup

Quick start

For quickly setting up and getting the Biomolecule Toolkit up and running on your computer, we recommend using Docker Compose.

Prerequisites:

  • Docker Compose is installed on your computer
  • A valid BMT license is available on your computer (for further options and details see license configuration)

Here is an example Docker Compose file for spinning up BMT with MySQL 5.7:
docker-compose.yml

version: '3.3'
services:
  bmt:
    image: hub.chemaxon.com/cxn-docker-release/chemaxon/biotoolkit:${BMT_VERSION_TAG:-20.12.0-0.11.0-abdc3378e}
    ports:
      - ${BMT_HTTP_PORT_ON_HOST:-8080}:8080
    environment:
      - DB_USERNAME=bioreg
      - DB_PASSWORD=bioreg
      - CHEMAXON_LICENSE_URL=/data/bioreg-home/license.cxl
      - MARVIN4JS_LICENSE_URL=/data/bioreg-home/license.cxl
      - spring_profiles_active=monomerlibrary,db_api
      - DB_URL=jdbc:mysql://db/bioreg?autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8
    volumes:
      - "${BMT_LICENSE_FOLDER:-./}:/data/bioreg-home:ro"
    depends_on:
      - db
  db:
    image: mysql:5.7
    ports:
      - 3306
    environment:
      MYSQL_DATABASE: bioreg
      MYSQL_USER: bioreg
      MYSQL_PASSWORD: bioreg
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - ${MYSQL_DATA:-/tmp/mysql/}:/var/lib/mysql
    healthcheck:
      test: /usr/bin/mysql --user=root --password=root --protocol TCP -e "show databases;"
      timeout: 20s
      interval: 2s
      retries: 10
    restart: unless-stopped

The following variables are used inside the example docker-compose.yml:

  • BMT_LICENSE_FOLDER (default: ./): the path to the folder on your computer containing the product license file (license.cxl)
  • BMT_HTTP_PORT_ON_HOST (default: 8080): the port on your computer on which the BMT will be accessible (eg. http://localhost:8080)
  • MYSQL_DATA (default: /tmp/mysql/): a folder on your computer for persistent MySQL data. If you do not want to have your BMT data to be persistent, just delete the entire volumes property under the db service.

The variables above can be overridden by specifying their values in an environment file (must be named .env and placed in the same folder with docker-compose.yml). Here is an example .env file:
.env

1
2
3
4
BMT_VERSION_TAG=20.12.0-0.11.0-abdc3378e
BMT_LICENSE_FOLDER=./
BMT_HTTP_PORT_ON_HOST=8080
MYSQL_DATA=/tmp/mysql/

Once you have the docker-compose.yml (and optionally the .env) file with all the prerequisites fulfilled, you can start up both docker containers (BMT and MySQL server) from the folder containing the files by running:

1
2
3
4
5
$ docker-compose up -d

Creating network "official-demo_default" with the default driver
Creating official-demo_db_1 ... done 
Creating official-demo_bmt_1 ... done

To watch the docker container logs, use

$ docker-compose logs -ft

The application is ready once at the bottom of the logs you can see something like this:

bmt_1  | 2019-11-21T14:48:45.681338792Z 2019-11-21 14:48:45.681  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
bmt_1  | 2019-11-21T14:48:45.686511142Z 2019-11-21 14:48:45.686  INFO 1 --- [           main] com.chemaxon.bioreg.BioregApplication    : Started BioregApplication in 17.94 seconds (JVM running for 18.769)

Stop and remove the containers by running:

$ docker-compose down

HTTP API

The docker image exposes port 8080 for HTTP traffic. The API endpoints are available under either /bioreg-web/rest/ or /api/. For more information about the endpoints refer to the API documentation at /swagger-ui.html.

Direct database manipulation operations

For security reasons, these HTTP endpoints are disabled by default. In case they are required (for playing around with the application in a sandbox environment or demonstration purposes), they can be enabled by activating db_api Spring profile (via environment variable: spring_profiles_active=db_api)

License

For information about obtaining a license, see the Biomolecule Toolkit download page.

Once having a valid product license, it can be specified via the environment variable CHEMAXON_LICENSE_URL which can have

  • either a URL pointing to the license file served over HTTP
  • or a filesystem path to the license file (use Docker volume to attach a folder containing the license file to /data/bioreg-home)

Database configuration

The *database * configuration can be provided via environment variables with the following defaults:

1
2
3
4
5
6
7
DB_DRIVERCLASSNAME: org.mariadb.jdbc.Driver
DB_MINPOOLSIZE: 1
DB_MAXPOOLSIZE: 10
DB_URL: jdbc:mysql://<BIOREG_DB_HOST defaults to 127.0.0.1>:<BIOREG_DB_PORT defaults to 3306>/bioreg?autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8
DB_USERNAME: bioreg
DB_PASSWORD: bioreg
DB_TYPE: MYSQL

SSL configuration

SSL configuration is possible via

  • a set of environment variables:

spring_profiles_active: must contain enforce-https

SERVER_SSL_KEYSTORE: must point to the keystore file

SERVER_SSL_KEYSTOREPASSWORD: the password for the keystore

  • and a volume attachment for the directory containing the keystore file

Further environment variables with their default values

1
2
3
CID_PREFIX: CXN
MAXUPLOADSIZE: 5000
MAXFILESIZE: 5000