Skip to content

Commit 0d76683

Browse files
committed
Provided support to get ready for dynamicRouting
The code is written out, but mostly commented out to use static routing until WASdev/ci.docker.ibm-http-server#22 is merged
1 parent b61457d commit 0d76683

File tree

12 files changed

+53
-70
lines changed

12 files changed

+53
-70
lines changed

src/docker/README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ docker stack deploy --compose-file docker-compose.yml jeesample
44
The controller replica may need to have a separate server so there's one "primary" which has the `volume` and the rest will pull from the core one.
55

66

7-
pluginUtility generate --server=adminUser:adminPassword@controller:9443 --cluster=defaultCluster
8-
9-
cat /defaultCluster-plugin-cfg.xml
10-
11-
docker exec 82246b134e6b collective unregisterHost 3643a3abdfdf --user=adminUser --password=adminPassword --port=9443 --host=controller --autoAcceptCertificates
12-
137
# Notes
148

159
* May need to change the appserver.base to just have SSH and WLP only do not start and then use autoscale to provision the server.
@@ -22,4 +16,5 @@ docker cp deployable.zip 98eac34a77af:/opt/ibm/wlp/usr/shared/stackGroups/defaul
2216

2317
# TODO
2418

25-
* Replica Sets for the controller
19+
* Replica Sets for the controller (does not work correctly at the moent)
20+
* Dyanmic Routing (needs updated WebSphere Plugin with IHS)

src/docker/appserver.base/DockerFile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM websphere-liberty:javaee7
2-
RUN apt-get update && apt-get install -y openssh-server curl && rm -rf /var/lib/apt/lists/*
2+
RUN apt-get update && apt-get install -y openssh-server && rm -rf /var/lib/apt/lists/*
33
RUN installUtility install --acceptLicense clusterMember-1.0 scalingMember-1.0
44

55
COPY . /config/

src/docker/appserver.base/startServer.sh

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
#!/bin/bash
2-
# wait for controller to be up
3-
while ! curl --insecure -s https://controller:9443/ --output /dev/null; do
4-
sleep 0.1 # wait for 1/10 of the second before check again
5-
done
6-
7-
# Joining the collective needs to be done at runtime as the controller needs to be up.
8-
92
PASSWORD=$(openssl rand -base64 32)
103
#ssh-keygen -t rsa -f $HOME/.ssh/id_rsa -N ""
114
ssh-keygen -t rsa -N ""
@@ -21,7 +14,7 @@ ssh-keygen -t rsa -N ""
2114
# --sshPrivateKey=$HOME/.ssh/id_rsa \
2215
# --hostWritePath=/
2316

24-
/opt/ibm/wlp/bin/collective join defaultServer \
17+
while ! collective join defaultServer \
2518
--host=controller \
2619
--port=9443 \
2720
--user=adminUser \
@@ -30,12 +23,13 @@ ssh-keygen -t rsa -N ""
3023
--keystorePassword=$PASSWORD \
3124
--hostJavaHome=$JAVA_HOME \
3225
--createConfigFile=/config/collective-join-include.xml
33-
34-
# --sshPrivateKey=$HOME/.ssh/id_rsa \
26+
do
27+
sleep 1 # wait for 1/10 of the second before check again
28+
done
3529

3630
# Unregister host when the script will terminate
3731
unregisterHost() {
38-
/opt/ibm/wlp/bin/collective unregisterHost $(hostname) \
32+
collective unregisterHost $(hostname) \
3933
--host=controller \
4034
--port=9443 \
4135
--user=adminUser \

src/docker/build.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
docker build -t controller controller && docker tag controller trajano/jee-controller:base && docker push trajano/jee-controller:base
2+
rem docker build -t controller.replica controller.replica && docker tag controller.replica trajano/jee-controller:replica && docker push trajano/jee-controller:replica
23
docker build -t trajano/jee-appserver:base appserver.base && docker tag trajano/jee-appserver:base trajano/jee-appserver:base && docker push trajano/jee-appserver:base
34

45
rem docker build -t trajano/jee-appserver:withapp appserver

src/docker/controller/DockerFile

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
1-
# FROM websphere-liberty:kernel
21
FROM websphere-liberty:javaee7
32
RUN installUtility install --acceptLicense collectiveController-1.0 adminCenter-1.0 scalingController-1.0 dynamicRouting-1.0
4-
RUN apt-get update && apt-get install -y openssh-server zip && rm -rf /var/lib/apt/lists/*
5-
RUN mkdir -p /opt/ibm/wlp/usr/shared/stackGroups/defaultStackGroup/installables && \
6-
server package --include=wlp --archive=/opt/ibm/wlp/usr/shared/stackGroups/defaultStackGroup/installables/wlp.default.zip
7-
RUN cd /opt/ibm/java && \
8-
zip -r /opt/ibm/wlp/usr/shared/stackGroups/defaultStackGroup/installables/jre.default.zip .
9-
103
COPY . /config/
11-
# RUN collective create defaultServer --keystorePassword=controllerKSPassword --createConfigFile=/config/collective-create-include.xml
12-
13-
RUN mkdir /var/run/sshd && chmod 0755 /var/run/sshd
14-
RUN echo 'root:screencast' | chpasswd
15-
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
16-
RUN sed -i "s/#PasswordAuthentication yes/PasswordAuthentication yes/" /etc/ssh/sshd_config
17-
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
18-
19-
EXPOSE 22
204
EXPOSE 9080
215
EXPOSE 9443
226
CMD ["/config/startController.sh"]

src/docker/controller/server.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@
1414
<defaultScalingPolicy enabled="true" min="2" max="2"/>
1515
</scalingDefinitions>
1616
<include location="${server.config.dir}/resources/collective/collective-create-include.xml"/>
17-
<stackManager controllerUser="adminUser" controllerUserPassword="adminPassword"/>
1817
</server>

src/docker/controller/startController.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ createCollective() {
88
sed -i 's#<quickStartSecurity .*/>#<quickStartSecurity userName="adminUser" userPassword="adminPassword"/>#' /config/resources/collective/collective-create-include.xml
99
}
1010
[ -e /config/resources/collective/collective-create-include.xml ] || createCollective
11-
/usr/sbin/sshd -D &
12-
1311
exec /opt/ibm/wlp/bin/server run defaultServer

src/docker/docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ services:
66
- "9443:9443"
77
volumes:
88
- 'collective_resources:/config/resources'
9+
# controller-replica:
10+
# image: trajano/jee-controller:replica
11+
# deploy:
12+
# replicas: 2
13+
# volumes:
14+
# - 'collective_resources:/controllerResources'
915
webserver:
1016
image: trajano/jee-webserver:base
1117
deploy:

src/docker/webserver/DockerFile

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
11
FROM ibmcom/ibm-http-server:latest
2+
#FROM ibm-http-server:9.0.0.3
23

34
RUN apt-get update \
45
&& apt-get install -y --no-install-recommends unzip wget ca-certificates openssl \
56
&& rm -rf /var/lib/apt/lists/*
67

7-
ENV JAVA_VERSION 1.8.0_sr4fp5
8-
9-
RUN ESUM="187f67fa0fa23416811aa76df70d9e43ce75bb18bba0e7be080eb83f0c21fb20" \
10-
&& BASE_URL="https://public.dhe.ibm.com/ibmdl/export/pub/systems/cloud/runtimes/java/meta/" \
11-
&& YML_FILE="jre/linux/x86_64/index.yml" \
12-
&& wget -q -U UA_IBM_JAVA_Docker -O /tmp/index.yml $BASE_URL/$YML_FILE \
13-
&& JAVA_URL=$(cat /tmp/index.yml | sed -n '/'$JAVA_VERSION'/{n;p}' | sed -n 's/\s*uri:\s//p' | tr -d '\r') \
14-
&& wget -q -U UA_IBM_JAVA_Docker -O /tmp/ibm-java.bin $JAVA_URL \
15-
&& echo "$ESUM /tmp/ibm-java.bin" | sha256sum -c - \
16-
&& echo "INSTALLER_UI=silent" > /tmp/response.properties \
17-
&& echo "USER_INSTALL_DIR=/opt/ibm/java" >> /tmp/response.properties \
18-
&& echo "LICENSE_ACCEPTED=TRUE" >> /tmp/response.properties \
19-
&& mkdir -p /opt/ibm \
20-
&& chmod +x /tmp/ibm-java.bin \
21-
&& /tmp/ibm-java.bin -i silent -f /tmp/response.properties \
22-
&& rm -f /tmp/response.properties \
23-
&& rm -f /tmp/index.yml \
24-
&& rm -f /tmp/ibm-java.bin
25-
268
# Install WebSphere Liberty
279
ENV LIBERTY_VERSION 17.0.0_01
2810
ARG LIBERTY_URL
@@ -31,10 +13,8 @@ RUN LIBERTY_URL=${LIBERTY_URL:-$(wget -q -O - https://public.dhe.ibm.com/ibmdl/e
3113
&& wget $DOWNLOAD_OPTIONS $LIBERTY_URL -U UA-IBM-WebSphere-Liberty-Docker -O /tmp/wlp.zip \
3214
&& unzip -q /tmp/wlp.zip -d /opt/ibm \
3315
&& rm /tmp/wlp.zip
34-
#ENV JAVA_HOME=/opt/ibm/java/jre \
35-
# PATH=/opt/ibm/java/jre/bin:$PATH \
36-
ENV JAVA_HOME=//opt/IBM/WebSphere/Plugins/java/8.0
37-
ENV JVM_ARGS=-Dcom.ibm.webserver.plugin.utility.autoAcceptCertificates=true
16+
ENV JAVA_HOME=/opt/IBM/WebSphere/Plugins/java/8.0 \
17+
JVM_ARGS=-Dcom.ibm.webserver.plugin.utility.autoAcceptCertificates=true
3818
RUN /opt/ibm/wlp/bin/installUtility install --acceptLicense restConnector-2.0 restConnector-1.0 dynamicRouting-1.0
3919

4020
# Cleanup
@@ -43,8 +23,7 @@ RUN apt-get purge -y unzip wget && apt-get -y autoremove && rm -rf /var/lib/apt/
4323
# Add include to the configuration file
4424
RUN mkdir /share
4525
COPY startHttpServer.sh /work/
46-
COPY defaultClusterPlugin.conf /opt/IBM/HTTPServer/conf/
47-
COPY plugin-cfg.xml /opt/IBM/HTTPServer/conf/
26+
COPY defaultClusterPlugin.conf plugin-cfg.xml /opt/IBM/HTTPServer/conf/
4827
RUN echo "Include /opt/IBM/HTTPServer/conf/defaultClusterPlugin.conf" >> /opt/IBM/HTTPServer/conf/httpd.conf
4928

5029
EXPOSE 80

src/docker/webserver/defaultClusterPlugin.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
2-
#LoadModule was_ap22_module /opt/IBM/WebSphere/Plugins/bin/64bits/mod_was_ap22_http.so
32
LoadModule was_ap24_module /opt/IBM/WebSphere/Plugins/bin/64bits/mod_was_ap24_http.so
43
WebSpherePluginConfig "/defaultCluster-plugin-cfg.xml"
4+
5+
# When 9.0.0.3 code is released...
56
#WebSpherePluginConfig "/opt/IBM/HTTPServer/conf/plugin-cfg.xml"
67

78
Listen 443

src/docker/webserver/plugin-cfg.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
<Property Name="ESIInvalidationMonitor" Value="false"/>
77
<Property Name="ESIEnableToPassCookies" Value="false"/>
88
<Property Name="PluginInstallRoot" Value="/opt/IBM/WebSphere/Plugins/"/>
9-
<Property Name="Keyfile" Value="/opt/IBM/WebSphere/Plugins/config/webserver1/plugin-key.kdb"/>
10-
<Property Name="Stashfile" Value="/opt/IBM/WebSphere/Plugins/config/webserver1/plugin-key.sth"/>
9+
<Property Name="Keyfile" Value="/plugin-key.kdb"/>
10+
<Property Name="Stashfile" Value="/plugin-key.sth"/>
1111
<IntelligentManagement>
1212
<Property name="webserverName" value="webserver1"/>
1313
<ConnectorCluster enabled="true" maxRetries="-1" name="defaultCollective" retryInterval="60">
1414
<Property name="uri" value="/ibm/api/dynamicRouting"/>
1515
<Connector host="controller" port="9443" protocol="https">
16-
<Property name="keyring" value="/opt/IBM/WebSphere/Plugins/config/webserver1/plugin-key.kdb"/>
16+
<Property name="keyring" value="/plugin-key.kdb"/>
1717
</Connector>
1818
</ConnectorCluster>
1919
<Property name="RoutingRulesConnectorClusterName" value="defaultCollective"/>

src/docker/webserver/startHttpServer.sh

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ if [ ! -e /share/selfsigned.kdb ]
44
then
55
(
66
flock 200
7-
/opt/IBM/HTTPServer/bin/gskcapicmd -keydb -create -db /share/selfsigned.kdb -stash -genpw
8-
/opt/IBM/HTTPServer/bin/gskcapicmd -cert \
7+
gskcapicmd -keydb -create -db /share/selfsigned.kdb -stash -genpw
8+
gskcapicmd -cert \
99
-create \
1010
-db /share/selfsigned.kdb \
1111
-label default \
@@ -37,13 +37,39 @@ do
3737
-type p12 \
3838
-file $memberHost.pem \
3939
-target /opt/IBM/WebSphere/Plugins/config/webserver1/plugin-key.kdb \
40-
-target-pw $PASSWORD
40+
-target_stashed
4141
done
4242

4343
# Remove the administrative URIs from the configuration
4444
sed -i 's#<Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBMJMXConnectorREST/\*"/>##' /defaultCluster-plugin-cfg.xml
4545
sed -i 's#<Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ibm/api/\*"/>##' /defaultCluster-plugin-cfg.xml
4646

47+
# The following sets up dynamic routing but it is not used until 9.0.0.3 docker image is released. Remove from after fi
48+
PASSWORD=$(openssl rand -hex 16)
49+
50+
while ! /opt/ibm/wlp/bin/dynamicRouting genKeystore \
51+
--host=controller \
52+
--user=adminUser \
53+
--password=adminPassword \
54+
--port=9443 \
55+
--keystorePassword="$PASSWORD" \
56+
--autoAcceptCertificates
57+
do
58+
sleep 1
59+
done
60+
61+
# needs 9.0.0.3 to work
62+
# gskcmd -keydb -convert \
63+
# -db /plugin-key.jks \
64+
# -pw $PASSWORD \
65+
# -target /plugin-key.kdb \
66+
# -new_format cms \
67+
# -stash
68+
# gskcmd -cert -setdefault \
69+
# -label default \
70+
# -db /plugin-key.kdb \
71+
# -stashed
72+
4773
# Make directory used for the plugin logs
4874
mkdir -p /opt/IBM/WebSphere/Plugins/logs/webserver1
4975

0 commit comments

Comments
 (0)