From a96a0de3bade5fa871744a3ef1ff3b797cf5d991 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Fri, 2 Sep 2016 10:55:40 -0400 Subject: [PATCH] Sharing with group --- Dockerfile | 13 ++- container_files/configure.sh | 3 + container_files/container_start.sh | 22 +++++ grouper-install-expect.exp | 124 ----------------------------- 4 files changed, 34 insertions(+), 128 deletions(-) create mode 100755 container_files/configure.sh create mode 100755 container_files/container_start.sh delete mode 100755 grouper-install-expect.exp diff --git a/Dockerfile b/Dockerfile index 1f4df823..79dcf569 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,19 +21,24 @@ COPY MariaDB.repo /etc/yum.repos.d/MariaDB.repo RUN mkdir -p /opt/grouper/$VERSION \ && curl -o /opt/grouper/$VERSION/grouperInstaller.jar http://software.internet2.edu/grouper/release/$VERSION/grouperInstaller.jar \ && yum -y update \ - && yum -y install \ + && yum -y install --setopt=tsflags=nodocs \ dos2unix \ - expect \ java-1.8.0-openjdk \ java-1.8.0-openjdk-devel \ MariaDB-client \ mlocate \ && yum clean all +# Add starters and installers +ADD ./container_files /root COPY grouper.installer.properties /opt/grouper/$version + +# The installer creates a HSQL DB which we ignore later WORKDIR /opt/grouper/$version -RUN java -cp .:grouperInstaller.jar edu.internet2.middleware.grouperInstaller.GrouperInstaller +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 \ No newline at end of file +EXPOSE 8080 8009 8005 + +CMD ["/root/container_start.sh"] \ No newline at end of file diff --git a/container_files/configure.sh b/container_files/configure.sh new file mode 100755 index 00000000..176b8d87 --- /dev/null +++ b/container_files/configure.sh @@ -0,0 +1,3 @@ +#!/bin/bash -x + +# Configure your access (e.g. rewriting grouper.installer.properties) here \ No newline at end of file diff --git a/container_files/container_start.sh b/container_files/container_start.sh new file mode 100755 index 00000000..0910a480 --- /dev/null +++ b/container_files/container_start.sh @@ -0,0 +1,22 @@ +#!/bin/bash -x + +log="/tmp/start.log" + +echo "Starting Container: " > $log +date >> $log +echo "" >> $log + +if [ -e "/tmp/firsttimerunning" ]; then + + set -e + + /root/configure.sh + + 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 -check + + rm -f /tmp/firsttimerunning +else + echo "Grouper DB already provisioned" >> $log +fi + +exit 0 diff --git a/grouper-install-expect.exp b/grouper-install-expect.exp deleted file mode 100755 index 8a4f5df6..00000000 --- a/grouper-install-expect.exp +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/expect -f - -# -# This Expect script was generated by autoexpect on Mon Apr 11 01:27:48 2016 -# Expect and autoexpect were both written by Don Libes, NIST. -# -# Note that autoexpect does not guarantee a working script. It -# necessarily has to guess about certain things. Two reasons a script -# might fail are: -# -# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet, -# etc.) and devices discard or ignore keystrokes that arrive "too -# quickly" after prompts. If you find your new script hanging up at -# one spot, try adding a short sleep just before the previous send. -# Setting "force_conservative" to 1 (see below) makes Expect do this -# automatically - pausing briefly before sending each character. This -# pacifies every program I know of. The -c flag makes the script do -# this in the first place. The -C flag allows you to define a -# character to toggle this mode off and on. - -set force_conservative 1 ;# set to 1 to force conservative mode even if - ;# script wasn't run conservatively originally -if {$force_conservative} { - set send_slow {1 .1} - proc send {ignore arg} { - sleep .1 - exp_send -s -- $arg - } -} - -# -# 2) differing output - Some programs produce different output each time -# they run. The "date" command is an obvious example. Another is -# ftp, if it produces throughput statistics at the end of a file -# transfer. If this causes a problem, delete these patterns or replace -# them with wildcards. An alternative is to use the -p flag (for -# "prompt") which makes Expect only look for the last line of output -# (i.e., the prompt). The -P flag allows you to define a character to -# toggle this mode off and on. -# -# Read the man page for more info. -# -# -Don - - -set timeout -1 -spawn java -jar grouperInstaller.jar -match_max 100000 -expect -exact "" -send -- "\r" -expect -exact " (enter: 'install', 'upgrade', 'patch', 'createPatch' or blank for the default) \[install\]: " -send -- "\r" -expect -exact "Enter in the Grouper install directory (note: better if no spaces or special chars) \[/home/grouper/2.3.0\]: " -send -- "\r\r" -#expect -re "Enter the default IP address for checking ports" -#send -- "\r" -expect -exact "Do you want to set gsh script to executable (t|f)? \[t\]: " -send -- "\r" -expect -exact "Do you want to run dos2unix on gsh.sh (t|f)? \[t\]: " -send -- "\r" -expect -exact "Do you want to use the default and included hsqldb database (t|f)? \[t\]: " -send -- "f\r" -expect -exact "Enter the database URL \[jdbc:hsqldb:hsql://localhost:9001/grouper\]: " -send -- "jdbc:mysql://172.17.0.2:3306/grouper" -send -- "\r" -expect -exact "Database user \[sa\]: " -send -- "grouper\r" -expect -exact "Database password (note, you aren't setting the pass here, you are using an existing pass, this will be echoed back) \[\]: " -send -- "changeme\r" -expect -exact "Would you like to install all patches (t|f)? \[t\]: " -send -- "\r" -expect -exact "Please stop these processes if they are running and press to continue..." -send -- "\r" -expect -exact "Do you want to init the database (delete all existing grouper tables, add new ones) (t|f)? " -send -- "t\r" -expect -exact "Do you want to add quickstart subjects to DB (t|f)? \[t\]: " -send -- "\r" -expect -exact "Do you want to add quickstart data to registry (t|f)? \[t\] " -send -- "\r" -expect -exact "Do you want to set the tomcat memory limit (t|f)? \[t\]: " -send -- "\r" -expect -exact "Do you want to set tomcat scripts to executable (t|f)? \[t\]: " -send -- "\r" -expect -exact "Do you want to run dos2unix on tomcat sh files (t|f)? \[t\]: " -send -- "\r" -expect -exact "What ports do you want tomcat to run on (HTTP, JK, shutdown): \[8080, 8009, 8005\]: " -send -- "\r" -expect -exact "Do you want to set URIEncoding to UTF-8 in tomcat server.xml elements (t|f)? \[t\]: " -send -- "\r" -expect -exact "Should we stop tomcat anyway? (t|f)? \[f\] " -send -- "\r" -expect -exact "Do you want to set the log dir of UI (t|f)? \[t\]: " -send -- "\r" -expect -exact "Enter the UI log dir: \[/home/grouper/2.2.2/apache-tomcat-6.0.35/logs/grouperUi\]: " -send -- "\r" -expect -exact "Enter the URL path for the UI \[grouper\]: " -send -- "\r" -expect -exact "Enter the GrouperSystem password: " -send -- "changeme\r" -expect -exact "Do you want to set the GrouperSystem password in /home/grouper/2.2.2/apache-tomcat-6.0.35/conf/tomcat-users.xml? \[t\]: " -send -- "\r" -expect -exact "Should we stop tomcat anyway? (t|f)? \[f\] " -send -- "\r" -expect -exact "Should we check ports to see if tomcat was able to start (t|f)? \[t\]: " -send -- "\r" -expect -exact "The Grouper WS has been built in the past, do you want it rebuilt? (t|f) \[t\]: " -send -- "\r" -expect -exact "Should we check ports to see if tomcat was able to stop (t|f)? \[t\]: " -send -- "\r" -expect -exact "Do you want to set the log dir of WS (t|f)? \[t\]: " -send -- "\r" -expect -exact "Enter the WS log dir: \[/home/grouper/2.2.2/apache-tomcat-6.0.35/logs/grouperWs\]: " -send -- "\r" -expect -exact "Enter the URL path for the WS \[grouper-ws\]: " -send -- "\r" -expect -exact "Should we stop tomcat anyway? (t|f)? \[f\] " -send -- "\r" -expect -exact "Should we check ports to see if tomcat was able to start (t|f)? \[t\]: " -send -- "\r" -expect -exact "Do you want to install the provisioning service provider (t|f)? \[t\]: " -send -- "\r" -expect -exact " (note, if it is already running, you need to stop it now, check ps -ef | grep gsh | grep loader) (t|f)? \[f\]: " -send -- "\r" -expect eof \ No newline at end of file