Skip to content

Grouper fix #2

Merged
8 commits merged into from
Sep 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ LABEL ImageOS=centos7
LABEL Version=$version
ENV VERSION=$version
ENV TOMCAT_VERSION="6.0.35"

ENV WAIT_TIME=60

LABEL Build docker build --rm --tag $maintainer/$imagename .
Expand All @@ -34,11 +33,11 @@ RUN mkdir -p /opt/grouper/$VERSION \
&& yum clean all

# The installer creates a HSQL DB which we ignore later

WORKDIR /opt/grouper/$version
RUN java -cp :grouperInstaller.jar edu.internet2.middleware.grouperInstaller.GrouperInstaller

VOLUME /opt/grouper/2.3.0/apache-tomcat-$TOMCAT_VERSION/logs

EXPOSE 8080 8009 8005

CMD ["/opt/bin/start.sh"]
EXPOSE 8080 8009 8005
CMD ["/opt/bin/start.sh"]
12 changes: 6 additions & 6 deletions container_files/bin/check.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/bash

log="/tmp/grouper.log"

log="/tmp/grouper-check.log"
date >> $log
echo "Installing schema" >> $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 -drop -runscript -noprompt
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 -drop -runscript -noprompt >> $log

echo "Preparing subjects" >> $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 -runsqlfile /opt/grouper/2.3.0/subjects.sql -noprompt
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 -runsqlfile /opt/grouper/2.3.0/subjects.sql -noprompt >> $log

echo "Adding Quickstart data" >> $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 -xmlimportold GrouperSystem /opt/grouper/2.3.0/quickstart.xml -noprompt
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 -xmlimportold GrouperSystem /opt/grouper/2.3.0/quickstart.xml -noprompt >> $log

echo "Checking" >> $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 >> $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 --noprompt >> $log
12 changes: 9 additions & 3 deletions container_files/bin/cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

log="/tmp/grouper.log"

rm -f /tmp/firsttimerunning >> $log
log="/tmp/grouper-cleanup.log"
date >> $log
if [ -z ${COMPOSE+x} ];then
echo "Not composed so not waiting for MariaDB and first time running was ok: " >> $log
rm -f /tmp/firsttimerunning >> $log
else
echo "Composed with MariaDB, running completed" >> $log
rm -f /tmp/firsttimerunning >> $log
fi
6 changes: 3 additions & 3 deletions container_files/bin/configure.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

log="/tmp/grouper.log"

log="/tmp/grouper-configure.log"
date >> $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
Expand All @@ -24,4 +24,4 @@ sed -i "s|#MYSQL_DATABASE#|$MYSQL_DATABASE|g" /opt/etc/grouper.properties >> $lo

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

cat /opt/etc/grouper.properties >> $log
cat /opt/etc/grouper.properties >> $log
5 changes: 2 additions & 3 deletions container_files/bin/main.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -x

log="/tmp/start.log"
log="/tmp/start-main.log"

echo "Starting Container: " > $log
date >> $log
Expand All @@ -20,5 +20,4 @@ else
echo "Grouper container has run." >> $log
echo "If there are problems, docker rm this container and try again." >> $log
fi

exit 0
#exit 0
35 changes: 30 additions & 5 deletions container_files/bin/start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

log="/tmp/start.log"

log="/tmp/start-starting.log"
date >> $log
if [ -z ${COMPOSE+x} ]
then
echo "Not composed so not waiting for MariaDB: " > $log
Expand All @@ -13,18 +13,43 @@ then
echo "Not composed non-zero exit status: $laststatus"
exit 1
else
exit 0
echo "Grouper was configured" >>$log
echo "Grouper was configured"
echo "Starting tomcat and apache" >>$log
echo "Starting tomcat and apache"
/usr/local/bin/httpd-shib-foreground &
/opt/grouper/2.3.0/apache-tomcat-6.0.35/bin/catalina.sh run
fi
else
echo "Composed so waiting for MariaDB: " > $log
/opt/wait-for-it/wait-for-it.sh $MYSQL_HOST:3306 -t $WAIT_TIME --strict -- /opt/bin/main.sh
date >> $log
echo "Testing connectivy to database before continue with install"
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" -e "use grouper; show tables;"
laststatus="$?"
echo "checking connectivity" >> $log
while [ "$laststatus" != "0" ]; do
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" -e "use grouper; show tables;"
laststatus="$?"
sleep 5
date >> $log
echo "Trying to connect to mariadb container with $MYSQL_USER to database $MYSQL_DATABASE"
echo "Trying to connect to mariadb container with $MYSQL_USER to database $MYSQL_DATABASE" >> $log
done
/opt/bin/main.sh
laststatus="$?"
echo "Composed status: $laststatus"
echo "Composed status: $laststatus" >>$log
if [ "$laststatus" != "0" ]; then
echo "Composed non-zero exit status: $laststatus" >> $log
echo "Composed non-zero exit status: $laststatus"
exit 1
else
exit 0
echo "Grouper was configured" >>$log
echo "Grouper was configured"
echo "Starting tomcat and apache" >>$log
echo "Starting tomcat and apache"
date >> $log
/usr/local/bin/httpd-shib-foreground &
/opt/grouper/2.3.0/apache-tomcat-6.0.35/bin/catalina.sh run
fi
fi