From 91fd1bdfcfc44a1919f57b4b82529efd1fe435d0 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 26 Sep 2018 11:07:58 +0200 Subject: [PATCH] Use standard tier/mariadb instead of custom one It was not easy to build two Docker images in TIER Jenkinsfile (using docker/util). It seems that tier/mariadb:mariadb10 is OK to be used with midPoint without any customizations, so we use it. --- Jenkinsfile | 23 +++--------- README.md | 11 +++--- common.bash | 1 - demo/complex/.env | 4 +-- .../application/database_password.txt | 2 +- demo/complex/docker-compose.yml | 2 +- midpoint/.env | 4 +-- midpoint/build.sh | 6 +--- .../application/database_password.txt | 2 +- midpoint/docker-compose.yml | 6 +--- midpoint/midpoint-data/Dockerfile | 35 ------------------- midpoint/midpoint-data/conf/mariadb.repo | 6 ---- midpoint/midpoint-data/database_password.txt | 1 - midpoint/midpoint-data/readme.txt | 1 - 14 files changed, 17 insertions(+), 87 deletions(-) delete mode 100644 midpoint/midpoint-data/Dockerfile delete mode 100644 midpoint/midpoint-data/conf/mariadb.repo delete mode 100644 midpoint/midpoint-data/database_password.txt delete mode 100644 midpoint/midpoint-data/readme.txt diff --git a/Jenkinsfile b/Jenkinsfile index 2def24c..9a52a9d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,6 @@ pipeline { environment { maintainer = "t" imagename = 'm' - imagename_data = 'md' tag = 'l' } stages { @@ -12,14 +11,13 @@ pipeline { script { maintainer = maintain() imagename = imagename() - imagename_data = imagename_data() if(env.BRANCH_NAME == "master") { tag = "latest" } else { tag = env.BRANCH_NAME } - if(!imagename || !imagename_data){ - echo "You must define imagename and imagename_data in common.bash" + if(!imagename){ + echo "You must define imagename in common.bash" currentBuild.result = 'FAILURE' } sh 'mkdir -p bin' @@ -58,21 +56,13 @@ pipeline { // sh 'cd test-compose && docker-compose down' baseImg.push("$tag") } - docker.withRegistry('https://registry.hub.docker.com/', "dockerhub-$maintainer") { - def baseImg = docker.build("$maintainer/$imagename_data", "--no-cache midpoint/midpoint-data") - // test the environment - // sh 'cd test-compose && ./compose.sh' - // bring down after testing - // sh 'cd test-compose && docker-compose down' - baseImg.push("$tag") - } } } } stage('Notify') { steps { echo "$maintainer" - slackSend color: 'good', message: "$maintainer/$imagename:$tag and $maintainer/$imagename_data:$tag pushed to DockerHub" + slackSend color: 'good', message: "$maintainer/$imagename:$tag pushed to DockerHub" } } } @@ -82,7 +72,7 @@ pipeline { } failure { // slackSend color: 'good', message: "Build failed" - handleError("BUILD ERROR: There was a problem building ${maintainer}/${imagename}:${tag} or ${maintainer}/${imagename_data}:${tag}.") + handleError("BUILD ERROR: There was a problem building ${maintainer}/${imagename}:${tag}.") } } } @@ -98,11 +88,6 @@ def imagename() { matcher ? matcher[0][1] : null } -def imagename_data() { - def matcher = readFile('common.bash') =~ 'imagename_data="(.+)"' - matcher ? matcher[0][1] : null -} - def handleError(String message){ echo "${message}" currentBuild.setResult("FAILED") diff --git a/README.md b/README.md index 503d12d..e3bd121 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,15 @@ [![Build Status](https://jenkins.testbed.tier.internet2.edu/job/docker/job/midPoint_container/job/master/badge/icon)](https://jenkins.testbed.tier.internet2.edu/job/docker/job/midPoint_container/job/master/) -This repository contains sources for TIER-supported images related to [Evolveum midPoint](http://midpoint.evolveum.com). +This repository contains sources for TIER-supported [midPoint](http://midpoint.evolveum.com) image. -# Images -- `midpoint` contains the midPoint application along with some TIER-specific components: Apache reverse proxy with optional Shibboleth filter and TIER Beacon. -- `midpoint-mariadb` hosts the default MariaDB database tailored to meet midPoint needs. It can be exchanged for another repository implementation. +The image contains the midPoint application along with some TIER-specific components: Apache reverse proxy with optional Shibboleth filter and TIER Beacon. # Supported tags -These tags apply to both containers: - latest - midPoint version-specific tags, e.g. 3.9, 3.9.1, 4.0, etc. # Content -- `midpoint` directory contains build instructions for both containers (`midpoint` and `midpoint-mariadb`), +- `midpoint` directory contains build instructions for the `midpoint` image along with `docker-compose.yml` showing its basic use, - `demo` directory contains three demonstration scenarios: - `shibboleth` to show integration with Shibboleth IdP, - `postgresql` to show how to change the repository implementation, @@ -22,7 +19,7 @@ These tags apply to both containers: Please see specific subdirectories: [midpoint](midpoint) and [demo/complex](demo/complex). # Documentation -- For the `midpoint` and `midpoint-mariadb` containers themselves please see [Dockerized midPoint](https://spaces.at.internet2.edu/display/MID/Dockerized+midPoint) wiki page. +- For the `midpoint` image and container themselves please see [Dockerized midPoint](https://spaces.at.internet2.edu/display/MID/Dockerized+midPoint) wiki page. - For the complex demo please see [midPoint - Grouper integration demo](https://spaces.at.internet2.edu/display/MID/midPoint+-+Grouper+integration+demo) wiki page. This is a work in progress. For its current status please see [Status of the work](https://spaces.at.internet2.edu/display/MID/Status+of+the+work). diff --git a/common.bash b/common.bash index 5f9b7b0..45039e1 100644 --- a/common.bash +++ b/common.bash @@ -1,3 +1,2 @@ maintainer="tier" imagename="midpoint" -imagename_data="midpoint-mariadb" diff --git a/demo/complex/.env b/demo/complex/.env index 03f48af..ce20478 100644 --- a/demo/complex/.env +++ b/demo/complex/.env @@ -5,8 +5,8 @@ REPO_DATABASE_TYPE=mariadb REPO_JDBC_URL=default REPO_HOST=midpoint-data REPO_PORT=default -REPO_DATABASE=midpoint -REPO_USER=root +REPO_DATABASE=registry +REPO_USER=registry_user REPO_PASSWORD_FILE=/run/secrets/m_database_password.txt KEYSTORE_PASSWORD_FILE=/run/secrets/m_keystore_password.txt MEM=2048m diff --git a/demo/complex/configs-and-secrets/midpoint/application/database_password.txt b/demo/complex/configs-and-secrets/midpoint/application/database_password.txt index 11bac01..11bff19 100644 --- a/demo/complex/configs-and-secrets/midpoint/application/database_password.txt +++ b/demo/complex/configs-and-secrets/midpoint/application/database_password.txt @@ -1 +1 @@ -456654 +WJzesbe3poNZ91qIbmR7 diff --git a/demo/complex/docker-compose.yml b/demo/complex/docker-compose.yml index c691377..8e16c92 100644 --- a/demo/complex/docker-compose.yml +++ b/demo/complex/docker-compose.yml @@ -190,7 +190,7 @@ services: - target_data:/var/lib/mysql midpoint-data: - image: tier/midpoint-mariadb:latest + image: tier/mariadb:mariadb10 ports: - "33306:3306" networks: diff --git a/midpoint/.env b/midpoint/.env index 03f48af..ce20478 100644 --- a/midpoint/.env +++ b/midpoint/.env @@ -5,8 +5,8 @@ REPO_DATABASE_TYPE=mariadb REPO_JDBC_URL=default REPO_HOST=midpoint-data REPO_PORT=default -REPO_DATABASE=midpoint -REPO_USER=root +REPO_DATABASE=registry +REPO_USER=registry_user REPO_PASSWORD_FILE=/run/secrets/m_database_password.txt KEYSTORE_PASSWORD_FILE=/run/secrets/m_keystore_password.txt MEM=2048m diff --git a/midpoint/build.sh b/midpoint/build.sh index 0463d37..4b53a25 100755 --- a/midpoint/build.sh +++ b/midpoint/build.sh @@ -15,11 +15,7 @@ function normalize_path() cd "$(dirname "$0")" ./download-midpoint -cd midpoint-data -docker build --tag tier/midpoint-mariadb:latest . -cd ../midpoint-server -docker build --tag tier/midpoint:latest . -cd .. +docker build --tag tier/midpoint:latest midpoint-server echo "---------------------------------------------------------------------------------------" echo "The midPoint containers were successfully built. To start them, execute the following:" echo "" diff --git a/midpoint/configs-and-secrets/midpoint/application/database_password.txt b/midpoint/configs-and-secrets/midpoint/application/database_password.txt index 11bac01..11bff19 100644 --- a/midpoint/configs-and-secrets/midpoint/application/database_password.txt +++ b/midpoint/configs-and-secrets/midpoint/application/database_password.txt @@ -1 +1 @@ -456654 +WJzesbe3poNZ91qIbmR7 diff --git a/midpoint/docker-compose.yml b/midpoint/docker-compose.yml index 6605429..191414d 100644 --- a/midpoint/docker-compose.yml +++ b/midpoint/docker-compose.yml @@ -9,9 +9,7 @@ version: "3.3" services: midpoint-data: - build: ./midpoint-data/ - expose: - - 3306 + image: tier/mariadb:mariadb10 ports: - 3306:3306 networks: @@ -21,8 +19,6 @@ services: midpoint-server: build: ./midpoint-server/ - expose: - - 443 ports: - 8443:443 environment: diff --git a/midpoint/midpoint-data/Dockerfile b/midpoint/midpoint-data/Dockerfile deleted file mode 100644 index 3249b23..0000000 --- a/midpoint/midpoint-data/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -FROM centos:centos7 - -LABEL author="tier-packaging@internet2.edu " - -COPY ./conf/mariadb.repo /etc/yum.repos.d/ - -RUN yum install -y epel-release \ - && yum update -y \ - && yum install -y mariadb-server mariadb \ - && yum clean all \ - && rm -rf /var/cache/yum - -COPY database_password.txt /tmp/ - -RUN mysql_install_db \ - && chown -R mysql:mysql /var/lib/mysql/ \ - && sed -i 's/^\(bind-address\s.*\)/# \1/' /etc/my.cnf \ - && sed -i 's/^\(log_error\s.*\)/# \1/' /etc/my.cnf \ - && sed -i 's/\[mysqld\]/\[mysqld\]\ncharacter_set_server = utf8/' /etc/my.cnf \ - && sed -i 's/\[mysqld\]/\[mysqld\]\ncollation_server = utf8_bin/' /etc/my.cnf \ - && sed -i 's/\[mysqld\]/\[mysqld\]\nport = 3306/' /etc/my.cnf \ - && cat /etc/my.cnf \ - && echo "/usr/bin/mysqld_safe &" > /tmp/config \ - && echo "mysqladmin --silent --wait=30 ping || exit 1" >> /tmp/config \ - && echo "mysql -e \"CREATE USER 'root'@'%' IDENTIFIED BY '`cat /tmp/database_password.txt`';\"" >> /tmp/config \ - && echo "mysql -e 'GRANT ALL PRIVILEGES ON *.* TO \"root\"@\"%\" WITH GRANT OPTION;'" >> /tmp/config \ - && echo "mysql -e 'CREATE DATABASE midpoint CHARACTER SET utf8 COLLATE utf8_bin;'" >> /tmp/config \ - && echo "mysql -e \"SET PASSWORD FOR 'root'@'localhost' = PASSWORD('`cat /tmp/database_password.txt`');\"" >> /tmp/config \ - && cat /tmp/config \ - && bash /tmp/config \ - && rm -f /tmp/config /tmp/database_password.txt - -EXPOSE 3306 - -CMD mysqld_safe diff --git a/midpoint/midpoint-data/conf/mariadb.repo b/midpoint/midpoint-data/conf/mariadb.repo deleted file mode 100644 index e24b3a0..0000000 --- a/midpoint/midpoint-data/conf/mariadb.repo +++ /dev/null @@ -1,6 +0,0 @@ -[mariadb] -name = MariaDB -baseurl = http://yum.mariadb.org/10.1/centos7-amd64 -gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB -gpgcheck=1 - diff --git a/midpoint/midpoint-data/database_password.txt b/midpoint/midpoint-data/database_password.txt deleted file mode 100644 index 11bac01..0000000 --- a/midpoint/midpoint-data/database_password.txt +++ /dev/null @@ -1 +0,0 @@ -456654 diff --git a/midpoint/midpoint-data/readme.txt b/midpoint/midpoint-data/readme.txt deleted file mode 100644 index e0affb1..0000000 --- a/midpoint/midpoint-data/readme.txt +++ /dev/null @@ -1 +0,0 @@ -database_password.txt should be synchronized with ../configs-and-secrets/midpoint/database_password.txt