From 194ea09e32ed0c88de9ab67e6bf3d2966e376d4b Mon Sep 17 00:00:00 2001 From: Archimedes Trajano Date: Mon, 22 May 2017 15:46:19 -0400 Subject: [PATCH 1/4] Added v9.0.0.3 fixes https://github.com/WASdev/ci.docker.ibm-http-server/issues/19 --- ilan/README.md | 3 ++- ilan/versions.csv | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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/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 From 51e4bdc7390fe5ff7088bc237c46e6630808f556 Mon Sep 17 00:00:00 2001 From: Archimedes Trajano Date: Tue, 23 May 2017 09:08:47 -0400 Subject: [PATCH 2/4] Optimized build process Moved the logic of building the images into docker. Removed using any absolute paths on the build system (i.e. $(pwd) which does not work correctly on Windows) Added .gitattributes to ensure line endings for files being used in the Docker build containers are correct. Please compare with whitespace checks turned off. In order to support builds within the container bsdtar needs to be used rather than the regular tar due to https://github.com/docker/hub-feedback/issues/727 The tar server was also removed in favor of copying from the container to the "im" folder and imported back using Dockerfile for the final image. The step where the files are tarred in install_ihs was removed and put into docker. This makes it easier to debug issues with tar --- ilan/.gitattributes | 2 + ilan/Dockerfile | 68 ++++++++++++++++++---------- ilan/Dockerfile.template | 34 ++++++++++++++ ilan/build | 12 ++--- ilan/im/.gitignore | 3 ++ ilan/im/Dockerfile | 31 ------------- ilan/im/NOTES.md | 3 ++ ilan/{install_ihs => install_ihs.sh} | 4 -- 8 files changed, 91 insertions(+), 66 deletions(-) create mode 100644 ilan/.gitattributes create mode 100644 ilan/Dockerfile.template create mode 100644 ilan/im/.gitignore delete mode 100644 ilan/im/Dockerfile create mode 100644 ilan/im/NOTES.md rename ilan/{install_ihs => install_ihs.sh} (95%) mode change 100755 => 100644 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..15e87d2 100644 --- a/ilan/Dockerfile +++ b/ilan/Dockerfile @@ -1,30 +1,50 @@ -############################################################################ -# (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. # +########################################################################### -FROM ubuntu:16.04 +# 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 -MAINTAINER Kavitha Suresh Kumar +FROM ubuntu:16.04 -RUN apt-get update && apt-get install -y openssl wget +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' -ARG TAR_URL +# 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 -COPY ihsstart.sh /work/ +ENV PATH /opt/IBM/InstallationManager/eclipse/tools:$PATH +RUN mkdir /host +RUN mkdir /target +COPY install_ihs.sh /host +COPY versions.csv /host +COPY Dockerfile.template /host +RUN chmod 700 /host/install_ihs.sh -RUN wget -q -O - $TAR_URL | tar xz -ENV PATH /opt/IBM/HTTPServer/bin:$PATH -CMD ["/work/ihsstart.sh"] +# 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 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/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/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 From e9461120bf0c075bdd30c3692712338e09396f70 Mon Sep 17 00:00:00 2001 From: Archimedes Trajano Date: Wed, 24 May 2017 17:09:45 -0400 Subject: [PATCH 3/4] Simplified ihsstart.sh No need for traps and shutdown hooks, simply run IHS in foreground and it will handle the shutdowns properly. Fixes https://github.com/WASdev/ci.docker.ibm-http-server/issues/23 Signed-off-by: Archimedes Trajano --- ilan/ihsstart.sh | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) 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 From 83a8bca65cae7189552fdb8eae8649a5891d016e Mon Sep 17 00:00:00 2001 From: Archimedes Trajano Date: Wed, 24 May 2017 17:19:54 -0400 Subject: [PATCH 4/4] Moved the order of the Dockerfile.template Do it after the tar is complete. That way if there are any problems in the Dockerfile.template it will not require a rebuild Signed-off-by: Archimedes Trajano --- ilan/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ilan/Dockerfile b/ilan/Dockerfile index 15e87d2..213a267 100644 --- a/ilan/Dockerfile +++ b/ilan/Dockerfile @@ -38,7 +38,6 @@ RUN mkdir /host RUN mkdir /target COPY install_ihs.sh /host COPY versions.csv /host -COPY Dockerfile.template /host RUN chmod 700 /host/install_ihs.sh # requires envvars @@ -47,4 +46,7 @@ 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 + +# Build the version specific Docker file +COPY Dockerfile.template /host RUN sed s/@VERSION@/${VERSION}/ /host/Dockerfile.template > /target/Dockerfile.${VERSION}