Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Major refactoring, moving several configuration components upstream
  • Loading branch information
Jim Van Fleet committed Sep 5, 2016
1 parent 954ac0c commit 6de692d
Showing 10 changed files with 110 additions and 14 deletions.
8 changes: 3 additions & 5 deletions Dockerfile
@@ -18,9 +18,11 @@ ENV WAIT_TIME=60

LABEL Build docker build --rm --tag $maintainer/$imagename .

COPY MariaDB.repo /etc/yum.repos.d/MariaDB.repo
ADD container_files /opt

RUN mkdir -p /opt/grouper/$VERSION \
&& mv /opt/etc/grouper.installer.properties /opt/grouper/$VERSION/. \
&& mv /opt/etc/MariaDB.repo /etc/yum.repos.d/MariaDB.repo \
&& curl -o /opt/grouper/$VERSION/grouperInstaller.jar http://software.internet2.edu/grouper/release/$VERSION/grouperInstaller.jar \
&& yum -y update \
&& yum -y install --setopt=tsflags=nodocs \
@@ -30,10 +32,6 @@ RUN mkdir -p /opt/grouper/$VERSION \
MariaDB-client \
mlocate \
&& yum clean all

# Add starters and installers
ADD ./container_files /opt
COPY grouper.installer.properties /opt/grouper/$version

# The installer creates a HSQL DB which we ignore later
WORKDIR /opt/grouper/$version
4 changes: 2 additions & 2 deletions container_files/bin/check.sh
@@ -1,5 +1,5 @@
#!/bin/bash

log="/tmp/shib.log"
log="/tmp/grouper.log"

cd /opt/grouper/2.3.0/grouper.apiBinary-2.3.0 && GROUPER_HOME=/opt/grouper/2.3.0/grouper.apiBinary-2.3.0 bin/gsh.sh -registry -check
cd /opt/grouper/2.3.0/grouper.apiBinary-2.3.0 && GROUPER_HOME=/opt/grouper/2.3.0/grouper.apiBinary-2.3.0 bin/gsh.sh -registry -check >> $log
5 changes: 5 additions & 0 deletions container_files/bin/cleanup.sh
@@ -0,0 +1,5 @@
#!/bin/bash

log="/tmp/grouper.log"

rm -f /tmp/firsttimerunning >> $log
28 changes: 26 additions & 2 deletions container_files/bin/configure.sh
@@ -1,3 +1,27 @@
#!/bin/bash -x
#!/bin/bash

# Configure your access (e.g. rewriting grouper.installer.properties) here
log="/tmp/grouper.log"

sed -i "s|#GROUPER_SYSTEM_PASSWORD#|$GROUPER_SYSTEM_PASSWORD|g" /opt/etc/grouper.installer.properties >> $log

# Long-lived configuration values, these are symlinked into place

sed -i "s|#MYSQL_HOST#|$MYSQL_HOST|g" /opt/etc/grouper.hibernate.properties >> $log

sed -i "s|#MYSQL_USER#|$MYSQL_USER|g" /opt/etc/grouper.hibernate.properties >> $log

sed -i "s|#MYSQL_PASSWORD#|$MYSQL_PASSWORD|g" /opt/etc/grouper.hibernate.properties >> $log

sed -i "s|#MYSQL_DATABASE#|$MYSQL_DATABASE|g" /opt/etc/grouper.hibernate.properties >> $log

# Transient DB whitelist capability for when schema changes are needed

sed -i "s|#MYSQL_HOST#|$MYSQL_HOST|g" /opt/etc/grouper.properties >> $log

sed -i "s|#MYSQL_USER#|$MYSQL_USER|g" /opt/etc/grouper.properties >> $log

sed -i "s|#MYSQL_DATABASE#|$MYSQL_DATABASE|g" /opt/etc/grouper.properties >> $log

cat /opt/etc/grouper.hibernate.properties >> $log

cat /opt/etc/grouper.properties >> $log
7 changes: 4 additions & 3 deletions container_files/bin/main.sh
@@ -10,11 +10,12 @@ if [ -e "/tmp/firsttimerunning" ]; then

set -e

/opt/bin/configure.sh
/opt/bin/configure.sh >> $log

/opt/bin/check.sh
/opt/bin/check.sh >> $log

rm -f /tmp/firsttimerunning
/opt/bin/cleanup.sh >> $log

else
echo "Grouper container has run." >> $log
echo "If there are problems, docker rm this container and try again." >> $log
File renamed without changes.
49 changes: 49 additions & 0 deletions container_files/etc/grouper.hibernate.properties
@@ -0,0 +1,49 @@
#
# Copyright 2014 Internet2
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# Grouper Hibernate Configuration
# $Id: grouper.hibernate.example.properties,v 1.9 2009-08-11 20:18:09 mchyzer Exp $
#

# The grouper hibernate config uses Grouper Configuration Overlays (documented on wiki)
# By default the configuration is read from grouper.hibernate.base.properties
# (which should not be edited), and the grouper.hibernate.properties overlays
# the base settings. See the grouper.hibernate.base.properties for the possible
# settings that can be applied to the grouper.hibernate.properties

########################################
## DB settings
########################################

# e.g. mysql: jdbc:mysql://localhost:3306/grouper
# e.g. p6spy (log sql): [use the URL that your DB requires]
# e.g. oracle: jdbc:oracle:thin:@server.school.edu:1521:sid
# e.g. hsqldb (a): jdbc:hsqldb:dist/run/grouper;create=true
# e.g. hsqldb (b): jdbc:hsqldb:hsql://localhost:9001/grouper
# e.g. postgres: jdbc:postgresql://localhost:5432/database
# e.g. mssql: jdbc:sqlserver://localhost:3280;databaseName=grouper
hibernate.connection.url = jdbc:mysql://#MYSQL_HOST#:3306/#MYSQL_DATABASE#

hibernate.connection.username = #MYSQL_USER#
# If you are using an empty password, depending upon your version of
# Java and Ant you may need to specify a password of "".
# Note: you can keep passwords external and encrypted: https://bugs.internet2.edu/jira/browse/GRP-122
hibernate.connection.password = #MYSQL_PASSWORD#


hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
hibernate.connection.driver_class = com.mysql.jdbc.Driver
File renamed without changes.
2 changes: 2 additions & 0 deletions container_files/etc/grouper.properties
@@ -0,0 +1,2 @@
db.change.allow.user.0=#MYSQL_USER#
db.change.allow.url.0=jdbc:mysql://#MYSQL_HOST#:3306/#MYSQL_DATABASE#
21 changes: 19 additions & 2 deletions tests/image.bats
@@ -2,8 +2,24 @@

load ../common

@test "MariaDB repo provisioned" {
docker run -i $maintainer/$imagename find /etc/yum.repos.d/MariaDB.repo
}

@test "Grouper directory created" {
docker run -i $maintainer/$imagename find /opt/grouper/$version
docker run -i $maintainer/$imagename find /opt/grouper/$version/grouper.installer.properties
}

@test "Grouper installer properties in correct position" {
docker run -i $maintainer/$imagename find /etc/yum.repos.d/MariaDB.repo
}

@test "Grouper hibernate properties template available" {
docker run -i $maintainer/$imagename find /opt/etc/grouper.hibernate.properties
}

@test "Grouper whitelist properties template available" {
docker run -i $maintainer/$imagename find /opt/etc/grouper.properties
}

@test "API binary directory created" {
@@ -20,4 +36,5 @@ load ../common

@test "WS directory created" {
docker run -i $maintainer/$imagename find /opt/grouper/$version/grouper.ws-$version
}
}

0 comments on commit 6de692d

Please sign in to comment.