diff --git a/demo/postgresql/midpoint-additions-for-standalone-run.yml b/demo/postgresql/midpoint-additions-for-standalone-run.yml index d89165f..2e3cabe 100644 --- a/demo/postgresql/midpoint-additions-for-standalone-run.yml +++ b/demo/postgresql/midpoint-additions-for-standalone-run.yml @@ -3,22 +3,21 @@ # # (in this directory) # -# $ docker-compose up --build +# $ docker-compose up # # (in ../midpoint directory) # -# $ docker-compose -f docker-compose.yml -f ../demo/postgresql/midpoint-additions-for-standalone-run.yml up --build +# $ docker-compose -f docker-compose.yml -f ../demo/postgresql/midpoint-additions-for-standalone-run.yml up midpoint-server # # It expects that PostgreSQL is started independently of midPoint. When executing the containers in this way, there are two compositions with the following containers: # # "midpoint" # -# 1) midpoint-server -# 2) midpoint-data <-- this is the original MariaDB container; it will execute command of 'true' i.e. exiting just upon the startup +# - midpoint-server # # "postgresql" # -# 1) postgresql +# - postgresql # version: "3.3" @@ -28,18 +27,11 @@ services: environment: - REPO_DATABASE_TYPE=postgresql - REPO_HOST=postgresql - - REPO_PORT=5432 - REPO_DATABASE=midpoint - REPO_USER=midpoint networks: - postgresql_net - # effectively disable original MariaDB service - midpoint-data: - image: alpine:latest - command: "true" - entrypoint: "true" - networks: postgresql_net: external: true diff --git a/demo/postgresql/midpoint-additions.yml b/demo/postgresql/midpoint-additions.yml index 5dfb3d9..5cf43d4 100644 --- a/demo/postgresql/midpoint-additions.yml +++ b/demo/postgresql/midpoint-additions.yml @@ -3,13 +3,12 @@ # # (in ../midpoint directory) # -# $ docker-compose -f docker-compose.yml -f ../demo/postgresql/midpoint-additions.yml up --build +# $ docker-compose -f docker-compose.yml -f ../demo/postgresql/midpoint-additions.yml up midpoint-server postgresql # # It expects that PostgreSQL is started as part of midPoint composition. So there will be three containers there: # # 1) midpoint-server # 2) postgresql -# 3) midpoint-data <-- this is the original MariaDB container; it will execute command of 'true' i.e. exiting just upon the startup # version: "3.3" @@ -17,7 +16,6 @@ version: "3.3" services: postgresql: build: ../demo/postgresql/postgresql/ - entrypoint: ["/docker-entrypoint.sh", "postgres"] # for some reasons this is needed for the correct initialization environment: - POSTGRES_PASSWORD=password expose: @@ -33,15 +31,8 @@ services: environment: - REPO_DATABASE_TYPE=postgresql - REPO_HOST=postgresql - - REPO_PORT=5432 - REPO_DATABASE=midpoint - REPO_USER=midpoint - # effectively disable original MariaDB service - midpoint-data: - image: alpine:latest - command: "true" - entrypoint: "true" - volumes: postgresql_data: diff --git a/midpoint/.env b/midpoint/.env index 9b1bf15..2d25ece 100644 --- a/midpoint/.env +++ b/midpoint/.env @@ -4,7 +4,7 @@ USERTOKEN=3.9-SNAPSHOT REPO_DATABASE_TYPE=mariadb REPO_JDBC_URL=default REPO_HOST=midpoint-data -REPO_PORT=3306 +REPO_PORT=default REPO_DATABASE=midpoint REPO_USER=root REPO_PASSWORD_FILE=/run/secrets/m_database_password.txt diff --git a/midpoint/docker-compose.yml b/midpoint/docker-compose.yml index 1a6d7e7..430dcde 100644 --- a/midpoint/docker-compose.yml +++ b/midpoint/docker-compose.yml @@ -21,8 +21,6 @@ services: midpoint-server: build: ./midpoint-server/ - depends_on: - - midpoint-data expose: - 443 ports: diff --git a/midpoint/midpoint-server/Dockerfile b/midpoint/midpoint-server/Dockerfile index c2e274a..6baaf22 100644 --- a/midpoint/midpoint-server/Dockerfile +++ b/midpoint/midpoint-server/Dockerfile @@ -42,7 +42,7 @@ VOLUME ${MP_DIR}/var # Repository parameters ENV REPO_HOST midpoint-data -ENV REPO_PORT 3306 +ENV REPO_PORT default ENV REPO_USER root ENV REPO_DATABASE midpoint ENV REPO_JDBC_URL default diff --git a/midpoint/midpoint-server/container_files/mp-dir/repository-url b/midpoint/midpoint-server/container_files/mp-dir/repository-url index 8681880..2ba287a 100755 --- a/midpoint/midpoint-server/container_files/mp-dir/repository-url +++ b/midpoint/midpoint-server/container_files/mp-dir/repository-url @@ -1,6 +1,33 @@ #!/bin/bash +function resolvePort() { + if [ $REPO_PORT == "default" ]; then + case $REPO_DATABASE_TYPE in + mariadb) + echo 3306 + ;; + mysql) + echo 3306 + ;; + oracle) + echo 1521 + ;; + postgresql) + echo 5432 + ;; + sqlserver) + echo 1433 + ;; + *) + echo "~~~~~ please supply JDBC port for your repository ~~~~~" + esac + else + echo $REPO_PORT + fi +} + if [ $REPO_JDBC_URL == "default" ]; then + REPO_PORT=$( resolvePort ) case $REPO_DATABASE_TYPE in mariadb) echo "jdbc:mariadb://$REPO_HOST:$REPO_PORT/$REPO_DATABASE?characterEncoding=utf8"