Skip to content

Commit

Permalink
Added some files configuration in order to get grouper app running
Browse files Browse the repository at this point in the history
  • Loading branch information
villadalmine committed Sep 7, 2016
1 parent b4781fe commit 505e39a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
3 changes: 1 addition & 2 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 Down Expand Up @@ -41,4 +40,4 @@ VOLUME /opt/grouper/2.3.0/apache-tomcat-$TOMCAT_VERSION/logs

EXPOSE 8080 8009 8005

CMD ["/opt/bin/start.sh"]
CMD ["/opt/bin/start.sh"]
8 changes: 4 additions & 4 deletions container_files/bin/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
log="/tmp/grouper.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 >> $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
3 changes: 1 addition & 2 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
17 changes: 14 additions & 3 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,29 @@ then
echo "Not composed non-zero exit status: $laststatus"
exit 1
else
echo "Grouper was configured"
exit 0
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
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="$?"
while [ "$laststatus" != "0" ]; do
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" -e "use grouper; show tables;"
laststatus="$?"
sleep 5
echo "Trying to connect to mariadb container with $MYSQL_USER to database $MYSQL_DATABASE"
done
/opt/bin/main.sh
laststatus="$?"
echo "Composed status: $laststatus"
if [ "$laststatus" != "0" ]; then
echo "Composed non-zero exit status: $laststatus" >> $log
echo "Composed non-zero exit status: $laststatus"
exit 1
else
echo "Grouper was configured"
exit 0
fi
fi

0 comments on commit 505e39a

Please sign in to comment.