From 3bc3fb294e0265ba861e6eb5760b15ca6e3527b6 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 9 Aug 2018 15:00:00 +0200 Subject: [PATCH] Add demonstration of MariaDB repo integration Other parts of the environment are temporary. --- mariadb/Dockerfile | 50 ++++++++++++++++++++++++++++++++++ mariadb/docker-compose.yml | 55 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 mariadb/Dockerfile create mode 100644 mariadb/docker-compose.yml diff --git a/mariadb/Dockerfile b/mariadb/Dockerfile new file mode 100644 index 0000000..7334ffd --- /dev/null +++ b/mariadb/Dockerfile @@ -0,0 +1,50 @@ +# +# Just a demonstration of how to flexibly use MariaDB running in a separate container. +# It requires v3.9devel-269-gbdd3017 or later. +# +# Features: +# - see docker-compose.yml +# +# Limitations (will be resolved): +# - image is derived from Evolveum's dockerization +# - mariadb uses default database of 'registry' and default user of 'root' +# - JDBC password is present as plaintext +# +# Building: (assumes midpoint-3.9-SNAPSHOT-dist.tar.gz is present in the current directory) +# +# docker build -t midpoint . +# docker stack deploy -c docker-compose.yml mp +# + +FROM openjdk:8-jdk-alpine + +MAINTAINER info@evolveum.com + +ARG MP_VERSION=3.9-SNAPSHOT +ARG MP_DIST_FILE=midpoint-${MP_VERSION}-dist.tar.gz + +ENV MP_DIR /opt/midpoint +ENV REPO_HOST mariadb +ENV REPO_PORT 3306 +ENV REPO_USER root +ENV REPO_PASSWORD 123321 + +RUN mkdir -p ${MP_DIR}/var + +COPY ${MP_DIST_FILE} ${MP_DIR} + +RUN echo 'Extracting midPoint archive...' \ + && tar xzf ${MP_DIR}/midpoint-${MP_VERSION}-dist.tar.gz -C ${MP_DIR} --strip-components=1 + +VOLUME ${MP_DIR}/var + +CMD java -Xmx2048M -Xms2048M -Dfile.encoding=UTF8 \ + -Dmidpoint.home=$MP_DIR/var \ + -Dmidpoint.repository.database=mariadb \ + -Dmidpoint.repository.jdbcUsername=$REPO_USER \ + -Dmidpoint.repository.jdbcPassword=$REPO_PASSWORD \ + -Dmidpoint.repository.jdbcUrl=jdbc:mariadb://$REPO_HOST:$REPO_PORT/registry?characterEncoding=utf8 \ + -Dmidpoint.repository.hibernateHbm2ddl=none \ + -Dmidpoint.repository.missingSchemaAction=create \ + -Dmidpoint.repository.initializationFailTimeout=60000 \ + -jar $MP_DIR/lib/midpoint.war diff --git a/mariadb/docker-compose.yml b/mariadb/docker-compose.yml new file mode 100644 index 0000000..e4eab5e --- /dev/null +++ b/mariadb/docker-compose.yml @@ -0,0 +1,55 @@ +# +# Composition of midPoint and TIER MariaDB containers. +# +# MariaDB serves as a repository for midPoint. +# +# Features: +# - a separate volume for repository data (MySQL database directory), so it persists between creation/removal cycle of this stack +# - a separate volume for midPoint home directory, containing config.xml, logs, generated encryption keys, and so on +# + +version: "3" +services: + + mariadb: + image: tier/mariadb:mariadb10 + deploy: + restart_policy: + condition: none + volumes: + - repo-db-data:/var/lib/mysqlmounted + networks: + - webnet + + mariadbadminer: + image: adminer + deploy: + restart_policy: + condition: none + depends_on: + - mariadb + ports: + - 18080:8080 + networks: + - webnet + + midpoint: + image: midpoint + deploy: + restart_policy: + condition: none + depends_on: + - mariadb + ports: + - 8080:8080 + volumes: + - midpoint-home:/opt/midpoint/var # change this if MP_DIR changes + networks: + - webnet + +networks: + webnet: + +volumes: + repo-db-data: + midpoint-home: