diff --git a/Dockerfile b/Dockerfile index 3a558802..8c2c6509 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM bigfleet/centos7base +FROM bigfleet/shibboleth_sp # Define args and set a default value ARG maintainer=tier @@ -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"] \ No newline at end of file +EXPOSE 8080 8009 8005 \ No newline at end of file diff --git a/MariaDB.repo b/MariaDB.repo new file mode 100644 index 00000000..96b9e1b6 --- /dev/null +++ b/MariaDB.repo @@ -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 \ No newline at end of file diff --git a/common.bash b/common.bash index d5cbc4de..1f1766ff 100644 --- a/common.bash +++ b/common.bash @@ -1,2 +1,3 @@ maintainer="bigfleet" -imagename="grouper" \ No newline at end of file +imagename="grouper" +version="2.3.0" \ No newline at end of file diff --git a/grouper-install-expect.exp b/grouper-install-expect.exp new file mode 100755 index 00000000..8a4f5df6 --- /dev/null +++ b/grouper-install-expect.exp @@ -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) \[\]: " +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 diff --git a/tests/image.bats b/tests/image.bats index 485b1533..86d52044 100644 --- a/tests/image.bats +++ b/tests/image.bats @@ -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 } \ No newline at end of file diff --git a/tests/running.bats b/tests/running.bats deleted file mode 100644 index 882aaeca..00000000 --- a/tests/running.bats +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bats - -load ../common - -# These tests assume the pipeline will start and stop the container. - -@test "Leaves running process" { - result="$(docker ps | grep $imagename)" - [ "$result" != '' ] -} - -@test "Exposes running HTTP service" { - result="$(docker exec -i $imagename curl http://localhost/)" - [ "$result" != '' ] -} - -@test "Exposes running SSO process" { - result="$(docker exec -i $imagename curl http://localhost/Shibboleth.sso/Status)" - [ "$result" != '' ] -} \ No newline at end of file