Skip to content

Commit 9c52acc

Browse files
committed
RHEL & Hostname/Port Override Update
1 parent 86663dc commit 9c52acc

File tree

12 files changed

+209
-8
lines changed

12 files changed

+209
-8
lines changed

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ Get [ACE for Developers edition](https://www.ibm.com/marketing/iwm/iwm/web/pick.
2424

2525
### Using MQ production image
2626

27-
When building an image with both ACE and MQ, the docker file uses the [MQ Advanced for Developers image in docker registry](https://hub.docker.com/r/ibmcom/mq/) as base image by default.
27+
When building an image with both ACE and MQ, the docker file uses the [MQ Advanced for Developers image in docker registry](https://hub.docker.com/r/ibmcom/mq/) as base image by default on Ubuntu.
28+
On RedHat Enterprise Linux the image can be built using the [MQ instructions](https://github.com/ibm-messaging/mq-container/blob/master/docs/building.md#prerequisites-for-building-a-red-hat-enterprise-linux-image) or downloaded from [IBM Passport Advantage] (https://www.ibm.com/software/passportadvantage/).
29+
2830
When building a production image with MQ, follow the [MQ instructions](https://github.com/ibm-messaging/mq-container/blob/master/docs/building.md#building-a-production-image) to build your own production MQ image. Then, when building the ACE with MQ image use `build-arg` to set the `BASE_IMAGE` to your production MQ image. More details below.
2931

3032
## Build an image with App Connect Enterprise and MQ
@@ -35,8 +37,11 @@ The `deps` folder must contain a copy of ACE, **version 11.0.0.2 or greater**. I
3537
Then set the build argument `ACE_INSTALL` to the name of the ACE file placed in `deps`.
3638

3739
1. ACE production with MQ Advanced production:
38-
`docker build -t ace-mq --build-arg BASE_IMAGE={MQ-image} --build-arg ACE_INSTALL={ACE-file-in-deps-folder} --file ubuntu/Dockerfile.acemq .`
39-
1. ACE for Developers with MQ Advanced for Developers: `docker build -t ace-dev-mq-dev --build-arg ACE_INSTALL={ACE-dev-file-in-deps-folder} --file ubuntu/Dockerfile.acemq .`
40+
* Ubuntu: `docker build -t ace-mq --build-arg BASE_IMAGE={MQ-image} --build-arg ACE_INSTALL={ACE-file-in-deps-folder} --file ubuntu/Dockerfile.acemq .`
41+
* RedHat Enterprise Linux: `./build.sh ace-mq {ACE-file-in-deps-folder} {mq-base-image-name}`
42+
2. ACE for Developers with MQ Advanced for Developers:
43+
* Ubuntu: `docker build -t ace-dev-mq-dev --build-arg ACE_INSTALL={ACE-dev-file-in-deps-folder} --file ubuntu/Dockerfile.acemq .`
44+
* RedHat Enterprise Linux: `./build.sh ace-mq {ACE-file-in-deps-folder} {mq-base-image-name}`
4045

4146
**Note:** As mentioned before, the docker file will download the **[Development version of IBM MQ](https://hub.docker.com/r/ibmcom/mq/)** by default unless `BASE_IMAGE` is changed.
4247

@@ -45,8 +50,12 @@ Then set the build argument `ACE_INSTALL` to the name of the ACE file placed in
4550
The `deps` folder must contain a copy of ACE, **version 11.0.0.2 or greater**. If using ACE for Developers, download it from [here](https://www.ibm.com/marketing/iwm/iwm/web/pick.do?source=swg-wmbfd).
4651
Then set the build argument `ACE_INSTALL` to the name of the ACE file placed in `deps`.
4752

48-
1. ACE for Developers only: `docker build -t ace-dev-only --build-arg ACE_INSTALL={ACE-dev-file-in-deps-folder} --file ubuntu/Dockerfile.aceonly .`
49-
1. ACE production only: `docker build -t ace-only --build-arg ACE_INSTALL={ACE-file-in-deps-folder} --file ubuntu/Dockerfile.aceonly .`
53+
1. ACE for Developers only:
54+
* Ubuntu: `docker build -t ace-dev-only --build-arg ACE_INSTALL={ACE-dev-file-in-deps-folder} --file ubuntu/Dockerfile.aceonly .`
55+
* RedHat Enterprise Linux: `./build.sh ace-dev-only {ACE-file-in-deps-folder}`
56+
2. ACE production only:
57+
* Ubuntu: `docker build -t ace-only --build-arg ACE_INSTALL={ACE-file-in-deps-folder} --file ubuntu/Dockerfile.aceonly .`
58+
* RedHat Enterprise Linux: `./build.sh ace-only {ACE-file-in-deps-folder}`
5059

5160
# Usage
5261

ace_discover_port_overrides.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash -ex
2+
3+
if ! [[ -z "${KUBERNETES_PORT}" ]] && ! [[ -z "${SERVICE_NAME}" ]] ; then
4+
echo "export MQSI_OVERRIDE_HTTP_PORT=$(kubectl get svc ${SERVICE_NAME} -o jsonpath=\"{.spec.ports[1].nodePort}\")" >> /home/aceuser/portOverrides
5+
echo "export MQSI_OVERRIDE_HTTPS_PORT=$(kubectl get svc ${SERVICE_NAME} -o jsonpath=\"{.spec.ports[2].nodePort}\")" >> /home/aceuser/portOverrides
6+
fi

ace_integration_server.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ if [ -f /home/aceuser/ace-server/odbc.ini ]; then
1515
export ODBCINI=/home/aceuser/ace-server/odbc.ini
1616
fi
1717

18+
if ! [[ -z "${KUBERNETES_PORT}" ]] && ! [[ -z "${SERVICE_NAME}" ]] ; then
19+
. /home/aceuser/portOverrides
20+
fi
21+
1822
exec IntegrationServer $*

build.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
echo "Building ACE build container"
3+
buildType=$1
4+
5+
if [ -z "$2" ]
6+
then
7+
echo "Building with default ACE install parameters"
8+
docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy \
9+
-t ace/builder:11.0.0.2 . -f ./rhel/Dockerfile.build
10+
else
11+
echo "Building with ACE install $1"
12+
docker build --build-arg ACE_INSTALL=$2 --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy \
13+
-t ace/builder:11.0.0.2 . -f ./rhel/Dockerfile.build
14+
fi
15+
16+
docker create --name builder ace/builder:11.0.0.2
17+
docker cp builder:/opt/ibm/ace-11 ./rhel/ace-11
18+
docker cp builder:/go/src/github.com/ot4i/ace-docker/runaceserver ./rhel/runaceserver
19+
docker cp builder:/go/src/github.com/ot4i/ace-docker/chkaceready ./rhel/chkaceready
20+
docker cp builder:/go/src/github.com/ot4i/ace-docker/chkacehealthy ./rhel/chkacehealthy
21+
docker rm -f builder
22+
23+
echo "Building ACE runtime container"
24+
25+
case $buildType in
26+
"ace-dev-only")
27+
echo "Building ACE only for development"
28+
docker build -t ace/ace-dev-only -f ./rhel/Dockerfile.acerhel .
29+
;;
30+
"ace-only")
31+
echo "Building ACE only for production"
32+
docker build -t ace/ace-only -f ./rhel/Dockerfile.acerhel .
33+
;;
34+
"ace-mq")
35+
echo "Building ACE with MQ for production"
36+
docker build -t ace/ace-mq --build-arg BASE_IMAGE=$3 -f ./rhel/Dockerfile.acemqrhel .
37+
;;
38+
"ace-dev-mq-dev")
39+
echo "Building ACE with MQ for production"
40+
docker build -t ace/ace-dev-mq-dev --build-arg BASE_IMAGE=$3 -f ./rhel/Dockerfile.acemqrhel .
41+
;;
42+
*) echo "Invalid option"
43+
;;
44+
esac

cmd/runaceserver/integrationserver.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ func initialIntegrationServerConfig() error {
110110
}
111111

112112
log.Printf("Initial configuration of integration server complete")
113+
114+
log.Println("Discovering override ports")
115+
116+
out, _, err := command.Run("bash", "ace_discover_port_overrides.sh")
117+
if err != nil {
118+
log.Errorf("Error discovering override ports: %v", string(out))
119+
return err
120+
}
121+
log.Println("Successfully discovered override ports")
122+
113123
return nil
114124
}
115125

rhel/Dockerfile.acemqrhel

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# FROM ibm-mqadvanced-server:9.1.0.0-RHEL-x86_64
2+
FROM $BASE_IMAGE
3+
4+
WORKDIR /opt/ibm
5+
6+
7+
# Install ACE V11
8+
RUN yum update -y && \
9+
yum upgrade -y && \
10+
yum install sudo openssl -y && \
11+
rm -rf /var/lib/apt/lists/*
12+
13+
ADD ./rhel/ace-11 /opt/ibm/ace-11
14+
15+
RUN /opt/ibm/ace-11/ace make registry global accept license silently
16+
17+
# Copy in PID1 process
18+
COPY ./rhel/runaceserver /usr/local/bin/
19+
COPY ./rhel/chkaceready /usr/local/bin/
20+
COPY ./rhel/chkacehealthy /usr/local/bin/
21+
22+
# Configure the system and Increase security
23+
RUN echo "ACE_11:" > /etc/debian_chroot \
24+
&& sed -i 's/# minlen = 9/minlen = 8/' /etc/security/pwquality.conf \
25+
&& sed -i 's/PASS_MIN_DAYS\t0/PASS_MIN_DAYS\t1/' /etc/login.defs \
26+
&& sed -i 's/PASS_MAX_DAYS\t99999/PASS_MAX_DAYS\t90/' /etc/login.defs
27+
28+
# Copy in script files
29+
COPY *.sh /usr/local/bin/
30+
31+
# Create a user to run as, create the ace workdir, and chmod script files
32+
RUN useradd -d /home/aceuser -G mqbrkrs,wheel aceuser \
33+
&& sed -e 's/^%sudo .*/%sudo ALL=NOPASSWD:ALL/g' -i /etc/sudoers \
34+
&& su - aceuser -c '. /opt/ibm/ace-11/server/bin/mqsiprofile && mqsicreateworkdir /home/aceuser/ace-server' \
35+
&& chmod 755 /usr/local/bin/*
36+
37+
# Set BASH_ENV to source mqsiprofile when using docker exec bash -c
38+
ENV BASH_ENV=/usr/local/bin/ace_env.sh
39+
40+
# Expose ports. 7600, 7800, 7843 for ACE; 1414 for MQ; 9157 for MQ metrics; 9483 for ACE metrics;
41+
EXPOSE 7600 7800 7843 1414 9157 9483
42+
43+
WORKDIR /home/aceuser
44+
RUN mkdir /home/aceuser/initial-config && chown aceuser:aceuser /home/aceuser/initial-config
45+
46+
ENV USE_QMGR=true LOG_FORMAT=basic
47+
48+
# Set entrypoint to run management script
49+
ENTRYPOINT ["runaceserver"]

rhel/Dockerfile.acerhel

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM registry.access.redhat.com/rhel7:7.5
2+
3+
WORKDIR /opt/ibm
4+
5+
# Install ACE V11
6+
RUN yum update -y && \
7+
yum upgrade -y && \
8+
yum install sudo openssl -y && \
9+
rm -rf /var/lib/apt/lists/*
10+
11+
ADD ./rhel/ace-11 /opt/ibm/ace-11
12+
13+
RUN /opt/ibm/ace-11/ace make registry global accept license silently
14+
15+
# Copy in PID1 process
16+
COPY ./rhel/runaceserver /usr/local/bin/
17+
COPY ./rhel/chkaceready /usr/local/bin/
18+
COPY ./rhel/chkacehealthy /usr/local/bin/
19+
20+
# Configure the system and Increase security
21+
RUN echo "ACE_11:" > /etc/debian_chroot \
22+
&& sed -i 's/# minlen = 9/minlen = 8/' /etc/security/pwquality.conf \
23+
&& sed -i 's/PASS_MIN_DAYS\t0/PASS_MIN_DAYS\t1/' /etc/login.defs \
24+
&& sed -i 's/PASS_MAX_DAYS\t99999/PASS_MAX_DAYS\t90/' /etc/login.defs
25+
26+
# Copy in script files
27+
COPY *.sh /usr/local/bin/
28+
29+
# Create a user to run as, create the ace workdir, and chmod script files
30+
RUN useradd -d /home/aceuser -G mqbrkrs,wheel aceuser \
31+
&& sed -e 's/^%sudo .*/%sudo ALL=NOPASSWD:ALL/g' -i /etc/sudoers \
32+
&& su - aceuser -c '. /opt/ibm/ace-11/server/bin/mqsiprofile && mqsicreateworkdir /home/aceuser/ace-server' \
33+
&& chmod 755 /usr/local/bin/*
34+
35+
# Set BASH_ENV to source mqsiprofile when using docker exec bash -c
36+
ENV BASH_ENV=/usr/local/bin/ace_env.sh
37+
38+
# Expose ports. 7600, 7800, 7843 for ACE; 9483 for ACE metrics
39+
EXPOSE 7600 7800 7843 9483
40+
41+
USER aceuser
42+
43+
WORKDIR /home/aceuser
44+
RUN mkdir /home/aceuser/initial-config && chown aceuser:aceuser /home/aceuser/initial-config
45+
46+
ENV LOG_FORMAT=basic
47+
48+
# Set entrypoint to run management script
49+
ENTRYPOINT ["runaceserver"]

rhel/Dockerfile.build

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM golang:1.10.3
2+
WORKDIR /go/src/github.com/ot4i/ace-docker/
3+
COPY cmd/ ./cmd
4+
COPY ./internal/ ./internal
5+
COPY ./vendor/ ./vendor
6+
RUN go build -ldflags "-X \"main.ImageCreated=$(date --iso-8601=seconds)\" -X \"main.ImageRevision=$IMAGE_REVISION\" -X \"main.ImageSource=$IMAGE_SOURCE\"" ./cmd/runaceserver/
7+
RUN go build ./cmd/chkaceready/
8+
RUN go build ./cmd/chkacehealthy/
9+
# Run all unit tests
10+
RUN go test -v ./cmd/runaceserver/
11+
RUN go test -v ./internal/...
12+
RUN go vet ./cmd/... ./internal/...
13+
14+
ARG ACE_INSTALL=ace-11.0.0.2.tar.gz
15+
RUN pwd
16+
WORKDIR /opt/ibm
17+
RUN pwd
18+
COPY ./deps/$ACE_INSTALL .
19+
RUN mkdir ace-11
20+
RUN tar xzf $ACE_INSTALL --exclude ace-11.\*/tools --strip-components 1 --directory /opt/ibm/ace-11

sample/initial-config/policy/default.policyxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
<KeyAlias>mykey</KeyAlias>
2323
<KeyPassword></KeyPassword>
2424
<KeystoreFile>/home/aceuser/ace-server/keystore.jks</KeystoreFile>
25-
<KeystorePassword>passrods</KeystorePassword>
25+
<KeystorePassword>keystorepwd</KeystorePassword>
2626
<TruststoreFile>/home/aceuser/ace-server/truststore.jks</TruststoreFile>
27-
<TruststorePassword>passrods</TruststorePassword>
27+
<TruststorePassword>truststorepwd</TruststorePassword>
2828
</policy>
2929
</policies>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# resource user password
2-
setdbparms::truststore dummy passrods
2+
setdbparms::truststore dummy truststorepwd

0 commit comments

Comments
 (0)