Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: small corrections; the alpine based image; the book chapters' compose files

 


Introduction

Here we describe Docker image for midPoint.

...

Besides the image itself, the project contains a couple of demonstrations of its usage:

Demonstration directory
Description
demo/postgresqlDemonstration of how to use an PostgreSQL repository.
demo/extrepoDemonstration of how to use externally hosted repository. It also shows database schema version mismatch detection as well as automated upgrade procedure.
demo/clusteringThis demo shows how to run two midPoint nodes working against common midPoint repository.

demo/simple

This demo shows Midpoint with PostgreSQL repository. Midpoint contains csv-resource as the source and openldap-resource as the target.
bookConfiguration of book chapters' docker environments.

 Prerequisites

In order to set up and run this container and associated demonstrations, you need a Linux machine with a reasonably recent Docker and docker-compose installation.

...

The easiest way how to start dockerized midPoint is to use only image which use uses h2 database (Supported only in embedded mode. Not supported for production deployments. Only the version specifically bundled with midPoint is supported.). You have two choices: download image or build your own image.

Download image

You can download prepared image from the docker hub. There are images based of ubuntu image or alpine image available. Alpine based images has suffix -alpine in the tag.

Code Block
languagebash
$ docker pull evolveum/midpoint

Building own imagesOptionally you can pull a specific tag (image)

Code Block
languagebash
$ docker pull evolveum/midpoint:latest-alpine


Build your own image

The above commands download evolveum/midpoint image from the Docker hub. Alternatively, you can build this image by yourself. Here is how:


 

Code Block
languagebash
$ git clone https://github.com/Evolveum/midpoint-docker.git
$ cd midpoint-docker
$ ./build.sh

 


(Note the build.sh has a -n switch that skips downloading the midPoint distribution archive, saving some time during repeated builds or you can use custom midpoint-dist.tar.gz file.)

Starting

You can directly use Dockerfile-alpine file to build the image based on alpine image:

Code Block
languagebash
$ git clone https://github.com/Evolveum/midpoint-docker.git
$ cd midpoint-docker
$ docker build --network host -tag evolveum/midpoint:latest-alpine .

How to run

Running of image on port 8080:

Code Block
languagebash
$ docker run -p 8080:8080 --name midpoint evolveum/midpoint

Alternatively you can run container using other port (e.g. alpine based latest image on port 8081 - URL to connect will be http://localhost:8081/ ) :

Code Block
languagebash
$ docker run -p 8081:8080 --name midpoint evolveum/midpoint:latest-alpine

The Alpine based image offering internal script handling post-initial-objects for initial set up of application's objects. To utilize it you can mount volume to docker container (more information Alpine based docker image wiki page). In case you have the directory `./pio` containing the post-initial-objects the command should be :

Code Block
languagebash
$ docker run -p 8081:8080 --name midpoint -v ./pio:/opt/midpoint-dirs-docker-entrypoint/:ro evolveum/midpoint:latest-alpine


If you use build from repository, then you can start one of our demonstrations, e.g. postgresql.

Code Block
languagebash
$ cd demo/postgresql/ 
$ docker-compose up --build

After startingOther example could be to run the book chapter 2 environment (with docker-compose file other than default) :

Code Block
languagebash
$ cd book/
$ docker-compose -f docker-compose-chapter2.yml up


While running

After docker run or docker-compose up command successfully finishes you should see something like this on the console:


 

Code Block
languagebash
midpoint_server_1  | 2019-02-22 15:07:50,222 [] [main] INFO (org.springframework.boot.web.embedded.tomcat.TomcatWebServer): Tomcat started on port(s): 8080 (http) with context path '/midpoint'
midpoint_server_1  | 2019-02-22 15:07:50,230 [] [main] INFO (com.evolveum.midpoint.web.boot.MidPointSpringApplication): Started MidPointSpringApplication in 74.425 seconds (JVM running for 77.109)

 

...

 Now you can log into midPoint

...

...

administrator5ecr3t

Configuring the container (general information)

Before running of the image we can define some of the environment properties.  In the case of composition the lowest level of configuration of the midPoint container is during its inclusion into a Docker composition. There is the full set of environment properties and other configurable items (e.g. Docker secrets and configs) available.

...

You can set the environment variables like this:

 

Code Block
languagebash
$ docker run -p 8080:8080 -e MP_MEM_MAX="4096M" -e MP_MEM_INIT="4096M" --name midpoint evolveum/midpoint

 


How to set environment variables after composition is done

After the composition is done, you can set the environment variables like this:


 

Code Block
languagebash
$ export MP_MEM_MAX="4096M" MP_MEM_INIT="4096M"
$ docker-compose up --build

 


Or like this:


 

Code Block
languagebash
$ env MP_MEM_MAX="4096M" MP_MEM_INIT="4096M" docker-compose up --build

 


How to set Docker secrets and configs

...

Repository configuration is done via the following environment variables.

Environment variable
Meaning
Default value
REPO_DATABASE_TYPEType of the database. Supported values are mariadbmysqlpostgresqlsqlserveroracle. It is possible to use H2as well but H2 is inappropriate for production use.h2
REPO_JDBC_URLURL of the database.
H2: jdbc:h2:tcp://$REPO_HOST:$REPO_PORT/$REPO_DATABASE
MariaDB: jdbc:mariadb://$REPO_HOST:$REPO_PORT/$REPO_DATABASE?characterEncoding=utf8

MySQL: jdbc:mysql://$REPO_HOST:$REPO_PORT/$REPO_DATABASE?characterEncoding=utf8

PostgreSQL: jdbc:postgresql://$REPO_HOST:$REPO_PORT/$REPO_DATABASE

SQL Server: jdbc:sqlserver://$REPO_HOST:$REPO_PORT;database=$REPO_DATABASE

Oracle: jdbc:oracle:thin:@$REPO_HOST:$REPO_PORT/xe

REPO_HOSTHost of the database. Used to construct the URL.midpoint_data
REPO_PORTPort of the database. Used to construct the URL.
5437, 3306, 5432, 1433, 1521 for H2, MariaDB/MySQL, PostgreSQL, SQL Server and Oracle, respectively
REPO_DATABASESpecific database to connect to. Used to construct the URL.midpoint
REPO_USERUser under which the connection to the database is made.midpoint
REPO_PASSWORD_FILEFile (e.g. holding a docker secret) that contains the password for the db connection.
 

REPO_MISSING_SCHEMA_ACTIONWhat should midPoint do if the database schema is missing (options: warnstopcreate).create
REPO_UPGRADEABLE_SCHEMA_ACTIONWhat should midPoint do if the database schema is obsolete but upgradeable (options: warnstopupgrade). As of midPoint 3.9, the only automated transition available is from 3.8 to 3.9.stop
REPO_SCHEMA_VERSION_IF_MISSINGFor midPoint versions before 3.9 that do not have schema information explicitly stored in the database, this parameter allows specifying the version externally. It can be used for automated upgrade from 3.8 to 3.9. (In such cases, specify it to be 3.8, assuming this is your schema version.)
 

REPO_SCHEMA_VARIANT

Used to specify what schema variant is to be used for automated creation or upgrade of the database schema. Currently the only known variant is utf8mb4 for MySQL/MariaDB.

Beware: it is the administrator's responsibility to choose the correct variant! Currently midPoint does not try to determine the variant present in the database. So be sure to avoid applying e.g. mysql-upgrade-3.8-3.9-utf8mb4.sql if the database is not in utf8mb4 character set, or vice versa.

 

For automatic schema creation and upgrade options please see Schema creation and updating section in midPoint documentation.

Note that in order to connect to the database you have to provide the password. For security reasons, we use the indirect way through file access. So, typically you provide the following Docker secret:

Secret
Meaning
Typical location in demonstration scenarios
mp_database_password.txtA password used to access the repository (relates to REPO_USER).configs-and-secrets/midpoint/database_password.txt

Of course, you can provide the password file in any other way, assuming you correctly set REPO_PASSWORD_FILE environment variable.

...

Other aspects can be configured using the following variables and Docker secrets or configs.

Environment variable
Meaning
Default value
MP_MEM_MAXThe limit for Java heap memory (-Xmx setting)2048m
MP_MEM_INITThe initial amount of Java heap memory (-Xms setting)1024m
MP_JAVA_OPTSAny other Java options to be passed to midPoint
 

MP_KEYSTORE_PASSWORD_FILE

File (e.g. holding a docker secret) that contains the password for the midPoint keystore
 

MP_DIRmidPoint home directory. Do not change until absolutely necessary, as the change might break many things./opt/midpoint
MP_DIST_FILE

Name of midpoint-dist file from which will be started Midpoint. It must have .tar.gz type and it's path must be {path_to_repository}/midpoint-docker/MP_DIST_FILE. This file will be download during building of the image, but you can use custom midpoint-dist file with ./build.sh -n.

midpoint-dist.tar.gz
TIMEZONEName of the time zone to be set for the container upon startup. E.g. US/Central.UTC

And the following Docker secrets are to be provided:

Item
Kind
Meaning
Location
mp_keystore_password.txtsecretJava keystore password used by midPoint e.g. to encrypt sensitive information stored in the repository.configs-and-secrets/midpoint/keystore_password.txt
jmxremote.password
jmxremote.access
secret

Names of the password and access files for JMX authentication and authorization. Use for clustering. For more information see Clustering / high availability setup. These secrets are specific for clustering demo.

configs-and-secrets/midpoint/jmxremote.password

configs-and-secrets/midpoint/jmxremote.access