[midPoint] Howto Update midPoint Docker Images with native PostgreSQL Database?

Patrik Sidler patrik.sidler at itconcepts.ch
Thu Sep 1 15:50:18 CEST 2022


Hi All,

I have started to work with the midPoint Docker images.
Based on the postgresql Demo Images (https://docs.evolveum.com/midpoint/install/docker/postgresql-demo/) I was able to get this up and running.

I have taken the https://github.com/Evolveum/midpoint-docker/blob/master/demo/postgresql/docker-compose-tests-native.yml file and have splitted it into an Init-DB and into an Server Part (see below).
The docker-compose files I have changed to work with the midpoint 4.4.2 Image.

All works fine.

But what happens when I hate to upgrade midPoint to 4.4.2?

I have changed the Server Part to work with midPoint 4.5 and executed the docker-compose again.
Not the server part is running with midPoint 4.5 but the Database is still on 4.4.2.
This means no DB Update was executed because the Update Script (postgres-new-upgrade-audit.sql) is in the midPoint Container and there is no psql available to execute the DB-Update Script.

Are there any plans to bring either psql into the docker Image and integrate a kind of a DB-Upgrade check?

Or do you have an easier way for me to upgrade the Database whenever I upgrade my midPoint Docker images?

Thank you in advance for your help.

Regards,
Patrik


************************************
* Init-DB (docker-compose-postgres.yml):  *
************************************
version: "3.3"

services:
  data_init:
    image: evolveum/midpoint:4.4.2
    command: >
        bash -c "
        chmod 777 /opt/db-pw/ ;
        touch /opt/db-pw/db_init_in_progress ;
        cp /run/secrets/mp_database_password.txt /opt/db-pw/dbpassword ;
        cp /run/secrets/mp_keystore_password.txt /opt/db-pw/keystorepw ;
        echo -e '#!/bin/sh\ntouch /opt/db-pw/db_init' >/opt/db-init/000-start.sh ;
        echo -e '#!/bin/sh\necho DB structure init process has finished...\nrm -f /opt/db-pw/db_init_in_progress /opt/db-pw/db_init' > /opt/db-init/999-finish.sh ;
        /opt/midpoint/bin/midpoint.sh init-native
        "
    environment:
     - MP_CHECK=/opt/db-pw/init_in_progress
     - MP_INIT_DB_CONCAT=/opt/db-init/010-init.sql
     - MP_INIT_CFG=/opt/mp-home
     - MP_INIT_LOOP=1
    secrets:
     - mp_database_password.txt
     - mp_keystore_password.txt
    volumes:
     - db_init:/opt/db-init
     - db_pw:/opt/db-pw
     - midpoint_home:/opt/mp-home

  midpoint_data:
    image: postgres:13-alpine
    command: >
        bash -c "
        while [ ! -s /opt/db-pw/dbpassword -o -e /opt/db-pw/init_in_progress ] ; do
         echo 'Waiting to the end of the init process...';
         sleep 1;
        done ;
        {
         sleep 2 ;
         if [ ! -e /opt/db-pw/db_init -a -e /opt/db-pw/db_init_in_progress ] ;
          then echo 'DB init did not start...' ;
          rm -f /opt/db-pw/db_ini*;
          echo 'The lock files has been removed...';
         fi ;
        } &
        docker-entrypoint.sh postgres
        "
    user: "70:70"
    depends_on:
     - data_init
    environment:
     - POSTGRES_PASSWORD_FILE=/opt/db-pw/dbpassword
     - POSTGRES_USER=midpoint
     - POSTGRES_INITDB_ARGS=--lc-collate=en_US.utf8 --lc-ctype=en_US.utf8
    expose:
     - 5432
    command: ["-p", "5432"]
    networks:
     - net
    volumes:
     - midpoint_data:/var/lib/postgresql/data
     - db_init:/docker-entrypoint-initdb.d/
     - db_pw:/opt/db-pw

networks:
  net:
    driver: bridge

secrets:
  mp_database_password.txt:
    file: ./configs-and-secrets/midpoint/database_password.txt
  mp_keystore_password.txt:
    file: ./configs-and-secrets/midpoint/keystore_password.txt

volumes:
  db_init:
  db_pw:
  midpoint_data:
  midpoint_home:

***************************************
* Server Part (docker-compose-midpoint.yml): *
***************************************
version: "3.3"

services:
  midpoint_server:
    image: evolveum/midpoint:4.4.2
    command: [ "/opt/midpoint/bin/midpoint.sh", "container" ]
    ports:
      - 8280:8080
    environment:
     - MP_CHECK=/opt/db-pw/db_init_in_progress
     - MP_SET_midpoint_repository_database=postgresql
     - MP_SET_midpoint_repository_jdbcUrl=jdbc:postgresql://midpoint_data:5432/midpoint
     - MP_SET_midpoint_repository_jdbcUsername=midpoint
     - MP_SET_midpoint_repository_jdbcPassword_FILE=/opt/db-pw/dbpassword
     - MP_SET_midpoint_repository_missingSchemaAction=create
     - MP_SET_midpoint_keystore_keyStorePassword_FILE=/opt/db-pw/keystorepw
     - MP_UNSET_midpoint_repository_hibernateHbm2ddl=1
     - MP_NO_ENV_COMPAT=1
     - MP_ENTRY_POINT=/opt/midpoint-dirs-docker-entrypoint
    networks:
     - net
    volumes:
     - midpoint_home:/opt/midpoint/var
     - db_pw:/opt/db-pw
     - ./midpoint_server/container_files/mp-home:/opt/midpoint-dirs-docker-entrypoint/:ro
     - java_security:/etc/java-17-openjdk/security/

networks:
  net:
    driver: bridge

volumes:
  db_pw:
  midpoint_home:
  java_security:
************************************************************************************************


Freundliche GrĂ¼sse

Patrik Sidler
Senior Consultant und Teamleader IAM
[itc-logo]<https://www.itconcepts.ch/>

ITConcepts Professional GmbH
[cid:image002.png at 01D8BE10.F9B12540]<https://www.kununu.com/ch/itconcepts-bsm-schweiz>
Grundstrasse 10
6343 Rotkreuz
t: 041 790 33 33
m: 079 541 83 81
patrik.sidler at itconcepts.ch<mailto:patrik.sidler at itconcepts.ch>

https://www.itconcepts.ch/
[cid:image003.png at 01D8BE10.F9B12540]<https://www.facebook.com/itconcepts.ch/>   [cid:image004.png at 01D8BE10.F9B12540] <https://www.linkedin.com/company/itconcepts-bsm/>    [cid:image005.png at 01D8BE10.F9B12540] <https://twitter.com/itconceptsch?lang=de>

Kennen Sie bereits unseren Youtube Kanal<https://www.youtube.com/channel/UCkwk9_n_WYPlZCgLjUdb0EA>?

20 Jahre ITConcepts Zum Video<https://youtu.be/KdjKp9mVxrs>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220901/37f2f611/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 7131 bytes
Desc: image001.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220901/37f2f611/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 205231 bytes
Desc: image002.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220901/37f2f611/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 556 bytes
Desc: image003.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220901/37f2f611/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 621 bytes
Desc: image004.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220901/37f2f611/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 717 bytes
Desc: image005.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220901/37f2f611/attachment-0009.png>


More information about the midPoint mailing list