Docker compose

Last modified 11 Jun 2024 00:58 +02:00
Table of Contents

This page is related to the midPoint in container context of documentation. Here will be dedicated samples related to the docker compose. The content can be used also out of the docker environment but small syntax update may be needed.

You may be interested in :

  • common container related information
    There is information contains possibilities of customization of the installation.

  • Kubernetes related information
    Sample configuration related to the kubernetes environment.

Starting environment

As we need postgreSQL for the native repository we are not able to use only midPoint image / container itself. There is need to utilize docker compose to define the environment.

docker compose file to start midPoint in docker environment | Github
version: "3.3"

services:
  midpoint_data:
    image: postgres:16-alpine
    environment:
     - POSTGRES_PASSWORD=db.secret.pw.007
     - POSTGRES_USER=midpoint
     - POSTGRES_INITDB_ARGS=--lc-collate=en_US.utf8 --lc-ctype=en_US.utf8
    networks:
     - net
    volumes:
     - midpoint_data:/var/lib/postgresql/data

  data_init:
    image: evolveum/midpoint:${MP_VER:-latest}-alpine
    command: >
      bash -c "
      cd /opt/midpoint ;
      bin/midpoint.sh init-native ;
      echo ' - - - - - - ' ;
      bin/ninja.sh -B info >/dev/null 2>/tmp/ninja.log ;
      grep -q \"ERROR\" /tmp/ninja.log && (
      bin/ninja.sh run-sql --create --mode REPOSITORY  ;
      bin/ninja.sh run-sql --create --mode AUDIT
      ) ||
      echo -e '\\n Repository init is not needed...' ;
      "
    depends_on:
     - midpoint_data
    environment:
     - MP_SET_midpoint_repository_jdbcUsername=midpoint
     - MP_SET_midpoint_repository_jdbcPassword=db.secret.pw.007
     - MP_SET_midpoint_repository_jdbcUrl=jdbc:postgresql://midpoint_data:5432/midpoint
     - MP_SET_midpoint_repository_database=postgresql
     - MP_INIT_CFG=/opt/midpoint/var
    networks:
     - net
    volumes:
     - midpoint_home:/opt/midpoint/var

  midpoint_server:
    image: evolveum/midpoint:${MP_VER:-latest}-alpine
    container_name: midpoint_server
    hostname: midpoint-container
    depends_on:
      data_init:
        condition: service_completed_successfully
      midpoint_data:
        condition: service_started
    command: [ "/opt/midpoint/bin/midpoint.sh", "container" ]
    ports:
      - 8080:8080
    environment:
     - MP_SET_midpoint_repository_jdbcUsername=midpoint
     - MP_SET_midpoint_repository_jdbcPassword=db.secret.pw.007
     - MP_SET_midpoint_repository_jdbcUrl=jdbc:postgresql://midpoint_data:5432/midpoint
     - MP_SET_midpoint_repository_database=postgresql
     - MP_SET_midpoint_administrator_initialPassword=Test5ecr3t
     - MP_UNSET_midpoint_repository_hibernateHbm2ddl=1
     - MP_NO_ENV_COMPAT=1
    networks:
     - net
    volumes:
     - midpoint_home:/opt/midpoint/var

networks:
  net:
    driver: bridge

volumes:
  midpoint_data:
  midpoint_home:

You can find "static" password for the database in the docker compose definition - db.secret.pw.007 . In case we would like to have generated password there would be two containers for initiation - one for generating the password and other for the repository structure init. Password has to be ready before DB starts and structure can be initiated once the DB is running.

This configuration is less secure (known password) but the focus is for "quick start" - the simplicity.

Once this file is stored in the file with "default" name docker-compose.yml the usage is easier. In case other name is used there have to be defined explicitly the filename in all docker compose command with parameter -f.

Table 1. Basic operation with the docker using compose are following:
operation command

start environemnt

docker compose up

list running containers

docker ps

stop environment

docker compose down

stop & clean related objects

docker compose down -v

Once fully started the midPoint web GUI is reachable with the following information:

Table 2. Access information as set up in the docker-compose definition file

URL

http://localhost:8080/midpoint/

Username

administrator

Password

Test5ecr3t

With the focus on security there is no default password in current version of midPoint. In this case the password is explicitly set up in the docker-compose file.

Was this page helpful?
YES NO
Thanks for your feedback