Skip to content

Commit

Permalink
Adding some grouper specifics, could not get installer functioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Van Fleet committed Aug 25, 2016
1 parent 40533b3 commit 43c34a6
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 43 deletions.
31 changes: 15 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM bigfleet/centos7base
FROM bigfleet/shibboleth_sp

# Define args and set a default value
ARG maintainer=tier
Expand All @@ -11,29 +11,28 @@ LABEL ImageType="Base"
LABEL ImageName=$imagename
LABEL ImageOS=centos7
LABEL Version=$version
ENV VERSION=$version
ENV TOMCAT_VERSION="6.0.35"

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

RUN curl -o /etc/yum.repos.d/security:shibboleth.repo \
http://download.opensuse.org/repositories/security://shibboleth/CentOS_7/security:shibboleth.repo \
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 \
dos2unix \
httpd \
expect \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel \
MariaDB-client \
mlocate \
mod_ssl \
shibboleth.x86_64 \
&& yum clean all \
&& rm /etc/httpd/conf.d/autoindex.conf \
&& rm /etc/httpd/conf.d/ssl.conf \
&& rm /etc/httpd/conf.d/userdir.conf \
&& rm /etc/httpd/conf.d/welcome.conf \
&& mkdir -p /opt/grouper \
&& curl -o /opt/grouper/grouperInstaller.jar http://software.internet2.edu/grouper/release/$version/grouperInstaller.jar
&& yum clean all

COPY httpd-shib-foreground /usr/local/bin/
COPY grouper-install-expect.exp /opt/grouper/$version
WORKDIR /opt/grouper/$version

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

EXPOSE 80 443
CMD ["httpd-shib-foreground"]
EXPOSE 8080 8009 8005
7 changes: 7 additions & 0 deletions MariaDB.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# MariaDB 5.5 CentOS repository list - created 2016-08-25 14:03 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
3 changes: 2 additions & 1 deletion common.bash
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
maintainer="bigfleet"
imagename="grouper"
imagename="grouper"
version="2.3.0"
124 changes: 124 additions & 0 deletions grouper-install-expect.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/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) \[<blank>\]: "
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 <enter> 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 <Connector> 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
8 changes: 2 additions & 6 deletions tests/image.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

load ../common

@test "Shibd binary available" {
docker run -i $maintainer/$imagename find /usr/sbin/shibd
}

@test "Shibboleth root available" {
docker run -i $maintainer/$imagename find /etc/shibboleth
@test "Grouper directory created" {
docker run -i $maintainer/$imagename find /opt/grouper/$version
}
20 changes: 0 additions & 20 deletions tests/running.bats

This file was deleted.

0 comments on commit 43c34a6

Please sign in to comment.