Permalink
Browse files
Polish docker composition scripts
Now the default port is derived from the database type.
Also, PostgreSQL demo was cleaned up.
Loading branch information
@@ -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
@@ -3,21 +3,19 @@
#
# (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"
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 :
@@ -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
@@ -21,8 +21,6 @@ services:
midpoint-server :
build : ./midpoint-server/
depends_on :
- midpoint-data
expose :
- 443
ports :
@@ -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
@@ -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"
Toggle all file notes