diff --git a/ilan/.gitattributes b/ilan/.gitattributes new file mode 100644 index 0000000..999d91f --- /dev/null +++ b/ilan/.gitattributes @@ -0,0 +1,2 @@ +*.sh eol=lf +*.csv eol=lf diff --git a/ilan/Dockerfile b/ilan/Dockerfile index 4dff2cd..213a267 100644 --- a/ilan/Dockerfile +++ b/ilan/Dockerfile @@ -1,30 +1,52 @@ -############################################################################ -# (C) Copyright IBM Corporation 2015. # -# # -# Licensed under the Apache License, Version 2.0 (the "License"); # -# you may not use this file except in compliance with the License. # -# You may obtain a copy of the License at # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # -# See the License for the specific language governing permissions and # -# limitations under the License. # -# # -############################################################################ +########################################################################### +# (C) Copyright IBM Corporation 2015, 2016. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# +# See the License for the specific language governing permissions and # +# limitations under the License. # +########################################################################### + +# This Dockerfile is meant to download the requisite software and tar them +# up for the final DockerFile which will not have the IBM_ID and +# IBM_PASSWORD saved FROM ubuntu:16.04 -MAINTAINER Kavitha Suresh Kumar +RUN apt-get update && apt-get install --no-install-recommends -y unzip bsdtar && rm -rf /var/lib/apt/lists/* +# BSD tar is need to prevent errors on Docker builds +# see https://github.com/docker/hub-feedback/issues/727 +RUN export tar='bsdtar' -RUN apt-get update && apt-get install -y openssl wget +# Install IBM Installation Manager +COPY im/agent.installer.linux.gtk.x86_64_*.zip /tmp/ +RUN unzip -qd /tmp/im /tmp/agent.installer.linux.gtk.x86_64_*.zip \ + && /tmp/im/installc -acceptLicense -accessRights nonAdmin \ + -installationDirectory "/opt/IBM/InstallationManager" \ + -dataLocation "/var/ibm/InstallationManager" -showProgress \ + && rm -rf /tmp/agent.installer.linux.gtk.x86_65_*.zip /tmp/im -ARG TAR_URL +ENV PATH /opt/IBM/InstallationManager/eclipse/tools:$PATH +RUN mkdir /host +RUN mkdir /target +COPY install_ihs.sh /host +COPY versions.csv /host +RUN chmod 700 /host/install_ihs.sh -COPY ihsstart.sh /work/ +# requires envvars +ARG VERSION +ARG IBM_ID +ARG IBM_PASSWORD +RUN /host/install_ihs.sh +RUN tar zcf /target/ihs${VERSION}.tar.gz /opt/IBM/HTTPServer /opt/IBM/WebSphere/Plugins /opt/IBM/WebSphere/Toolbox -RUN wget -q -O - $TAR_URL | tar xz -ENV PATH /opt/IBM/HTTPServer/bin:$PATH -CMD ["/work/ihsstart.sh"] +# Build the version specific Docker file +COPY Dockerfile.template /host +RUN sed s/@VERSION@/${VERSION}/ /host/Dockerfile.template > /target/Dockerfile.${VERSION} diff --git a/ilan/Dockerfile.template b/ilan/Dockerfile.template new file mode 100644 index 0000000..3b7f9c2 --- /dev/null +++ b/ilan/Dockerfile.template @@ -0,0 +1,34 @@ +############################################################################ +# (C) Copyright IBM Corporation 2015. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +############################################################################ + +# This is a template Dockerfile which will have version of the tar expected +# in the COPY command set during the previous docker build. + +FROM ubuntu:16.04 + +MAINTAINER Kavitha Suresh Kumar + +RUN apt-get update && apt-get install --no-install-recommends -y unzip bsdtar && rm -rf /var/lib/apt/lists/* +# BSD tar is need to prevent errors on Docker builds +# see https://github.com/docker/hub-feedback/issues/727 +RUN export tar='bsdtar' + +COPY ihsstart.sh /work/ +COPY im/ihs@VERSION@.tar.gz /ihs.tar.gz +RUN tar xzf /ihs.tar.gz && rm /ihs.tar.gz +ENV PATH /opt/IBM/HTTPServer/bin:$PATH +CMD ["/work/ihsstart.sh"] diff --git a/ilan/README.md b/ilan/README.md index ca0171d..f5708a5 100644 --- a/ilan/README.md +++ b/ilan/README.md @@ -8,9 +8,10 @@ Versions available: 8.5.5.9 8.5.5.10 9.0.0.0 +9.0.0.3 Pre-req -You are required to download a version of IBM Installation Manager above version 8 and place it into the /ilan/im directory. +You are required to download a version of IBM Installation Manager above version 1.8 and place it into the /ilan/im directory. Download Location: [IBM Support] (http://www-01.ibm.com/support/docview.wss?uid=swg27025142) If you require all available versions of IHS then simply run the script buildAll with the arguments of a IBM ID and password. These are required for downloading the binaries as part of the installation. If you just want to build a specific version then you can run the build script with the version you require followed by an IBM ID and password. diff --git a/ilan/build b/ilan/build index bd96a24..9776c44 100755 --- a/ilan/build +++ b/ilan/build @@ -21,15 +21,13 @@ if [ $# != 3 ]; then exit 1 fi -docker build -t installation-manager im || exit $? -docker run --rm -v $(pwd):/host installation-manager /host/install_ihs $1 $2 $3 || exit $? +docker build -t installation-manager . --build-arg VERSION=$1 --build-arg IBM_ID=$2 --build-arg IBM_PASSWORD=$3|| exit $? -docker run -d --name tar_server -v $(pwd)/ihs$1.tar.gz:/host/ihs$1.tar.gz -w /host python:2-slim python -m SimpleHTTPServer -tar_server_ip=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' tar_server) -tar_url="http://${tar_server_ip}:8000/ihs${1}.tar.gz" +# copy the intermediate artifacts from /target +docker run installation-manager cat /target/ihs$1.tar.gz > im/ihs$1.tar.gz +docker run installation-manager cat /target/Dockerfile.$1 > im/Dockerfile.$1 # Build image from hosted tar file echo "Building image" -docker build -t ibm-http-server:$1 --build-arg TAR_URL=$tar_url . || exit $? -docker rm -f tar_server +docker build -t ibm-http-server:$1 -f im/DockerFile.$1 . || exit $? diff --git a/ilan/ihsstart.sh b/ilan/ihsstart.sh index 8b00ec6..4c5b0c6 100755 --- a/ilan/ihsstart.sh +++ b/ilan/ihsstart.sh @@ -7,38 +7,5 @@ # # ##################################################################################### -startServer() -{ - echo "Starting IBM HTTP Server " - # Starting IBM HTTPServer - /opt/IBM/HTTPServer/bin/apachectl start - - if [ $? = 0 ] - then - echo "IBM HTTP Server started successfully" - else - echo "Failed to start IBM HTTP Server" - fi -} - -stopServer() -{ - echo "Stopping IBM HTTP Server " - # Stopping IBM HTTPServer - /opt/IBM/HTTPServer/bin/apachectl graceful-stop - if [ $? = 0 ] - then - echo "IBM HTTP Server stopped successfully" - fi -} - -startServer - -trap "stopServer" SIGTERM - -sleep 10 - -while [ -f "/opt/IBM/HTTPServer/logs/httpd.pid" ] -do - sleep 5 -done +. /opt/IBM/HTTPServer/bin/envvars +exec /opt/IBM/HTTPServer/bin/httpd -d /opt/IBM/HTTPServer -DFOREGROUND diff --git a/ilan/im/.gitignore b/ilan/im/.gitignore new file mode 100644 index 0000000..fab99fb --- /dev/null +++ b/ilan/im/.gitignore @@ -0,0 +1,3 @@ +*.zip +*.tar.gz +DockerFile.* diff --git a/ilan/im/Dockerfile b/ilan/im/Dockerfile deleted file mode 100644 index 6c0a031..0000000 --- a/ilan/im/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -########################################################################### -# (C) Copyright IBM Corporation 2015, 2016. # -# # -# Licensed under the Apache License, Version 2.0 (the "License"); # -# you may not use this file except in compliance with the License. # -# You may obtain a copy of the License at # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# -# See the License for the specific language governing permissions and # -# limitations under the License. # -########################################################################### - -FROM ubuntu:16.04 - -RUN apt-get update && apt-get install -y unzip - -# Install IBM Installation Manager -COPY agent.installer.linux.gtk.x86_64_*.zip /tmp/ -RUN unzip -qd /tmp/im /tmp/agent.installer.linux.gtk.x86_64_*.zip \ - && /tmp/im/installc -acceptLicense -accessRights nonAdmin \ - -installationDirectory "/opt/IBM/InstallationManager" \ - -dataLocation "/var/ibm/InstallationManager" -showProgress \ - && rm -rf /tmp/agent.installer.linux.gtk.x86_65_*.zip /tmp/im - -ENV PATH /opt/IBM/InstallationManager/eclipse/tools:$PATH diff --git a/ilan/im/NOTES.md b/ilan/im/NOTES.md new file mode 100644 index 0000000..4b34b0d --- /dev/null +++ b/ilan/im/NOTES.md @@ -0,0 +1,3 @@ +This folder is where `agent.installer.linux.gtk.x85_64_*.zip` is expected to be stored. The file is ignored for source control. + +In addition intermediate artifacts are stored here and will also be ignored by source control. \ No newline at end of file diff --git a/ilan/install_ihs b/ilan/install_ihs.sh old mode 100755 new mode 100644 similarity index 95% rename from ilan/install_ihs rename to ilan/install_ihs.sh index 4e2d0ec..2ab9865 --- a/ilan/install_ihs +++ b/ilan/install_ihs.sh @@ -16,9 +16,6 @@ # limitations under the License. # ########################################################################### -VERSION=$1 -IBM_ID=$2 -IBM_PASSWORD=$3 echo "Running build for versions: "$VERSION SECURE_STORAGE_FILE=/tmp/credentials @@ -79,4 +76,3 @@ function install_version() { install_version -tar -zcf /host/ihs${VERSION}.tar.gz /opt/IBM/HTTPServer /opt/IBM/WebSphere/Plugins /opt/IBM/WebSphere/Toolbox diff --git a/ilan/versions.csv b/ilan/versions.csv index 63f0065..d3b320e 100644 --- a/ilan/versions.csv +++ b/ilan/versions.csv @@ -2,3 +2,4 @@ 8.5.5.10,/opt/IBM/HTTPServer|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.IHSILAN.v85|com.ibm.websphere.IHSILAN.v85_8.5.5010.20160721_0036,/opt/IBM/WebSphere/Plugins|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.PLGILAN.v85|com.ibm.websphere.PLGILAN.v85_8.5.5010.20160721_0036,/opt/IBM/WebSphere/Toolbox|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.WCTILAN.v85|com.ibm.websphere.WCTILAN.v85_8.5.5010.20160721_0036 8.5.5.9,/opt/IBM/HTTPServer|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.IHSILAN.v85|com.ibm.websphere.IHSILAN.v85_8.5.5009.20160225_0435,/opt/IBM/WebSphere/Plugins|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.PLGILAN.v85|com.ibm.websphere.PLGILAN.v85_8.5.5009.20160225_0435,/opt/IBM/WebSphere/Toolbox|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.WCTILAN.v85|com.ibm.websphere.WCTILAN.v85_8.5.5009.20160225_0435 9.0.0.0,/opt/IBM/HTTPServer|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.IHS.v90|com.ibm.java.jdk.v8 com.ibm.websphere.IHS.v90_9.0.0.20160526_1854,/opt/IBM/WebSphere/Plugins|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.PLG.v90|com.ibm.java.jdk.v8 com.ibm.websphere.PLG.v90_9.0.1.20160906_0049,/opt/IBM/WebSphere/Toolbox|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.WCT.v90|com.ibm.java.jdk.v8 com.ibm.websphere.WCT.v90_9.0.0.20160526_1854 +9.0.0.3,/opt/IBM/HTTPServer|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.IHS.v90|com.ibm.java.jdk.v8 com.ibm.websphere.IHS.v90_9.0.3.20170217_1945,/opt/IBM/WebSphere/Plugins|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.PLG.v90|com.ibm.java.jdk.v8 com.ibm.websphere.PLG.v90_9.0.3.20170217_1945,/opt/IBM/WebSphere/Toolbox|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.WCT.v90|com.ibm.java.jdk.v8 com.ibm.websphere.WCT.v90_9.0.3.20170217_1945