Compare commits
10 Commits
9.1.2-UBI
...
old-master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1aab07c6ed | ||
|
|
556ac6aec2 | ||
|
|
950aecf300 | ||
|
|
492c6876ca | ||
|
|
9896e53cba | ||
|
|
f6ea588349 | ||
|
|
60fe631616 | ||
|
|
221796f746 | ||
|
|
97941bc87c | ||
|
|
b8a7167c4e |
29
.travis.yml
29
.travis.yml
@@ -35,20 +35,18 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
- BASE_IMAGE=ubuntu:16.04
|
- BASE_IMAGE=ubuntu:16.04
|
||||||
- DOCKER_DOWNGRADE="echo nothing to be done"
|
- DOCKER_DOWNGRADE="echo nothing to be done"
|
||||||
- env:
|
# TEMPORARY removal of Docker 1.12 test, due to errors from apt repository
|
||||||
- BASE_IMAGE=centos:7
|
# - if: type IN (pull_request) OR tag IS present
|
||||||
- DOCKER_DOWNGRADE="echo nothing to be done"
|
# env:
|
||||||
- if: type IN (pull_request) OR tag IS present
|
# - BASE_IMAGE=ubuntu:16.04
|
||||||
env:
|
# - DOCKER_DOWNGRADE="docker save -o images.tar mqadvanced-server-dev mq-dev-jms-test &&
|
||||||
- BASE_IMAGE=ubuntu:16.04
|
# sudo apt-get autoremove -y docker-ce &&
|
||||||
- DOCKER_DOWNGRADE="docker save -o images.tar mqadvanced-server-dev mq-dev-jms-test &&
|
# curl -fsSL \"https://apt.dockerproject.org/gpg\" | sudo apt-key add - &&
|
||||||
sudo apt-get autoremove -y docker-ce &&
|
# sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" &&
|
||||||
curl -fsSL \"https://apt.dockerproject.org/gpg\" | sudo apt-key add - &&
|
# sudo apt-get update &&
|
||||||
sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" &&
|
# sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs) &&
|
||||||
sudo apt-get update &&
|
# docker load -q -i images.tar &&
|
||||||
sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs) &&
|
# export DOCKER_API_VERSION=\"1.24\""
|
||||||
docker load -q -i images.tar &&
|
|
||||||
export DOCKER_API_VERSION=\"1.24\""
|
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- ./install-build-deps-ubuntu.sh
|
- ./install-build-deps-ubuntu.sh
|
||||||
@@ -61,8 +59,7 @@ before_script:
|
|||||||
- make deps
|
- make deps
|
||||||
- echo -en 'travis_fold:end:deps\\r'
|
- echo -en 'travis_fold:end:deps\\r'
|
||||||
- echo 'Building Developer image...' && echo -en 'travis_fold:start:build-devserver\\r'
|
- echo 'Building Developer image...' && echo -en 'travis_fold:start:build-devserver\\r'
|
||||||
# Use the containerized build explicitly
|
- make build-devserver
|
||||||
- make build-devserver-ctr
|
|
||||||
- echo -en 'travis_fold:end:build-devserver\\r'
|
- echo -en 'travis_fold:end:build-devserver\\r'
|
||||||
- echo 'Building Developer JMS test image...' && echo -en 'travis_fold:start:build-devjmstest\\r'
|
- echo 'Building Developer JMS test image...' && echo -en 'travis_fold:start:build-devjmstest\\r'
|
||||||
- make build-devjmstest
|
- make build-devjmstest
|
||||||
|
|||||||
11
CHANGELOG.md
11
CHANGELOG.md
@@ -1,5 +1,15 @@
|
|||||||
# Change log
|
# Change log
|
||||||
|
|
||||||
|
## 9.1.3.0 (2019-07-19)
|
||||||
|
|
||||||
|
* Updated to MQ version 9.1.3.0
|
||||||
|
* Allow generation of TLS certificate with given hostname
|
||||||
|
* Fixes for the following issues:
|
||||||
|
* `MQ_EPHEMERAL_PREFIX` UNIX sockets fix
|
||||||
|
* Fix Makefile for Windows
|
||||||
|
* Use -a option on crtmqdir
|
||||||
|
* Remove check for certificate environment variable
|
||||||
|
|
||||||
## 9.1.2.0-UBI (2019-06-21)
|
## 9.1.2.0-UBI (2019-06-21)
|
||||||
|
|
||||||
**Breaking changes**:
|
**Breaking changes**:
|
||||||
@@ -13,6 +23,7 @@
|
|||||||
|
|
||||||
## 9.1.2.0 (2019-03-21)
|
## 9.1.2.0 (2019-03-21)
|
||||||
|
|
||||||
|
* Updated to MQ version 9.1.2.0
|
||||||
* Now runs using the "mqm" user instead of root. See new [security doc](https://github.com/ibm-messaging/mq-container/blob/master/docs/security.md)
|
* Now runs using the "mqm" user instead of root. See new [security doc](https://github.com/ibm-messaging/mq-container/blob/master/docs/security.md)
|
||||||
* New [IGNSTATE](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.pro.doc/q132310_.htm#q132310___ignstateparm) parameter used in default developer config
|
* New [IGNSTATE](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.pro.doc/q132310_.htm#q132310___ignstateparm) parameter used in default developer config
|
||||||
* Termination log moved from `/dev/termination-log` to `/run/termination-log`, to make permissions easier to handle
|
* Termination log moved from `/dev/termination-log` to `/run/termination-log`, to make permissions easier to handle
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
ARG BASE_IMAGE=registry.access.redhat.com/ubi7/ubi-minimal
|
||||||
|
ARG BASE_TAG=7.7-98
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Build stage to build Go code
|
# Build stage to build Go code
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -50,12 +52,14 @@ RUN go vet ./cmd/... ./internal/...
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# Main build stage, to build MQ image
|
# Main build stage, to build MQ image
|
||||||
###############################################################################
|
###############################################################################
|
||||||
FROM registry.access.redhat.com/ubi7/ubi-minimal AS mq-server
|
FROM $BASE_IMAGE:$BASE_TAG AS mq-server
|
||||||
# The MQ packages to install - see install-mq.sh for default value
|
# The MQ packages to install - see install-mq.sh for default value
|
||||||
ARG MQ_URL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev912_linux_x86-64.tar.gz"
|
ARG MQ_URL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev912_linux_x86-64.tar.gz"
|
||||||
ARG MQ_PACKAGES="MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm MQSeriesJava*.rpm MQSeriesJRE*.rpm MQSeriesGSKit*.rpm MQSeriesMsg*.rpm MQSeriesSamples*.rpm MQSeriesWeb*.rpm MQSeriesAMS-*.rpm"
|
ARG MQ_PACKAGES="MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm MQSeriesJava*.rpm MQSeriesJRE*.rpm MQSeriesGSKit*.rpm MQSeriesMsg*.rpm MQSeriesSamples*.rpm MQSeriesWeb*.rpm MQSeriesAMS-*.rpm"
|
||||||
#ARG MQ_PACKAGES="ibmmq-server ibmmq-java ibmmq-jre ibmmq-gskit ibmmq-msg-.* ibmmq-samples ibmmq-web ibmmq-ams"
|
#ARG MQ_PACKAGES="ibmmq-server ibmmq-java ibmmq-jre ibmmq-gskit ibmmq-msg-.* ibmmq-samples ibmmq-web ibmmq-ams"
|
||||||
ARG MQM_UID=888
|
ARG MQM_UID=888
|
||||||
|
ARG BASE_IMAGE
|
||||||
|
ARG BASE_TAG
|
||||||
LABEL summary="IBM MQ Advanced Server"
|
LABEL summary="IBM MQ Advanced Server"
|
||||||
LABEL description="Simplify, accelerate and facilitate the reliable exchange of data with a security-rich messaging solution — trusted by the world’s most successful enterprises"
|
LABEL description="Simplify, accelerate and facilitate the reliable exchange of data with a security-rich messaging solution — trusted by the world’s most successful enterprises"
|
||||||
LABEL vendor="IBM"
|
LABEL vendor="IBM"
|
||||||
@@ -65,6 +69,8 @@ LABEL url="https://www.ibm.com/products/mq/advanced"
|
|||||||
LABEL io.openshift.tags="mq messaging"
|
LABEL io.openshift.tags="mq messaging"
|
||||||
LABEL io.k8s.display-name="IBM MQ Advanced Server"
|
LABEL io.k8s.display-name="IBM MQ Advanced Server"
|
||||||
LABEL io.k8s.description="Simplify, accelerate and facilitate the reliable exchange of data with a security-rich messaging solution — trusted by the world’s most successful enterprises"
|
LABEL io.k8s.description="Simplify, accelerate and facilitate the reliable exchange of data with a security-rich messaging solution — trusted by the world’s most successful enterprises"
|
||||||
|
LABEL base-image=$BASE_IMAGE
|
||||||
|
LABEL base-image-release=$BASE_TAG
|
||||||
COPY install-mq.sh /usr/local/bin/
|
COPY install-mq.sh /usr/local/bin/
|
||||||
COPY install-mq-server-prereqs.sh /usr/local/bin/
|
COPY install-mq-server-prereqs.sh /usr/local/bin/
|
||||||
# Install MQ. To avoid a "text file busy" error here, we sleep before installing.
|
# Install MQ. To avoid a "text file busy" error here, we sleep before installing.
|
||||||
@@ -100,6 +106,8 @@ ENTRYPOINT ["runmqserver"]
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
FROM mq-server AS mq-dev-server
|
FROM mq-server AS mq-dev-server
|
||||||
ARG MQM_UID=888
|
ARG MQM_UID=888
|
||||||
|
ARG BASE_IMAGE
|
||||||
|
ARG BASE_TAG
|
||||||
# Enable MQ developer default configuration
|
# Enable MQ developer default configuration
|
||||||
ENV MQ_DEV=true
|
ENV MQ_DEV=true
|
||||||
# Default administrator password
|
# Default administrator password
|
||||||
@@ -113,6 +121,8 @@ LABEL url="https://www.ibm.com/products/mq/advanced"
|
|||||||
LABEL io.openshift.tags="mq messaging"
|
LABEL io.openshift.tags="mq messaging"
|
||||||
LABEL io.k8s.display-name="IBM MQ Advanced for Developers Server"
|
LABEL io.k8s.display-name="IBM MQ Advanced for Developers Server"
|
||||||
LABEL io.k8s.description="Simplify, accelerate and facilitate the reliable exchange of data with a security-rich messaging solution — trusted by the world’s most successful enterprises"
|
LABEL io.k8s.description="Simplify, accelerate and facilitate the reliable exchange of data with a security-rich messaging solution — trusted by the world’s most successful enterprises"
|
||||||
|
LABEL base-image=$BASE_IMAGE
|
||||||
|
LABEL base-image-release=$BASE_TAG
|
||||||
USER 0
|
USER 0
|
||||||
COPY incubating/mqadvanced-server-dev/install-extra-packages.sh /usr/local/bin/
|
COPY incubating/mqadvanced-server-dev/install-extra-packages.sh /usr/local/bin/
|
||||||
RUN chmod u+x /usr/local/bin/install-extra-packages.sh \
|
RUN chmod u+x /usr/local/bin/install-extra-packages.sh \
|
||||||
|
|||||||
134
Makefile
134
Makefile
@@ -17,9 +17,9 @@
|
|||||||
# the command line
|
# the command line
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# MQ_VERSION is the fully qualified MQ version number to build
|
# MQ_VERSION is the fully qualified MQ version number to build
|
||||||
MQ_VERSION ?= 9.1.2.0
|
MQ_VERSION ?= 9.1.3.0
|
||||||
# RELEASE shows what release of the container code has been built
|
# RELEASE shows what release of the container code has been built
|
||||||
RELEASE ?= 3
|
RELEASE ?= 2
|
||||||
# MQ_ARCHIVE is the name of the file, under the downloads directory, from which MQ Advanced can
|
# MQ_ARCHIVE is the name of the file, under the downloads directory, from which MQ Advanced can
|
||||||
# be installed. The default value is derived from MQ_VERSION, BASE_IMAGE and architecture
|
# be installed. The default value is derived from MQ_VERSION, BASE_IMAGE and architecture
|
||||||
# Does not apply to MQ Advanced for Developers.
|
# Does not apply to MQ Advanced for Developers.
|
||||||
@@ -37,12 +37,12 @@ MQ_IMAGE_ADVANCEDSERVER ?=mqadvanced-server
|
|||||||
MQ_IMAGE_DEVSERVER ?=mqadvanced-server-dev
|
MQ_IMAGE_DEVSERVER ?=mqadvanced-server-dev
|
||||||
# MQ_TAG is the tag of the built MQ Advanced image & MQ Advanced for Developers image
|
# MQ_TAG is the tag of the built MQ Advanced image & MQ Advanced for Developers image
|
||||||
MQ_TAG ?=$(MQ_VERSION)-$(ARCH)
|
MQ_TAG ?=$(MQ_VERSION)-$(ARCH)
|
||||||
# DOCKER is the Docker command to run. Defaults to "podman" if it's available, otherwise "docker"
|
|
||||||
DOCKER ?= $(shell type -p podman || echo docker)
|
|
||||||
# MQ_PACKAGES specifies the MQ packages (.deb or .rpm) to install. Defaults vary on base image.
|
# MQ_PACKAGES specifies the MQ packages (.deb or .rpm) to install. Defaults vary on base image.
|
||||||
MQ_PACKAGES ?=MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm MQSeriesJava*.rpm MQSeriesJRE*.rpm MQSeriesGSKit*.rpm MQSeriesMsg*.rpm MQSeriesSamples*.rpm MQSeriesWeb*.rpm MQSeriesAMS-*.rpm
|
MQ_PACKAGES ?=MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm MQSeriesJava*.rpm MQSeriesJRE*.rpm MQSeriesGSKit*.rpm MQSeriesMsg*.rpm MQSeriesSamples*.rpm MQSeriesWeb*.rpm MQSeriesAMS-*.rpm
|
||||||
# MQM_UID is the UID to use for the "mqm" user
|
# MQM_UID is the UID to use for the "mqm" user
|
||||||
MQM_UID ?= 888
|
MQM_UID ?= 888
|
||||||
|
# COMMAND is the container command to run. "podman" or "docker"
|
||||||
|
COMMAND ?=$(shell type -p podman 2>&1 >/dev/null && echo podman || echo docker)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Other variables
|
# Other variables
|
||||||
@@ -68,17 +68,9 @@ IMAGE_REVISION=$(shell git rev-parse HEAD)
|
|||||||
IMAGE_SOURCE=$(shell git config --get remote.origin.url)
|
IMAGE_SOURCE=$(shell git config --get remote.origin.url)
|
||||||
EMPTY:=
|
EMPTY:=
|
||||||
SPACE:= $(EMPTY) $(EMPTY)
|
SPACE:= $(EMPTY) $(EMPTY)
|
||||||
# MQ_VERSION_VRM is MQ_VERSION with only the Version, Release and Modifier fields (no Fix field). e.g. 9.1.2 instead of 9.1.2.0
|
# MQ_VERSION_VRM is MQ_VERSION with only the Version, Release and Modifier fields (no Fix field). e.g. 9.1.3 instead of 9.1.3.0
|
||||||
MQ_VERSION_VRM=$(subst $(SPACE),.,$(wordlist 1,3,$(subst .,$(SPACE),$(MQ_VERSION))))
|
MQ_VERSION_VRM=$(subst $(SPACE),.,$(wordlist 1,3,$(subst .,$(SPACE),$(MQ_VERSION))))
|
||||||
|
|
||||||
# Set variable if running on a Red Hat Enterprise Linux host
|
|
||||||
ifneq ($(wildcard /etc/redhat-release),)
|
|
||||||
REDHAT_RELEASE = $(shell cat /etc/redhat-release)
|
|
||||||
ifeq "$(findstring Red Hat,$(REDHAT_RELEASE))" "Red Hat"
|
|
||||||
RHEL_HOST = "true"
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq (,$(findstring Microsoft,$(shell uname -r)))
|
ifneq (,$(findstring Microsoft,$(shell uname -r)))
|
||||||
DOWNLOADS_DIR=$(patsubst /mnt/c%,C:%,$(realpath ./downloads/))
|
DOWNLOADS_DIR=$(patsubst /mnt/c%,C:%,$(realpath ./downloads/))
|
||||||
else ifneq (,$(findstring Windows,$(shell echo ${OS})))
|
else ifneq (,$(findstring Windows,$(shell echo ${OS})))
|
||||||
@@ -102,18 +94,13 @@ endif
|
|||||||
MQ_ARCHIVE_DEV_9.1.0.0=mqadv_dev910_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
|
MQ_ARCHIVE_DEV_9.1.0.0=mqadv_dev910_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
|
||||||
MQ_ARCHIVE_DEV_9.1.1.0=mqadv_dev911_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
|
MQ_ARCHIVE_DEV_9.1.1.0=mqadv_dev911_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
|
||||||
MQ_ARCHIVE_DEV_9.1.2.0=mqadv_dev912_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
|
MQ_ARCHIVE_DEV_9.1.2.0=mqadv_dev912_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
|
||||||
|
MQ_ARCHIVE_DEV_9.1.3.0=mqadv_dev913_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Build targets
|
# Build targets
|
||||||
###############################################################################
|
###############################################################################
|
||||||
.PHONY: vars
|
|
||||||
vars:
|
|
||||||
@echo $(MQ_ARCHIVE_ARCH)
|
|
||||||
@echo $(MQ_ARCHIVE_TYPE)
|
|
||||||
@echo $(MQ_ARCHIVE)
|
|
||||||
|
|
||||||
.PHONY: default
|
.PHONY: default
|
||||||
default: build-devserver test
|
default: build-devserver
|
||||||
|
|
||||||
# Build all components (except incubating ones)
|
# Build all components (except incubating ones)
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
@@ -195,24 +182,16 @@ test-advancedserver-cover: test/docker/vendor coverage
|
|||||||
tail -q -n +2 ./coverage/unit.cov ./coverage/docker.cov >> ./coverage/combined.cov
|
tail -q -n +2 ./coverage/unit.cov ./coverage/docker.cov >> ./coverage/combined.cov
|
||||||
go tool cover -html=./coverage/combined.cov -o ./coverage/combined.html
|
go tool cover -html=./coverage/combined.cov -o ./coverage/combined.html
|
||||||
|
|
||||||
|
# Build an MQ image. The commands used are slightly different between Docker and Podman
|
||||||
define build-mq
|
define build-mq
|
||||||
# Create a temporary network to use for the build
|
$(if $(findstring docker,$(COMMAND)), @docker network create build,)
|
||||||
$(DOCKER) network create build
|
$(if $(findstring docker,$(COMMAND)), @docker run --rm --name $(BUILD_SERVER_CONTAINER) --network build --network-alias build --volume $(DOWNLOADS_DIR):/usr/share/nginx/html:ro --detach docker.io/nginx:alpine,)
|
||||||
# Start a web server to host the MQ downloadable (tar.gz) file
|
$(eval EXTRA_ARGS=$(if $(findstring docker,$(COMMAND)), --network build --build-arg MQ_URL=http://build:80/$4, --volume $(DOWNLOADS_DIR):/var/downloads --build-arg MQ_URL=file:///var/downloads/$4))
|
||||||
$(DOCKER) run \
|
|
||||||
--rm \
|
|
||||||
--name $(BUILD_SERVER_CONTAINER) \
|
|
||||||
--network build \
|
|
||||||
--network-alias build \
|
|
||||||
--volume $(DOWNLOADS_DIR):/usr/share/nginx/html:ro \
|
|
||||||
--detach \
|
|
||||||
docker.io/nginx:alpine
|
|
||||||
# Build the new image
|
# Build the new image
|
||||||
$(DOCKER) build \
|
$(COMMAND) build \
|
||||||
--tag $1:$2 \
|
--tag $1:$2 \
|
||||||
--file $3 \
|
--file $3 \
|
||||||
--network build \
|
$(EXTRA_ARGS) \
|
||||||
--build-arg MQ_URL=http://build:80/$4 \
|
|
||||||
--build-arg MQ_PACKAGES="$(MQ_PACKAGES)" \
|
--build-arg MQ_PACKAGES="$(MQ_PACKAGES)" \
|
||||||
--build-arg IMAGE_REVISION="$(IMAGE_REVISION)" \
|
--build-arg IMAGE_REVISION="$(IMAGE_REVISION)" \
|
||||||
--build-arg IMAGE_SOURCE="$(IMAGE_SOURCE)" \
|
--build-arg IMAGE_SOURCE="$(IMAGE_SOURCE)" \
|
||||||
@@ -228,76 +207,44 @@ define build-mq
|
|||||||
--label vcs-type=git \
|
--label vcs-type=git \
|
||||||
--label vcs-url=$(IMAGE_SOURCE) \
|
--label vcs-url=$(IMAGE_SOURCE) \
|
||||||
--target $5 \
|
--target $5 \
|
||||||
. ; $(DOCKER) kill $(BUILD_SERVER_CONTAINER) && $(DOCKER) network rm build
|
.
|
||||||
endef
|
$(if $(findstring docker,$(COMMAND)), @docker kill $(BUILD_SERVER_CONTAINER))
|
||||||
|
$(if $(findstring docker,$(COMMAND)), @docker network rm build)
|
||||||
define build-mq-ctr
|
|
||||||
buildah/mq-buildah $1 $2 \
|
|
||||||
--file /src/Dockerfile-server \
|
|
||||||
--build-arg MQ_URL="file:///src/downloads/$3" \
|
|
||||||
--build-arg MQ_PACKAGES="$(MQ_PACKAGES)" \
|
|
||||||
--build-arg IMAGE_REVISION="$(IMAGE_REVISION)" \
|
|
||||||
--build-arg IMAGE_SOURCE="$(IMAGE_SOURCE)" \
|
|
||||||
--build-arg IMAGE_TAG="$1:$2" \
|
|
||||||
--build-arg MQM_UID=$(MQM_UID) \
|
|
||||||
--label version=$(MQ_VERSION) \
|
|
||||||
--label name=$1 \
|
|
||||||
--label build-date=$(shell date +%Y-%m-%dT%H:%M:%S%z) \
|
|
||||||
--label release="$(RELEASE)" \
|
|
||||||
--label architecture="$(ARCH)" \
|
|
||||||
--label run="docker run -d -e LICENSE=accept $1:$2" \
|
|
||||||
--label vcs-ref=$(IMAGE_REVISION) \
|
|
||||||
--label vcs-type=git \
|
|
||||||
--label vcs-url=$(IMAGE_SOURCE) \
|
|
||||||
--target $4
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
DOCKER_SERVER_VERSION=$(shell docker version --format "{{ .Server.Version }}")
|
DOCKER_SERVER_VERSION=$(shell docker version --format "{{ .Server.Version }}")
|
||||||
DOCKER_CLIENT_VERSION=$(shell docker version --format "{{ .Client.Version }}")
|
DOCKER_CLIENT_VERSION=$(shell docker version --format "{{ .Client.Version }}")
|
||||||
.PHONY: docker-version
|
PODMAN_VERSION=$(shell podman version --format "{{ .Version }}")
|
||||||
docker-version:
|
.PHONY: command-version
|
||||||
|
command-version:
|
||||||
|
# If we're using Docker, then check it's recent enough to support multi-stage builds
|
||||||
|
ifneq (,$(findstring docker,$(COMMAND)))
|
||||||
@test "$(word 1,$(subst ., ,$(DOCKER_CLIENT_VERSION)))" -ge "17" || ("$(word 1,$(subst ., ,$(DOCKER_CLIENT_VERSION)))" -eq "17" && "$(word 2,$(subst ., ,$(DOCKER_CLIENT_VERSION)))" -ge "05") || (echo "Error: Docker client 17.05 or greater is required" && exit 1)
|
@test "$(word 1,$(subst ., ,$(DOCKER_CLIENT_VERSION)))" -ge "17" || ("$(word 1,$(subst ., ,$(DOCKER_CLIENT_VERSION)))" -eq "17" && "$(word 2,$(subst ., ,$(DOCKER_CLIENT_VERSION)))" -ge "05") || (echo "Error: Docker client 17.05 or greater is required" && exit 1)
|
||||||
@test "$(word 1,$(subst ., ,$(DOCKER_SERVER_VERSION)))" -ge "17" || ("$(word 1,$(subst ., ,$(DOCKER_SERVER_VERSION)))" -eq "17" && "$(word 2,$(subst ., ,$(DOCKER_CLIENT_VERSION)))" -ge "05") || (echo "Error: Docker server 17.05 or greater is required" && exit 1)
|
@test "$(word 1,$(subst ., ,$(DOCKER_SERVER_VERSION)))" -ge "17" || ("$(word 1,$(subst ., ,$(DOCKER_SERVER_VERSION)))" -eq "17" && "$(word 2,$(subst ., ,$(DOCKER_CLIENT_VERSION)))" -ge "05") || (echo "Error: Docker server 17.05 or greater is required" && exit 1)
|
||||||
|
endif
|
||||||
.PHONY: build-advancedserver
|
ifneq (,$(findstring podman,$(COMMAND)))
|
||||||
ifdef RHEL_HOST
|
@test "$(word 1,$(subst ., ,$(PODMAN_VERSION)))" -ge "1" || (echo "Error: Podman version 1.0 or greater is required" && exit 1)
|
||||||
# Build using Buildah inside a container on RHEL hosts
|
|
||||||
build-advancedserver: build-advancedserver-ctr
|
|
||||||
else
|
|
||||||
build-advancedserver: build-advancedserver-host
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: build-advancedserver-host
|
.PHONY: build-advancedserver-host
|
||||||
build-advancedserver-host: downloads/$(MQ_ARCHIVE) docker-version
|
build-advancedserver-host: build-advancedserver
|
||||||
|
|
||||||
|
.PHONY: build-advancedserver
|
||||||
|
build-advancedserver: log-build-env downloads/$(MQ_ARCHIVE) command-version
|
||||||
$(info $(SPACER)$(shell printf $(TITLE)"Build $(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG)"$(END)))
|
$(info $(SPACER)$(shell printf $(TITLE)"Build $(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG)"$(END)))
|
||||||
$(call build-mq,$(MQ_IMAGE_ADVANCEDSERVER),$(MQ_TAG),Dockerfile-server,$(MQ_ARCHIVE),mq-server)
|
$(call build-mq,$(MQ_IMAGE_ADVANCEDSERVER),$(MQ_TAG),Dockerfile-server,$(MQ_ARCHIVE),mq-server)
|
||||||
|
|
||||||
.PHONY: build-advancedserver-ctr
|
.PHONY: build-devserver-host
|
||||||
build-advancedserver-ctr: downloads/$(MQ_ARCHIVE)
|
build-devserver-host: build-devserver
|
||||||
$(info $(shell printf $(TITLE)"Build $(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG) in a container"$(END)))
|
|
||||||
$(call build-mq-ctr,$(MQ_IMAGE_ADVANCEDSERVER),$(MQ_TAG),$(MQ_ARCHIVE),mq-server)
|
|
||||||
|
|
||||||
.PHONY: build-devserver
|
.PHONY: build-devserver
|
||||||
ifdef RHEL_HOST
|
build-devserver: log-build-env downloads/$(MQ_ARCHIVE_DEV) command-version
|
||||||
# Build using Buildah inside a container on RHEL hosts
|
|
||||||
build-devserver: build-devserver-ctr
|
|
||||||
else
|
|
||||||
build-devserver: build-devserver-host
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: build-devserver-host
|
|
||||||
build-devserver-host: downloads/$(MQ_ARCHIVE_DEV) docker-version
|
|
||||||
$(info $(shell printf $(TITLE)"Build $(MQ_IMAGE_DEVSERVER):$(MQ_TAG)"$(END)))
|
$(info $(shell printf $(TITLE)"Build $(MQ_IMAGE_DEVSERVER):$(MQ_TAG)"$(END)))
|
||||||
$(call build-mq,$(MQ_IMAGE_DEVSERVER),$(MQ_TAG),Dockerfile-server,$(MQ_ARCHIVE_DEV),mq-dev-server)
|
$(call build-mq,$(MQ_IMAGE_DEVSERVER),$(MQ_TAG),Dockerfile-server,$(MQ_ARCHIVE_DEV),mq-dev-server)
|
||||||
|
|
||||||
.PHONY: build-devserver-ctr
|
|
||||||
build-devserver-ctr: downloads/$(MQ_ARCHIVE_DEV)
|
|
||||||
$(info $(shell printf $(TITLE)"Build $(MQ_IMAGE_DEVSERVER):$(MQ_TAG) in a container"$(END)))
|
|
||||||
$(call build-mq-ctr,$(MQ_IMAGE_DEVSERVER),$(MQ_TAG),$(MQ_ARCHIVE_DEV),mq-dev-server)
|
|
||||||
|
|
||||||
.PHONY: build-advancedserver-cover
|
.PHONY: build-advancedserver-cover
|
||||||
build-advancedserver-cover: docker-version
|
build-advancedserver-cover: command-version
|
||||||
$(DOCKER) build --build-arg BASE_IMAGE=$(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG) -t $(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG)-cover -f Dockerfile-server.cover .
|
$(COMMAND) build --build-arg BASE_IMAGE=$(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG) -t $(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG)-cover -f Dockerfile-server.cover .
|
||||||
|
|
||||||
.PHONY: build-explorer
|
.PHONY: build-explorer
|
||||||
build-explorer: downloads/$(MQ_ARCHIVE_DEV)
|
build-explorer: downloads/$(MQ_ARCHIVE_DEV)
|
||||||
@@ -308,13 +255,22 @@ build-sdk: downloads/$(MQ_ARCHIVE_DEV)
|
|||||||
$(info $(shell printf $(TITLE)"Build $(MQ_IMAGE_SDK)"$(END)))
|
$(info $(shell printf $(TITLE)"Build $(MQ_IMAGE_SDK)"$(END)))
|
||||||
$(call build-mq,mq-sdk,$(MQ_TAG),incubating/mq-sdk/Dockerfile,$(MQ_SDK_ARCHIVE),mq-sdk)
|
$(call build-mq,mq-sdk,$(MQ_TAG),incubating/mq-sdk/Dockerfile,$(MQ_SDK_ARCHIVE),mq-sdk)
|
||||||
|
|
||||||
.PHONY: debug-vars
|
.PHONY: log-build-env
|
||||||
debug-vars:
|
log-build-vars:
|
||||||
|
$(info $(SPACER)$(shell printf $(TITLE)"Build environment"$(END)))
|
||||||
|
@echo ARCH=$(ARCH)
|
||||||
@echo MQ_VERSION=$(MQ_VERSION)
|
@echo MQ_VERSION=$(MQ_VERSION)
|
||||||
@echo MQ_VERSION_VRM=$(MQ_VERSION_VRM)
|
|
||||||
@echo MQ_ARCHIVE=$(MQ_ARCHIVE)
|
@echo MQ_ARCHIVE=$(MQ_ARCHIVE)
|
||||||
@echo MQ_IMAGE_DEVSERVER=$(MQ_IMAGE_DEVSERVER)
|
@echo MQ_IMAGE_DEVSERVER=$(MQ_IMAGE_DEVSERVER)
|
||||||
@echo MQ_IMAGE_ADVANCEDSERVER=$(MQ_IMAGE_ADVANCEDSERVER)
|
@echo MQ_IMAGE_ADVANCEDSERVER=$(MQ_IMAGE_ADVANCEDSERVER)
|
||||||
|
@echo COMMAND=$(COMMAND)
|
||||||
|
@echo MQM_UID=$(MQM_UID)
|
||||||
|
|
||||||
|
.PHONY: log-build-env
|
||||||
|
log-build-env: log-build-vars
|
||||||
|
$(info $(SPACER)$(shell printf $(TITLE)"Build environment - $(COMMAND) info"$(END)))
|
||||||
|
@echo Command version: $(shell $(COMMAND) --version)
|
||||||
|
$(COMMAND) info
|
||||||
|
|
||||||
include formatting.mk
|
include formatting.mk
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ For issues relating specifically to the container image or Helm chart, please us
|
|||||||
The Dockerfiles and associated code and scripts are licensed under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
|
The Dockerfiles and associated code and scripts are licensed under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
|
||||||
Licenses for the products installed within the images are as follows:
|
Licenses for the products installed within the images are as follows:
|
||||||
|
|
||||||
- [IBM MQ Advanced for Developers](http://www14.software.ibm.com/cgi-bin/weblap/lap.pl?la_formnum=Z125-3301-14&li_formnum=L-APIG-AVCJ4S) (International License Agreement for Non-Warranted Programs). This license may be viewed from an image using the `LICENSE=view` environment variable as described above or by following the link above.
|
- [IBM MQ Advanced for Developers](http://www14.software.ibm.com/cgi-bin/weblap/lap.pl?la_formnum=Z125-3301-14&li_formnum=L-APIG-BBZHCQ) (International License Agreement for Non-Warranted Programs). This license may be viewed from an image using the `LICENSE=view` environment variable as described above or by following the link above.
|
||||||
- [IBM MQ Advanced](http://www14.software.ibm.com/cgi-bin/weblap/lap.pl?la_formnum=Z125-3301-14&li_formnum=L-APIG-AZYF4X) (International Program License Agreement). This license may be viewed from an image using the `LICENSE=view` environment variable as described above or by following the link above.
|
- [IBM MQ Advanced](http://www14.software.ibm.com/cgi-bin/weblap/lap.pl?la_formnum=Z125-3301-14&li_formnum=L-APIG-BBSHJL) (International Program License Agreement). This license may be viewed from an image using the `LICENSE=view` environment variable as described above or by following the link above.
|
||||||
- License information for Ubuntu packages may be found in `/usr/share/doc/${package}/copyright`
|
- License information for Ubuntu packages may be found in `/usr/share/doc/${package}/copyright`
|
||||||
|
|
||||||
Note: The IBM MQ Advanced for Developers license does not permit further distribution and the terms restrict usage to a developer machine.
|
Note: The IBM MQ Advanced for Developers license does not permit further distribution and the terms restrict usage to a developer machine.
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# -*- mode: sh -*-
|
|
||||||
# © Copyright IBM Corporation 2019
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# Build a container image from a Dockerfile using Buildah
|
|
||||||
# If the Docker socket is available, the image will be pushed to Docker once built.
|
|
||||||
|
|
||||||
readonly IMAGE=$1:$2
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
readonly SRC="/src"
|
|
||||||
readonly OCI_DIR="/var/oci"
|
|
||||||
|
|
||||||
echo "****************************************"
|
|
||||||
echo " Inside the Buildah container"
|
|
||||||
echo "****************************************"
|
|
||||||
set -ex
|
|
||||||
# Build using the supplied options. Always pass the source directory in, and
|
|
||||||
# use it as the build context
|
|
||||||
buildah build-using-dockerfile --tag ${IMAGE} --volume /src:/src "$@" /src
|
|
||||||
|
|
||||||
if [ -e ${OCI_DIR} ]; then
|
|
||||||
buildah push ${IMAGE} oci-archive:${OCI_DIR}/${IMAGE}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e /var/run/docker.sock ]; then
|
|
||||||
buildah push ${IMAGE} docker-daemon:${IMAGE}
|
|
||||||
fi
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# -*- mode: sh -*-
|
|
||||||
# © Copyright IBM Corporation 2019
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# Build and run a container image with Buildah installed
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
echo "Usage: $0 imageName imageTag buildah-options"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
|
|
||||||
readonly DIR=${SCRIPT_DIR}/..
|
|
||||||
readonly BUILDAH_IMAGE=mq-buildah
|
|
||||||
RUN_OPTS="--volume ${DIR}:/src --cap-add SYS_ADMIN --rm --interactive --tty"
|
|
||||||
CMD="docker"
|
|
||||||
|
|
||||||
# If Docker is installed, then map the Docker socket into the container, to
|
|
||||||
# allow buildah to push the resulting image into Docker's image store
|
|
||||||
# WARNING: This means that the buildah container can do anything the "docker"
|
|
||||||
# can do.
|
|
||||||
command -v docker
|
|
||||||
if [[ $? == 0 && -e /var/run/docker.sock ]]; then
|
|
||||||
RUN_OPTS="${RUN_OPTS} --volume /var/run/docker.sock:/var/run/docker.sock"
|
|
||||||
fi
|
|
||||||
|
|
||||||
command -v podman
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
CMD="podman"
|
|
||||||
OCI_DIR="/tmp/mq-buildah"
|
|
||||||
mkdir -p ${OCI_DIR}
|
|
||||||
RUN_OPTS="${RUN_OPTS} --volume ${OCI_DIR}:/var/oci"
|
|
||||||
echo "Image archives will be written to ${OCI_DIR}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
${CMD} build --tag ${BUILDAH_IMAGE} --file ${SCRIPT_DIR}/Dockerfile ${SCRIPT_DIR}
|
|
||||||
set -x
|
|
||||||
${CMD} run ${RUN_OPTS} ${BUILDAH_IMAGE} "$@"
|
|
||||||
@@ -29,6 +29,7 @@ import (
|
|||||||
"github.com/ibm-messaging/mq-container/internal/name"
|
"github.com/ibm-messaging/mq-container/internal/name"
|
||||||
"github.com/ibm-messaging/mq-container/internal/ready"
|
"github.com/ibm-messaging/mq-container/internal/ready"
|
||||||
"github.com/ibm-messaging/mq-container/internal/tls"
|
"github.com/ibm-messaging/mq-container/internal/tls"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/mqini"
|
||||||
)
|
)
|
||||||
|
|
||||||
func doMain() error {
|
func doMain() error {
|
||||||
@@ -117,29 +118,6 @@ func doMain() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle /var/mqm/ permissions in upgrade to UBI
|
|
||||||
if *initFlag {
|
|
||||||
varMqmDirs := []string{
|
|
||||||
"/var/mqm/config",
|
|
||||||
"/var/mqm/conv",
|
|
||||||
"/var/mqm/errors",
|
|
||||||
"/var/mqm/exits",
|
|
||||||
"/var/mqm/exits64",
|
|
||||||
"/var/mqm/log",
|
|
||||||
"/var/mqm/mqft",
|
|
||||||
"/var/mqm/qmgrs",
|
|
||||||
"/var/mqm/shared",
|
|
||||||
"/var/mqm/sockets",
|
|
||||||
"/var/mqm/trace",
|
|
||||||
"/var/mqm/web",
|
|
||||||
}
|
|
||||||
err = configureOwnership(varMqmDirs)
|
|
||||||
if err != nil {
|
|
||||||
logTermination(err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If init flag is set, exit now
|
// If init flag is set, exit now
|
||||||
if *initFlag {
|
if *initFlag {
|
||||||
return nil
|
return nil
|
||||||
@@ -197,6 +175,13 @@ func doMain() error {
|
|||||||
logTermination(err)
|
logTermination(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = mqini.AddStanzas(name)
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
err = startQueueManager(name)
|
err = startQueueManager(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logTermination(err)
|
logTermination(err)
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
|
||||||
|
|
||||||
"github.com/ibm-messaging/mq-container/internal/command"
|
"github.com/ibm-messaging/mq-container/internal/command"
|
||||||
containerruntime "github.com/ibm-messaging/mq-container/internal/containerruntime"
|
containerruntime "github.com/ibm-messaging/mq-container/internal/containerruntime"
|
||||||
"github.com/ibm-messaging/mq-container/internal/mqscredact"
|
"github.com/ibm-messaging/mq-container/internal/mqscredact"
|
||||||
@@ -34,7 +32,7 @@ import (
|
|||||||
|
|
||||||
// createDirStructure creates the default MQ directory structure under /var/mqm
|
// createDirStructure creates the default MQ directory structure under /var/mqm
|
||||||
func createDirStructure() error {
|
func createDirStructure() error {
|
||||||
out, _, err := command.Run("/opt/mqm/bin/crtmqdir", "-f", "-s")
|
out, _, err := command.Run("/opt/mqm/bin/crtmqdir", "-f", "-a")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error creating directory structure: %v\n", string(out))
|
log.Printf("Error creating directory structure: %v\n", string(out))
|
||||||
return err
|
return err
|
||||||
@@ -43,47 +41,6 @@ func createDirStructure() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// configureOwnership recursively handles ownership of files within the given filepath
|
|
||||||
func configureOwnership(paths []string) error {
|
|
||||||
uid, gid, err := command.LookupMQM()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
var fileInfo *unix.Stat_t
|
|
||||||
fileInfo = new(unix.Stat_t)
|
|
||||||
for _, root := range paths {
|
|
||||||
_, err = os.Stat(root)
|
|
||||||
if err != nil {
|
|
||||||
if os.IsNotExist(err) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = filepath.Walk(root, func(from string, info os.FileInfo, err error) error {
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
to := fmt.Sprintf("%v%v", root, from[len(root):])
|
|
||||||
err = unix.Stat(to, fileInfo)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
fileUID := fmt.Sprint(fileInfo.Uid)
|
|
||||||
if strings.Compare(fileUID, "999") == 0 {
|
|
||||||
err = os.Chown(to, uid, gid)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// createQueueManager creates a queue manager, if it doesn't already exist.
|
// createQueueManager creates a queue manager, if it doesn't already exist.
|
||||||
// It returns true if one was created (or a standby was created), or false if one already existed
|
// It returns true if one was created (or a standby was created), or false if one already existed
|
||||||
func createQueueManager(name string) (bool, error) {
|
func createQueueManager(name string) (bool, error) {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ibm-messaging/mq-container/internal/command"
|
"github.com/ibm-messaging/mq-container/internal/command"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/keystore"
|
||||||
"github.com/ibm-messaging/mq-container/internal/mqtemplate"
|
"github.com/ibm-messaging/mq-container/internal/mqtemplate"
|
||||||
"github.com/ibm-messaging/mq-container/internal/tls"
|
"github.com/ibm-messaging/mq-container/internal/tls"
|
||||||
)
|
)
|
||||||
@@ -38,7 +39,7 @@ const trustDir = "/etc/mqm/pki/trust"
|
|||||||
// configureWebTLS configures TLS for Web Console
|
// configureWebTLS configures TLS for Web Console
|
||||||
func configureWebTLS(label string) error {
|
func configureWebTLS(label string) error {
|
||||||
// Return immediately if we have no certificate to use as identity
|
// Return immediately if we have no certificate to use as identity
|
||||||
if label == "" {
|
if label == "" && os.Getenv("MQ_GENERATE_CERTIFICATE_HOSTNAME") == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,12 +73,9 @@ func configureWebTLS(label string) error {
|
|||||||
func configureTLSDev() error {
|
func configureTLSDev() error {
|
||||||
const mqsc string = "/etc/mqm/20-dev-tls.mqsc"
|
const mqsc string = "/etc/mqm/20-dev-tls.mqsc"
|
||||||
const mqscTemplate string = mqsc + ".tpl"
|
const mqscTemplate string = mqsc + ".tpl"
|
||||||
const sslCipherSpec string = "TLS_RSA_WITH_AES_128_CBC_SHA256"
|
|
||||||
|
|
||||||
if os.Getenv("MQ_DEV") == "true" {
|
if os.Getenv("MQ_DEV") == "true" {
|
||||||
err := mqtemplate.ProcessTemplateFile(mqscTemplate, mqsc, map[string]string{
|
err := mqtemplate.ProcessTemplateFile(mqscTemplate, mqsc, map[string]string{}, log)
|
||||||
"SSLCipherSpec": sslCipherSpec,
|
|
||||||
}, log)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -129,8 +127,30 @@ func configureSSOTLS(p12TrustStore tls.KeyStoreData) (string, error) {
|
|||||||
// Check keystore exists
|
// Check keystore exists
|
||||||
ks := filepath.Join(keyStoreDir, webKeyStoreName)
|
ks := filepath.Join(keyStoreDir, webKeyStoreName)
|
||||||
_, err := os.Stat(ks)
|
_, err := os.Stat(ks)
|
||||||
if err != nil {
|
// Now we know if the file exists let's check whether we should have it or not.
|
||||||
return "", fmt.Errorf("Failed to find existing keystore %s: %v", ks, err)
|
// Check if we're being told to generate the certificate
|
||||||
|
genHostName := os.Getenv("MQ_GENERATE_CERTIFICATE_HOSTNAME")
|
||||||
|
if genHostName != "" {
|
||||||
|
// We've got to generate the certificate with the hostname given
|
||||||
|
if err == nil {
|
||||||
|
log.Printf("Replacing existing keystore %s - generating new certificate", ks)
|
||||||
|
}
|
||||||
|
// Keystore doesn't exist so create it and populate a certificate
|
||||||
|
newKS := keystore.NewPKCS12KeyStore(ks, p12TrustStore.Password)
|
||||||
|
err = newKS.Create()
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Failed to create keystore %s: %v", ks, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = newKS.CreateSelfSignedCertificate("default", fmt.Sprintf("CN=%s", genHostName), genHostName)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Failed to generate certificate in keystore %s with DN of 'CN=%s': %v", ks, genHostName, err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Keystore should already exist
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Failed to find existing keystore %s: %v", ks, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check truststore exists
|
// Check truststore exists
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ func logDateStamp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func logGitRepo() {
|
func logGitRepo() {
|
||||||
log.Printf("Image revision: %v", ImageRevision)
|
// log.Printf("Image revision: %v", ImageRevision)
|
||||||
}
|
}
|
||||||
|
|
||||||
func logGitCommit() {
|
func logGitCommit() {
|
||||||
log.Printf("Image source: %v", ImageSource)
|
// log.Printf("Image source: %v", ImageSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
func logImageTag() {
|
func logImageTag() {
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ func configureSSO(p12TrustStore tls.KeyStoreData) (string, error) {
|
|||||||
"MQ_OIDC_TOKEN_ENDPOINT",
|
"MQ_OIDC_TOKEN_ENDPOINT",
|
||||||
"MQ_OIDC_JWK_ENDPOINT",
|
"MQ_OIDC_JWK_ENDPOINT",
|
||||||
"MQ_OIDC_ISSUER_IDENTIFIER",
|
"MQ_OIDC_ISSUER_IDENTIFIER",
|
||||||
"MQ_OIDC_CERTIFICATE",
|
|
||||||
}
|
}
|
||||||
for _, envVar := range requiredEnvVars {
|
for _, envVar := range requiredEnvVars {
|
||||||
if len(os.Getenv(envVar)) == 0 {
|
if len(os.Getenv(envVar)) == 0 {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
You need to have the following tools installed:
|
You need to have the following tools installed:
|
||||||
|
|
||||||
* [Docker](https://www.docker.com/) V17.06.1 or later
|
* [Docker](https://www.docker.com/) V17.06.1 or later, or [Podman](https://podman.io) V1.0 or later
|
||||||
* [GNU make](https://www.gnu.org/software/make/)
|
* [GNU make](https://www.gnu.org/software/make/)
|
||||||
|
|
||||||
If you are working in the Windows Subsystem for Linux, follow [this guide by Microsoft to set up Docker](https://blogs.msdn.microsoft.com/commandline/2017/12/08/cross-post-wsl-interoperability-with-docker/) first.
|
If you are working in the Windows Subsystem for Linux, follow [this guide by Microsoft to set up Docker](https://blogs.msdn.microsoft.com/commandline/2017/12/08/cross-post-wsl-interoperability-with-docker/) first.
|
||||||
@@ -14,16 +14,10 @@ If you are working in the Windows Subsystem for Linux, follow [this guide by Mic
|
|||||||
This procedure works for building the MQ Continuous Delivery release, on `amd64`, `ppc64le` and `s390x` architectures.
|
This procedure works for building the MQ Continuous Delivery release, on `amd64`, `ppc64le` and `s390x` architectures.
|
||||||
|
|
||||||
1. Create a `downloads` directory in the root of this repository
|
1. Create a `downloads` directory in the root of this repository
|
||||||
2. Download MQ from [IBM Passport Advantage](https://www.ibm.com/software/passportadvantage/) or [IBM Fix Central](https://www.ibm.com/support/fixcentral), and place the downloaded file (for example, `IBM_MQ_9.1.2_UBUNTU_X86-64.tar.gz`) in the `downloads` directory
|
2. Download MQ from [IBM Passport Advantage](https://www.ibm.com/software/passportadvantage/) or [IBM Fix Central](https://www.ibm.com/support/fixcentral), and place the downloaded file (for example, `IBM_MQ_9.1.3_LINUX_X86-64.tar.gz`) in the `downloads` directory
|
||||||
3. Run `make build-advancedserver`
|
3. Run `make build-advancedserver`
|
||||||
|
|
||||||
> **Warning**: Note that MQ offers two different sets of packaging on Linux: one is called "MQ for Linux" and contains RPM files for installing on Red Hat Enterprise Linux and SUSE Linux Enterprise Server. The MQ container build uses a Red Hat Universal Base Image, so you need the "MQ for Linux" RPM files.
|
> **Warning**: Note that MQ offers two different sets of packaging on Linux: one is called "MQ for Linux" and contains RPM files for installing on Red Hat Enterprise Linux and SUSE Linux Enterprise Server; the other is for Ubuntu. The MQ container build uses a Red Hat Universal Base Image, so you need the "MQ for Linux" RPM files.
|
||||||
|
|
||||||
You can build a different version of MQ by setting the `MQ_VERSION` environment variable, for example:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
MQ_VERSION=9.1.0.0 make build-advancedserver
|
|
||||||
```
|
|
||||||
|
|
||||||
If you have an MQ archive file with a different file name, you can specify a particular file (which must be in the `downloads` directory). You should also specify the MQ version, so that the resulting image is tagged correctly, for example:
|
If you have an MQ archive file with a different file name, you can specify a particular file (which must be in the `downloads` directory). You should also specify the MQ version, so that the resulting image is tagged correctly, for example:
|
||||||
|
|
||||||
@@ -36,11 +30,6 @@ Run `make build-devserver`, which will download the latest version of MQ Advance
|
|||||||
|
|
||||||
You can use the environment variable `MQ_ARCHIVE_DEV` to specify an alternative local file to install from (which must be in the `downloads` directory).
|
You can use the environment variable `MQ_ARCHIVE_DEV` to specify an alternative local file to install from (which must be in the `downloads` directory).
|
||||||
|
|
||||||
## Building from a Red Hat Enterprise Linux host
|
|
||||||
Red Hat Enterprise Linux (RHEL) offers a suite of container tools, including Buildah for building container images, and Podman for running containers. Buildah can accept input described in a [Dockerfile](https://docs.docker.com/engine/reference/builder/). This MQ sample uses a multi-stage build, which requires a recent version of Podman, which is not yet available in Red Hat Enterprise Linux V7. Therefore, if you are on a RHEL host, then the `build-devserver` and `build-advancedserver` targets are run using a more recent version of Buildah from inside a container.
|
|
||||||
|
|
||||||
The containerized build process on a RHEL host will write an OCI compliant archive file to `/tmp/mq-buildah`. If a version of Docker is installed on the host, it will also push the image into Docker's internal image registry.
|
|
||||||
|
|
||||||
## Installed components
|
## Installed components
|
||||||
|
|
||||||
This image includes the core MQ server, Java, language packs, GSKit, and web server. This can be configured by setting the `MQ_PACKAGES` argument to `make`.
|
This image includes the core MQ server, Java, language packs, GSKit, and web server. This can be configured by setting the `MQ_PACKAGES` argument to `make`.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ docker run \
|
|||||||
--env LICENSE=accept \
|
--env LICENSE=accept \
|
||||||
--env MQ_QMGR_NAME=QM1 \
|
--env MQ_QMGR_NAME=QM1 \
|
||||||
--detach \
|
--detach \
|
||||||
mqadvanced-server:9.1.2.0-amd64
|
mqadvanced-server:9.1.3.0-amd64
|
||||||
```
|
```
|
||||||
|
|
||||||
The MQ Advanced for Developers image does require the "chown", "setuid", "setgid" and "audit_write" capabilities (plus "dac_override" if you're using an image based on Red Hat Enterprise Linux). This is because it uses the "sudo" command to change passwords inside the container. For example, in Docker, you could do the following:
|
The MQ Advanced for Developers image does require the "chown", "setuid", "setgid" and "audit_write" capabilities (plus "dac_override" if you're using an image based on Red Hat Enterprise Linux). This is because it uses the "sudo" command to change passwords inside the container. For example, in Docker, you could do the following:
|
||||||
@@ -31,7 +31,7 @@ docker run \
|
|||||||
--env LICENSE=accept \
|
--env LICENSE=accept \
|
||||||
--env MQ_QMGR_NAME=QM1 \
|
--env MQ_QMGR_NAME=QM1 \
|
||||||
--detach \
|
--detach \
|
||||||
mqadvanced-server-dev:9.1.2.0-amd64
|
mqadvanced-server-dev:9.1.3.0-amd64
|
||||||
```
|
```
|
||||||
|
|
||||||
### SELinux
|
### SELinux
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ make test-advancedserver
|
|||||||
You can specify the image to use directly by using the `MQ_IMAGE_ADVANCEDSERVER` or `MQ_IMAGE_DEVSERVER` variables, for example:
|
You can specify the image to use directly by using the `MQ_IMAGE_ADVANCEDSERVER` or `MQ_IMAGE_DEVSERVER` variables, for example:
|
||||||
|
|
||||||
```
|
```
|
||||||
MQ_IMAGE_ADVANCEDSERVER=mqadvanced-server:9.1.2.0-amd64 make test-advancedserver
|
MQ_IMAGE_ADVANCEDSERVER=mqadvanced-server:9.1.3.0-amd64 make test-advancedserver
|
||||||
```
|
```
|
||||||
|
|
||||||
You can pass parameters to `go test` with an environment variable. For example, to run the "TestGoldenPath" test, run the following command::
|
You can pass parameters to `go test` with an environment variable. For example, to run the "TestGoldenPath" test, run the following command::
|
||||||
@@ -33,10 +33,10 @@ You can pass parameters to `go test` with an environment variable. For example,
|
|||||||
TEST_OPTS_DOCKER="-run TestGoldenPath" make test-advancedserver
|
TEST_OPTS_DOCKER="-run TestGoldenPath" make test-advancedserver
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use the same environment variables you specified when [building](./building), for example, the following will try and test an image called `mqadvanced-server:9.1.2.0-amd64`:
|
You can also use the same environment variables you specified when [building](./building), for example, the following will try and test an image called `mqadvanced-server:9.1.3.0-amd64`:
|
||||||
|
|
||||||
```
|
```
|
||||||
MQ_VERSION=9.1.2.0 make test-advancedserver
|
MQ_VERSION=9.1.3.0 make test-advancedserver
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running the Docker tests with code coverage
|
### Running the Docker tests with code coverage
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
In order to use the image, it is necessary to accept the terms of the IBM MQ license. This is achieved by specifying the environment variable `LICENSE` equal to `accept` when running the image. You can also view the license terms by setting this variable to `view`. Failure to set the variable will result in the termination of the container with a usage statement. You can view the license in a different language by also setting the `LANG` environment variable.
|
In order to use the image, it is necessary to accept the terms of the IBM MQ license. This is achieved by specifying the environment variable `LICENSE` equal to `accept` when running the image. You can also view the license terms by setting this variable to `view`. Failure to set the variable will result in the termination of the container with a usage statement. You can view the license in a different language by also setting the `LANG` environment variable.
|
||||||
|
|
||||||
|
> **Note**: You can use `podman` instead of `docker` in any of the examples on this page.
|
||||||
|
|
||||||
## Running with the default configuration
|
## Running with the default configuration
|
||||||
You can run a queue manager with the default configuration and a listener on port 1414 using the following command. For example, the following command creates and starts a queue manager called `QM1`, and maps port 1414 on the host to the MQ listener on port 1414 inside the container, as well as port 9443 on the host to the web console on port 9443 inside the container:
|
You can run a queue manager with the default configuration and a listener on port 1414 using the following command. For example, the following command creates and starts a queue manager called `QM1`, and maps port 1414 on the host to the MQ listener on port 1414 inside the container, as well as port 9443 on the host to the web console on port 9443 inside the container:
|
||||||
|
|
||||||
|
|||||||
@@ -16,4 +16,4 @@
|
|||||||
* Set the keystore location for the queue manager
|
* Set the keystore location for the queue manager
|
||||||
ALTER QMGR SSLKEYR('{{ .SSLKeyR }}')
|
ALTER QMGR SSLKEYR('{{ .SSLKeyR }}')
|
||||||
ALTER QMGR CERTLABL('{{ .CertificateLabel }}')
|
ALTER QMGR CERTLABL('{{ .CertificateLabel }}')
|
||||||
|
REFRESH SECURITY(*) TYPE(SSL)
|
||||||
|
|||||||
@@ -14,5 +14,5 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
|
|
||||||
* Set the cipherspec for dev channels
|
* Set the cipherspec for dev channels
|
||||||
ALTER CHANNEL('DEV.APP.SVRCONN') CHLTYPE(SVRCONN) SSLCIPH({{ .SSLCipherSpec }}) SSLCAUTH(OPTIONAL)
|
ALTER CHANNEL('DEV.APP.SVRCONN') CHLTYPE(SVRCONN) SSLCIPH(ANY_TLS12) SSLCAUTH(OPTIONAL)
|
||||||
ALTER CHANNEL('DEV.ADMIN.SVRCONN') CHLTYPE(SVRCONN) SSLCIPH({{ .SSLCipherSpec }}) SSLCAUTH(OPTIONAL)
|
ALTER CHANNEL('DEV.ADMIN.SVRCONN') CHLTYPE(SVRCONN) SSLCIPH(ANY_TLS12) SSLCAUTH(OPTIONAL)
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ install --directory --mode 0775 --owner mqm --group root /mnt/mqm-data/qmgrs
|
|||||||
# Create the directory for MQ configuration files
|
# Create the directory for MQ configuration files
|
||||||
install --directory --mode 0775 --owner mqm --group root /etc/mqm
|
install --directory --mode 0775 --owner mqm --group root /etc/mqm
|
||||||
|
|
||||||
|
# Create the directory for MQ runtime files
|
||||||
|
install --directory --mode 0775 --owner mqm --group root /run/mqm
|
||||||
|
|
||||||
# Create a symlink for /var/mqm -> /mnt/mqm/data
|
# Create a symlink for /var/mqm -> /mnt/mqm/data
|
||||||
ln -s /mnt/mqm/data /var/mqm
|
ln -s /mnt/mqm/data /var/mqm
|
||||||
|
|
||||||
|
|||||||
@@ -151,8 +151,8 @@ func (ks *KeyStore) Import(inputFile, password string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateSelfSignedCertificate creates a self-signed certificate in the keystore
|
// CreateSelfSignedCertificate creates a self-signed certificate in the keystore
|
||||||
func (ks *KeyStore) CreateSelfSignedCertificate(label, dn string) error {
|
func (ks *KeyStore) CreateSelfSignedCertificate(label, dn, hostname string) error {
|
||||||
out, _, err := command.Run(ks.command, "-cert", "-create", "-db", ks.Filename, "-pw", ks.Password, "-label", label, "-dn", dn)
|
out, _, err := command.Run(ks.command, "-cert", "-create", "-db", ks.Filename, "-pw", ks.Password, "-label", label, "-dn", dn, "-san_dnsname", hostname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error running \"%v -cert -create\": %v %s", ks.command, err, out)
|
return fmt.Errorf("error running \"%v -cert -create\": %v %s", ks.command, err, out)
|
||||||
}
|
}
|
||||||
@@ -203,6 +203,8 @@ func (ks *KeyStore) GetCertificateLabels() ([]string, error) {
|
|||||||
func (ks *KeyStore) RenameCertificate(from, to string) error {
|
func (ks *KeyStore) RenameCertificate(from, to string) error {
|
||||||
if ks.command == "/opt/mqm/bin/runmqakm" {
|
if ks.command == "/opt/mqm/bin/runmqakm" {
|
||||||
// runmqakm can't handle certs with ' in them so just use capicmd
|
// runmqakm can't handle certs with ' in them so just use capicmd
|
||||||
|
// Overriding gosec here as this function is in an internal package and only callable by our internal functions.
|
||||||
|
// #nosec G204
|
||||||
cmd := exec.Command("/opt/mqm/gskit8/bin/gsk8capicmd_64", "-cert", "-rename", "-db", ks.Filename, "-pw", ks.Password, "-label", from, "-new_label", to)
|
cmd := exec.Command("/opt/mqm/gskit8/bin/gsk8capicmd_64", "-cert", "-rename", "-db", ks.Filename, "-pw", ks.Password, "-label", from, "-new_label", to)
|
||||||
cmd.Env = append(os.Environ(), "LD_LIBRARY_PATH=/opt/mqm/gskit8/lib64/:/opt/mqm/gskit8/lib")
|
cmd.Env = append(os.Environ(), "LD_LIBRARY_PATH=/opt/mqm/gskit8/lib64/:/opt/mqm/gskit8/lib")
|
||||||
out, _, err := command.RunCmd(cmd)
|
out, _, err := command.RunCmd(cmd)
|
||||||
@@ -219,7 +221,7 @@ func (ks *KeyStore) RenameCertificate(from, to string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListCertificates Lists all certificates in the keystore
|
// ListAllCertificates Lists all certificates in the keystore
|
||||||
func (ks *KeyStore) ListAllCertificates() ([]string, error) {
|
func (ks *KeyStore) ListAllCertificates() ([]string, error) {
|
||||||
out, _, err := command.Run(ks.command, "-cert", "-list", "-type", ks.keyStoreType, "-db", ks.Filename, "-pw", ks.Password)
|
out, _, err := command.Run(ks.command, "-cert", "-list", "-type", ks.keyStoreType, "-db", ks.Filename, "-pw", ks.Password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
20
internal/mqini/mqat.ini
Normal file
20
internal/mqini/mqat.ini
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#*******************************************************************#
|
||||||
|
#* Module Name: mqat.ini *#
|
||||||
|
#* Type : IBM MQ queue manager configuration file *#
|
||||||
|
# Function : Define the configuration of application activity *#
|
||||||
|
#* trace for a single queue manager. *#
|
||||||
|
#*******************************************************************#
|
||||||
|
|
||||||
|
# Global settings stanza, default values
|
||||||
|
AllActivityTrace:
|
||||||
|
ActivityInterval=1
|
||||||
|
ActivityCount=100
|
||||||
|
TraceLevel=MEDIUM
|
||||||
|
TraceMessageData=0
|
||||||
|
StopOnGetTraceMsg=ON
|
||||||
|
SubscriptionDelivery=BATCHED
|
||||||
|
|
||||||
|
# Prevent the sample activity trace program from generating data
|
||||||
|
ApplicationTrace:
|
||||||
|
ApplName=amqsact*
|
||||||
|
Trace=OFF
|
||||||
@@ -19,7 +19,12 @@ package mqini
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ibm-messaging/mq-container/internal/command"
|
"github.com/ibm-messaging/mq-container/internal/command"
|
||||||
@@ -34,6 +39,12 @@ type QueueManager struct {
|
|||||||
InstallationName string
|
InstallationName string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var qmgrDir string
|
||||||
|
|
||||||
|
var stanzasQMINI []string
|
||||||
|
|
||||||
|
var stanzasMQATINI []string
|
||||||
|
|
||||||
// getQueueManagerFromStanza parses a queue manager stanza
|
// getQueueManagerFromStanza parses a queue manager stanza
|
||||||
func getQueueManagerFromStanza(stanza string) (*QueueManager, error) {
|
func getQueueManagerFromStanza(stanza string) (*QueueManager, error) {
|
||||||
scanner := bufio.NewScanner(strings.NewReader(stanza))
|
scanner := bufio.NewScanner(strings.NewReader(stanza))
|
||||||
@@ -76,3 +87,242 @@ func GetErrorLogDirectory(qm *QueueManager) string {
|
|||||||
}
|
}
|
||||||
return filepath.Join(qm.Prefix, "qmgrs", qm.Directory, "errors")
|
return filepath.Join(qm.Prefix, "qmgrs", qm.Directory, "errors")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//AddStanzas Reads supplied mq ini configuration files and updates the stanzas
|
||||||
|
//into queue manager's ini configuration files.
|
||||||
|
func AddStanzas(qmname string) error {
|
||||||
|
|
||||||
|
//find the qmgr directory.
|
||||||
|
qm, err := GetQueueManager(qmname)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
qmgrDir = filepath.Join(qm.Prefix, "qmgrs", qm.Directory)
|
||||||
|
|
||||||
|
//Find the users ini configuration file
|
||||||
|
files := getIniFileList()
|
||||||
|
if len(files) > 1 {
|
||||||
|
msg := fmt.Sprintf("[ %v ]", files)
|
||||||
|
return errors.New("Only a single ini file can be provided. Following ini files are found:" + msg)
|
||||||
|
}
|
||||||
|
if len(files) == 0 {
|
||||||
|
//no ini file update required.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
iniFileBytes, err := ioutil.ReadFile(files[0])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
userconfig := string(iniFileBytes)
|
||||||
|
if len(userconfig) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//Prepare a list of all supported stanzas
|
||||||
|
PopulateAllAvailableStanzas()
|
||||||
|
|
||||||
|
//Update the qmgr ini file with user config.
|
||||||
|
qmConfig, atConfig, err := PrepareConfigStanzasToWrite(userconfig)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = writeConfigStanzas(qmConfig, atConfig)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PopulateAllAvailableStanzas initializes the ini stanzas prescribed by mq specification.
|
||||||
|
func PopulateAllAvailableStanzas() {
|
||||||
|
stanzasQMINI = []string{"ExitPath",
|
||||||
|
"Log",
|
||||||
|
"Service",
|
||||||
|
"ServiceComponent",
|
||||||
|
"Channels",
|
||||||
|
"TCP",
|
||||||
|
"ApiExitLocal",
|
||||||
|
"AccessMode",
|
||||||
|
"RestrictedMode",
|
||||||
|
"XAResourceManager",
|
||||||
|
"DefaultBindType",
|
||||||
|
"SSL",
|
||||||
|
"DiagnosticMessages",
|
||||||
|
"Filesystem",
|
||||||
|
"Security",
|
||||||
|
"TuningParameters",
|
||||||
|
"ExitPropertiesLocal",
|
||||||
|
"LU62",
|
||||||
|
"NETBIOS"}
|
||||||
|
|
||||||
|
stanzasMQATINI = []string{"AllActivityTrace", "ApplicationTrace"}
|
||||||
|
}
|
||||||
|
|
||||||
|
// getIniFileList Checks for the user supplied ini file in /etc/mqm directory.
|
||||||
|
func getIniFileList() []string {
|
||||||
|
|
||||||
|
fileList := []string{}
|
||||||
|
filepath.Walk("/etc/mqm", func(path string, f os.FileInfo, err error) error {
|
||||||
|
if strings.HasSuffix(path, ".ini") {
|
||||||
|
fileList = append(fileList, path)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
return fileList
|
||||||
|
}
|
||||||
|
|
||||||
|
//PrepareConfigStanzasToWrite Reads through the user supplied ini config file and prepares list of
|
||||||
|
//updates to be written into corresponding mq ini files (qm.ini and/or mqat.ini files.)
|
||||||
|
func PrepareConfigStanzasToWrite(userconfig string) (string, string, error) {
|
||||||
|
|
||||||
|
var qminiConfigStr string
|
||||||
|
var mqatiniConfigStr string
|
||||||
|
|
||||||
|
//read the initial version.
|
||||||
|
iniFileBytes, err := ioutil.ReadFile(filepath.Join(qmgrDir, "qm.ini"))
|
||||||
|
if err != nil {
|
||||||
|
return "", "", err
|
||||||
|
}
|
||||||
|
qminiConfigStr = string(iniFileBytes)
|
||||||
|
|
||||||
|
iniFileBytes, err = ioutil.ReadFile(filepath.Join(qmgrDir, "mqat.ini"))
|
||||||
|
if err != nil {
|
||||||
|
return "", "", err
|
||||||
|
}
|
||||||
|
mqatiniConfigStr = string(iniFileBytes)
|
||||||
|
|
||||||
|
stanzaListMerge := make(map[string]strings.Builder)
|
||||||
|
stanzaListAppend := make(map[string]strings.Builder)
|
||||||
|
var sbAppend strings.Builder
|
||||||
|
var sbMerger strings.Builder
|
||||||
|
|
||||||
|
scanner := bufio.NewScanner(strings.NewReader(userconfig))
|
||||||
|
scanner.Split(bufio.ScanLines)
|
||||||
|
consumetoAppend := false
|
||||||
|
consumeToMerge := false
|
||||||
|
var stanza string
|
||||||
|
|
||||||
|
//read through the user file and prepare what we want.
|
||||||
|
for scanner.Scan() {
|
||||||
|
if strings.Contains(scanner.Text(), ":") {
|
||||||
|
consumetoAppend = false
|
||||||
|
consumeToMerge = false
|
||||||
|
stanza = scanner.Text()
|
||||||
|
//check if this stanza exists in the qm.ini/mqat.ini files
|
||||||
|
if strings.Contains(qminiConfigStr, stanza) ||
|
||||||
|
(strings.Contains(mqatiniConfigStr, stanza) && !(strings.Contains(stanza, "ApplicationTrace"))) {
|
||||||
|
consumeToMerge = true
|
||||||
|
sbMerger = strings.Builder{}
|
||||||
|
|
||||||
|
stanzaListMerge[stanza] = sbMerger
|
||||||
|
} else {
|
||||||
|
consumetoAppend = true
|
||||||
|
sbAppend = strings.Builder{}
|
||||||
|
stanzaListAppend[stanza] = sbAppend
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if consumetoAppend {
|
||||||
|
sb := stanzaListAppend[stanza]
|
||||||
|
sb.WriteString(scanner.Text() + "\n")
|
||||||
|
stanzaListAppend[stanza] = sb
|
||||||
|
}
|
||||||
|
if consumeToMerge {
|
||||||
|
sb := stanzaListMerge[stanza]
|
||||||
|
sb.WriteString(scanner.Text() + "\n")
|
||||||
|
stanzaListMerge[stanza] = sb
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//merge if stanza exits.
|
||||||
|
if len(stanzaListMerge) > 0 {
|
||||||
|
for key := range stanzaListMerge {
|
||||||
|
toWrite, filename := ValidateStanzaToWrite(key)
|
||||||
|
if toWrite {
|
||||||
|
attrList := stanzaListMerge[key]
|
||||||
|
switch filename {
|
||||||
|
case "qm.ini":
|
||||||
|
qminiConfigStr = prepareStanzasToMerge(key, attrList, qminiConfigStr)
|
||||||
|
case "mqat.ini":
|
||||||
|
mqatiniConfigStr = prepareStanzasToMerge(key, attrList, mqatiniConfigStr)
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//append new stanzas.
|
||||||
|
if len(stanzaListAppend) > 0 {
|
||||||
|
for key := range stanzaListAppend {
|
||||||
|
attrList := stanzaListAppend[key]
|
||||||
|
if strings.Contains(strings.Join(stanzasMQATINI, ", "), strings.TrimSuffix(strings.TrimSpace(key), ":")) {
|
||||||
|
mqatiniConfigStr = prepareStanzasToAppend(key, attrList, mqatiniConfigStr)
|
||||||
|
} else {
|
||||||
|
qminiConfigStr = prepareStanzasToAppend(key, attrList, qminiConfigStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return qminiConfigStr, mqatiniConfigStr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//ValidateStanzaToWrite Validates stanza to be written and the file it belongs to.
|
||||||
|
func ValidateStanzaToWrite(stanza string) (bool, string) {
|
||||||
|
stanza = strings.TrimSpace(stanza)
|
||||||
|
if strings.Contains(stanza, ":") {
|
||||||
|
stanza = stanza[:len(stanza)-1]
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.Contains(strings.Join(stanzasQMINI, ", "), stanza) {
|
||||||
|
return true, "qm.ini"
|
||||||
|
} else if strings.Contains(strings.Join(stanzasMQATINI, ", "), stanza) {
|
||||||
|
return true, "mqat.ini"
|
||||||
|
} else {
|
||||||
|
return false, ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//prepareStanzasToAppend Prepares list of stanzas that are to be appended into qm ini files(qm.ini/mqat.ini)
|
||||||
|
func prepareStanzasToAppend(key string, attrList strings.Builder, iniConfig string) string {
|
||||||
|
newVal := key + "\n" + attrList.String()
|
||||||
|
iniConfig = iniConfig + newVal
|
||||||
|
return iniConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
//prepareStanzasToMerge Prepares list of stanzas that are to be updated into qm ini files(qm.ini/mqat.ini)
|
||||||
|
//These stanzas are already present in mq ini files and their values have to be updated with user supplied ini.
|
||||||
|
func prepareStanzasToMerge(key string, attrList strings.Builder, iniConfig string) string {
|
||||||
|
lineScanner := bufio.NewScanner(strings.NewReader(attrList.String()))
|
||||||
|
lineScanner.Split(bufio.ScanLines)
|
||||||
|
for lineScanner.Scan() {
|
||||||
|
attrLine := lineScanner.Text()
|
||||||
|
keyvalue := strings.Split(attrLine, "=")
|
||||||
|
//this line present in qm.ini, update value.
|
||||||
|
if strings.Contains(iniConfig, keyvalue[0]) {
|
||||||
|
re := regexp.MustCompile(keyvalue[0] + "=.*")
|
||||||
|
iniConfig = re.ReplaceAllString(iniConfig, attrLine)
|
||||||
|
} else { //this line not present in qm.ini file, add it.
|
||||||
|
re := regexp.MustCompile(key)
|
||||||
|
newVal := key + "\n" + attrLine
|
||||||
|
iniConfig = re.ReplaceAllString(iniConfig, newVal)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return iniConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
//writeConfigStanzas Writes the ini file updates into corresponding mq ini files.
|
||||||
|
func writeConfigStanzas(qmConfig string, atConfig string) error {
|
||||||
|
|
||||||
|
err := ioutil.WriteFile(filepath.Join(qmgrDir, "qm.ini"), []byte(qmConfig), 0644)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = ioutil.WriteFile(filepath.Join(qmgrDir, "mqat.ini"), []byte(atConfig), 0644)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
© Copyright IBM Corporation 2018
|
© Copyright IBM Corporation 2018, 2019
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -16,7 +16,9 @@ limitations under the License.
|
|||||||
package mqini
|
package mqini
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -62,3 +64,139 @@ func TestGetQueueManager(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIniFileStanzas(t *testing.T) {
|
||||||
|
PopulateAllAvailableStanzas()
|
||||||
|
|
||||||
|
checkReturns("ApiExitLocal", true, true, t)
|
||||||
|
checkReturns("Channels", true, true, t)
|
||||||
|
checkReturns("TCP", true, true, t)
|
||||||
|
checkReturns("ServiceComponent", true, true, t)
|
||||||
|
checkReturns("Service", true, true, t)
|
||||||
|
checkReturns("AccessMode", true, true, t)
|
||||||
|
checkReturns("RestrictedMode", true, true, t)
|
||||||
|
checkReturns("XAResourceManager", true, true, t)
|
||||||
|
checkReturns("SSL", true, true, t)
|
||||||
|
checkReturns("Security", true, true, t)
|
||||||
|
checkReturns("TuningParameters", true, true, t)
|
||||||
|
checkReturns("ABC", false, false, t)
|
||||||
|
checkReturns("#1234ABD", true, false, t)
|
||||||
|
checkReturns("AllActivityTrace", false, true, t)
|
||||||
|
checkReturns("ApplicationTrace", false, true, t)
|
||||||
|
checkReturns("xyz123abvc", false, false, t)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIniFile1Update(t *testing.T) {
|
||||||
|
|
||||||
|
iniFileBytes, err := ioutil.ReadFile("test1qm.ini")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Unexpected error: [%s]\n", err.Error())
|
||||||
|
}
|
||||||
|
userconfig := string(iniFileBytes)
|
||||||
|
qmConfig, atConfig, err := PrepareConfigStanzasToWrite(userconfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Unexpected error: [%s]\n", err.Error())
|
||||||
|
}
|
||||||
|
if len(atConfig) == 0 {
|
||||||
|
t.Errorf("Unexpected stanza file update: mqat.ini[%s]\n", atConfig)
|
||||||
|
}
|
||||||
|
if len(qmConfig) == 0 {
|
||||||
|
t.Errorf("Expected stanza file not found: qm.ini\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
scanner := bufio.NewScanner(strings.NewReader(userconfig))
|
||||||
|
scanner.Split(bufio.ScanLines)
|
||||||
|
for scanner.Scan() {
|
||||||
|
line := scanner.Text()
|
||||||
|
if !strings.Contains(qmConfig, line) {
|
||||||
|
t.Errorf("Expected stanza line not found in updated string. line=%s\n, Stanza:%s\n", line, qmConfig)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIniFile2Update(t *testing.T) {
|
||||||
|
|
||||||
|
iniFileBytes, err := ioutil.ReadFile("test2qm.ini")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Unexpected error: [%s]\n", err.Error())
|
||||||
|
}
|
||||||
|
userconfig := string(iniFileBytes)
|
||||||
|
qmConfig, atConfig, err := PrepareConfigStanzasToWrite(userconfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Unexpected error: [%s]\n", err.Error())
|
||||||
|
}
|
||||||
|
if len(atConfig) == 0 {
|
||||||
|
t.Errorf("Expected stanza file not found: mqat.ini\n")
|
||||||
|
}
|
||||||
|
if len(qmConfig) == 0 {
|
||||||
|
t.Errorf("Expected stanza file not found: qm.ini\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
scanner := bufio.NewScanner(strings.NewReader(userconfig))
|
||||||
|
scanner.Split(bufio.ScanLines)
|
||||||
|
for scanner.Scan() {
|
||||||
|
line := scanner.Text()
|
||||||
|
if !strings.Contains(atConfig, line) {
|
||||||
|
t.Errorf("Expected stanza line not found in updated string. line=%s\n, Stanza:%s\n", line, qmConfig)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIniFile3Update(t *testing.T) {
|
||||||
|
|
||||||
|
i := 0
|
||||||
|
iniFileBytes, err := ioutil.ReadFile("test3qm.ini")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Unexpected error: [%s]\n", err.Error())
|
||||||
|
}
|
||||||
|
userconfig := string(iniFileBytes)
|
||||||
|
qmConfig, atConfig, err := PrepareConfigStanzasToWrite(userconfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Unexpected error: [%s]\n", err.Error())
|
||||||
|
}
|
||||||
|
if len(qmConfig) == 0 {
|
||||||
|
t.Errorf("Unexpected stanza file update: qm.ini[%s]\n", atConfig)
|
||||||
|
}
|
||||||
|
if len(atConfig) == 0 {
|
||||||
|
t.Errorf("Expected stanza file not found: mqat.ini\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
scanner := bufio.NewScanner(strings.NewReader(userconfig))
|
||||||
|
scanner.Split(bufio.ScanLines)
|
||||||
|
for scanner.Scan() {
|
||||||
|
line := scanner.Text()
|
||||||
|
i++
|
||||||
|
//first 20 lines of test3qm.ini shall go into qm.ini file and rest into mqat.ini file.
|
||||||
|
if i < 20 {
|
||||||
|
if !strings.Contains(qmConfig, line) {
|
||||||
|
t.Errorf("Expected stanza line not found in updated string. line=%s\n, Stanza:%s\n", line, qmConfig)
|
||||||
|
}
|
||||||
|
} else if i > 20 {
|
||||||
|
if !strings.Contains(atConfig, line) {
|
||||||
|
t.Errorf("Expected stanza line not found in updated string. line=%s\n, Stanza:%s\n", line, qmConfig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkReturns(stanza string, isqmini bool, shouldexist bool, t *testing.T) {
|
||||||
|
|
||||||
|
exists, filename := ValidateStanzaToWrite(stanza)
|
||||||
|
if exists != shouldexist {
|
||||||
|
t.Errorf("Stanza should exist %t but found was %t", shouldexist, exists)
|
||||||
|
}
|
||||||
|
|
||||||
|
if shouldexist {
|
||||||
|
if isqmini {
|
||||||
|
if filename != "qm.ini" {
|
||||||
|
t.Errorf("Expected filename:qm.ini for stanza:%s. But got %s", stanza, filename)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if filename != "mqat.ini" {
|
||||||
|
t.Errorf("Expected filename:mqat.ini for stanza:%s. But got %s", stanza, filename)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
45
internal/mqini/qm.ini
Normal file
45
internal/mqini/qm.ini
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#*******************************************************************#
|
||||||
|
#* Module Name: qm.ini *#
|
||||||
|
#* Type : IBM MQ queue manager configuration file *#
|
||||||
|
# Function : Define the configuration of a single queue manager *#
|
||||||
|
#* *#
|
||||||
|
#*******************************************************************#
|
||||||
|
#* Notes : *#
|
||||||
|
#* 1) This file defines the configuration of the queue manager *#
|
||||||
|
#* *#
|
||||||
|
#*******************************************************************#
|
||||||
|
ExitPath:
|
||||||
|
ExitsDefaultPath=C:\ProgramData\IBM\MQ\exits
|
||||||
|
ExitsDefaultPath64=C:\ProgramData\IBM\MQ\exits64
|
||||||
|
InstanceData:
|
||||||
|
InstanceID=1562831591
|
||||||
|
Startup=ServiceManual
|
||||||
|
#* *#
|
||||||
|
#* *#
|
||||||
|
Log:
|
||||||
|
LogPrimaryFiles=3
|
||||||
|
LogSecondaryFiles=2
|
||||||
|
LogFilePages=4096
|
||||||
|
LogType=CIRCULAR
|
||||||
|
LogBufferPages=0
|
||||||
|
LogPath=C:\ProgramData\IBM\MQ\log\INI1\
|
||||||
|
LogWriteIntegrity=TripleWrite
|
||||||
|
Service:
|
||||||
|
Name=AuthorizationService
|
||||||
|
EntryPoints=14
|
||||||
|
ServiceComponent:
|
||||||
|
Service=AuthorizationService
|
||||||
|
Name=MQSeries.WindowsNT.auth.service
|
||||||
|
Module=amqzfu.dll
|
||||||
|
ComponentDataSize=0
|
||||||
|
Channels:
|
||||||
|
ChlauthEarlyAdopt=Y
|
||||||
|
TCP:
|
||||||
|
SndBuffSize=0
|
||||||
|
RcvBuffSize=0
|
||||||
|
RcvSndBuffSize=0
|
||||||
|
RcvRcvBuffSize=0
|
||||||
|
ClntSndBuffSize=0
|
||||||
|
ClntRcvBuffSize=0
|
||||||
|
SvrSndBuffSize=0
|
||||||
|
SvrRcvBuffSize=0
|
||||||
5
internal/mqini/test1qm.ini
Normal file
5
internal/mqini/test1qm.ini
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ApiExitLocal:
|
||||||
|
Sequence=1
|
||||||
|
Function=EntryPoint
|
||||||
|
Module=/opt/mylibs/mylib.so
|
||||||
|
Name=mylib
|
||||||
7
internal/mqini/test2qm.ini
Normal file
7
internal/mqini/test2qm.ini
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
AllActivityTrace:
|
||||||
|
ActivityInterval=11
|
||||||
|
ActivityCount=1
|
||||||
|
TraceLevel=INFO
|
||||||
|
ApplicationTrace:
|
||||||
|
ApplName=amqsget
|
||||||
|
Trace=ON
|
||||||
23
internal/mqini/test3qm.ini
Normal file
23
internal/mqini/test3qm.ini
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
ApiExitLocal:
|
||||||
|
Sequence=1
|
||||||
|
Function=EntryPoint
|
||||||
|
Module=/opt/MQOpenTracing/MQOpenTracingExit.so
|
||||||
|
Name=MQOpenTracingExit
|
||||||
|
Channels:
|
||||||
|
MQIBindType=FASTPATH
|
||||||
|
Log:
|
||||||
|
LogPrimaryFiles=30
|
||||||
|
LogType=CIRCULAR
|
||||||
|
LogPath=/ProgramfILES/IBM/MQ/log/INI1/
|
||||||
|
TCP:
|
||||||
|
SndBuffSize=4095
|
||||||
|
RcvBuffSize=4095
|
||||||
|
RcvSndBuffSize=4095
|
||||||
|
RcvRcvBuffSize=4095
|
||||||
|
ClntSndBuffSize=2049
|
||||||
|
ClntRcvBuffSize=2049
|
||||||
|
SvrSndBuffSize=2049
|
||||||
|
SvrRcvBuffSize=2049
|
||||||
|
ApplicationTrace:
|
||||||
|
ApplName=amqsput
|
||||||
|
Trace=ON
|
||||||
@@ -12,12 +12,17 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Fedora includes more recent versions of buildah (need buildah V1.7 to get
|
image: ibmcom/mq:9.1.3.0-r2
|
||||||
# multi-stage builds to work properly)
|
manifests:
|
||||||
FROM docker.io/fedora:29
|
- image: ibmcom/mq:9.1.3.0-r2-amd64
|
||||||
RUN yum install -y buildah
|
platform:
|
||||||
COPY build.sh /usr/local/bin/build
|
architecture: amd64
|
||||||
RUN chmod +x /usr/local/bin/build
|
os: linux
|
||||||
ENV STORAGE_DRIVER=vfs
|
- image: ibmcom/mq:9.1.3.0-r2-ppc64le
|
||||||
ENV BUILDAH_ISOLATION=chroot
|
platform:
|
||||||
ENTRYPOINT ["build"]
|
architecture: ppc64le
|
||||||
|
os: linux
|
||||||
|
- image: ibmcom/mq:9.1.3.0-r2-s390x
|
||||||
|
platform:
|
||||||
|
architecture: s390x
|
||||||
|
os: linux
|
||||||
@@ -14,15 +14,15 @@
|
|||||||
|
|
||||||
image: ibmcom/mq:latest
|
image: ibmcom/mq:latest
|
||||||
manifests:
|
manifests:
|
||||||
- image: ibmcom/mq:9.1.2.0-UBI-amd64
|
- image: ibmcom/mq:9.1.3.0-r2-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: linux
|
os: linux
|
||||||
- image: ibmcom/mq:9.1.2.0-UBI-ppc64le
|
- image: ibmcom/mq:9.1.3.0-r2-ppc64le
|
||||||
platform:
|
platform:
|
||||||
architecture: ppc64le
|
architecture: ppc64le
|
||||||
os: linux
|
os: linux
|
||||||
- image: ibmcom/mq:9.1.2.0-UBI-s390x
|
- image: ibmcom/mq:9.1.3.0-r2-s390x
|
||||||
platform:
|
platform:
|
||||||
architecture: s390x
|
architecture: s390x
|
||||||
os: linux
|
os: linux
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# © Copyright IBM Corporation 2015, 2017
|
# © Copyright IBM Corporation 2019
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -12,7 +12,17 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
FROM mqadvanced
|
image: ibmcorp/mqadvanced-server-dev:9.1.3.0-r2
|
||||||
RUN useradd alice -G mqm && \
|
manifests:
|
||||||
echo alice:passw0rd | chpasswd
|
- image: ibmcorp/mqadvanced-server-dev:9.1.3.0-r2-amd64
|
||||||
COPY *.mqsc /etc/mqm/
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
|
- image: ibmcorp/mqadvanced-server-dev:9.1.3.0-r2-ppc64le
|
||||||
|
platform:
|
||||||
|
architecture: ppc64le
|
||||||
|
os: linux
|
||||||
|
- image: ibmcorp/mqadvanced-server-dev:9.1.3.0-r2-s390x
|
||||||
|
platform:
|
||||||
|
architecture: s390x
|
||||||
|
os: linux
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# RHEL-based container build
|
|
||||||
|
|
||||||
Build scripts for building a container image based on Red Hat Enterprise Linux (RHEL), using the [`buildah`](https://github.com/containers/buildah) tool. buildah is supported on RHEL V7.5 and greater.
|
|
||||||
|
|
||||||
WARNING: The code in this directory is not currently in use, pending deletion. The MQ container is now built using a Red Hat UBI image, using "podman build".
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# -*- mode: sh -*-
|
|
||||||
# © Copyright IBM Corporation 2018, 2019
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# Builds and tests the golang programs used by the MQ image.
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# Handle a GOPATH with multiple entries (just choose the first one)
|
|
||||||
IFS=':' read -ra DIR <<< "$GOPATH"
|
|
||||||
cd ${DIR[0]}/src/github.com/ibm-messaging/mq-container/
|
|
||||||
|
|
||||||
# Build and test the Go code
|
|
||||||
mkdir -p build
|
|
||||||
cd build
|
|
||||||
|
|
||||||
rm -f chkmqready chkmqhealthy runmqserver runmqdevserver
|
|
||||||
|
|
||||||
if [ "$MQDEV" = "TRUE" ]; then
|
|
||||||
# Build and test the Go code
|
|
||||||
go build -ldflags "-X \"main.ImageCreated=$(date --iso-8601=seconds)\" -X \"main.ImageRevision=$IMAGE_REVISION\" -X \"main.ImageSource=$IMAGE_SOURCE\"" --tags 'mqdev' ../cmd/runmqserver/
|
|
||||||
go build ../cmd/runmqdevserver/
|
|
||||||
else
|
|
||||||
go build -ldflags "-X \"main.ImageCreated=$(date --iso-8601=seconds)\" -X \"main.ImageRevision=$IMAGE_REVISION\" -X \"main.ImageSource=$IMAGE_SOURCE\"" ../cmd/runmqserver/
|
|
||||||
fi
|
|
||||||
|
|
||||||
go build ../cmd/chkmqready/
|
|
||||||
go build ../cmd/chkmqhealthy/
|
|
||||||
go test -v ../cmd/runmqserver/
|
|
||||||
go test -v ../cmd/chkmqready/
|
|
||||||
go test -v ../cmd/chkmqhealthy/
|
|
||||||
if [ "$MQDEV" = "TRUE" ]; then
|
|
||||||
go test -v ../cmd/runmqdevserver
|
|
||||||
fi
|
|
||||||
go test -v ../internal/...
|
|
||||||
go vet ../cmd/... ../internal/...
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# -*- mode: sh -*-
|
|
||||||
# © Copyright IBM Corporation 2018, 2019
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# Run the Go build script inside the Go container, mounting the source
|
|
||||||
# directory in
|
|
||||||
|
|
||||||
function usage {
|
|
||||||
echo "Usage: $0 TAG DevModeFlag"
|
|
||||||
exit 20
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$#" -ne 2 ]; then
|
|
||||||
echo "ERROR: Invalid number of parameters"
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly tag=$1
|
|
||||||
readonly dev=$2
|
|
||||||
|
|
||||||
IMAGE_REVISION=${IMAGE_REVISION:="Not Applicable"}
|
|
||||||
IMAGE_SOURCE=${IMAGE_SOURCE:="Not Applicable"}
|
|
||||||
|
|
||||||
# Run the build in a container
|
|
||||||
# Note the ":Z" on the volume is to allow the container to access the files when SELinux is enabled
|
|
||||||
# Note the "podman" network is used explicitly, to avoid problems other CNI networks (e.g. on an OpenShift node)
|
|
||||||
podman run \
|
|
||||||
--volume ${PWD}:/opt/app-root/src/go/src/github.com/ibm-messaging/mq-container/:Z \
|
|
||||||
--env IMAGE_REVISION="$IMAGE_REVISION" \
|
|
||||||
--env IMAGE_SOURCE="$IMAGE_SOURCE" \
|
|
||||||
--env MQDEV=${dev} \
|
|
||||||
--user $(id -u) \
|
|
||||||
--rm \
|
|
||||||
--network podman \
|
|
||||||
${tag} \
|
|
||||||
bash -c "cd /opt/app-root/src/go/src/github.com/ibm-messaging/mq-container/ && ./mq-advanced-server-rhel/go-build.sh"
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# -*- mode: sh -*-
|
|
||||||
# © Copyright IBM Corporation 2018, 2019
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# Install one or more MQ components into a buildah container
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
function usage {
|
|
||||||
echo "Usage: $0 MQContainer MountLocation ARCHIVENAME PACKAGES"
|
|
||||||
exit 20
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$#" -ne 4 ]; then
|
|
||||||
echo "ERROR: Invalid number of parameters"
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly ctr_mq=$1
|
|
||||||
readonly mnt_mq=$2
|
|
||||||
readonly archive=$3
|
|
||||||
readonly mq_packages=$4
|
|
||||||
readonly dir_extract=/tmp/extract
|
|
||||||
readonly mqm_uid=888
|
|
||||||
readonly mqm_gid=888
|
|
||||||
|
|
||||||
if [ ! -d ${dir_extract}/MQServer ]; then
|
|
||||||
mkdir -p ${dir_extract}
|
|
||||||
echo Extracting $archive
|
|
||||||
tar -zxf $archive -C ${dir_extract}
|
|
||||||
echo Extracting finished
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Accept the MQ license
|
|
||||||
buildah run --user root --volume ${dir_extract}:/mnt/mq-download:Z $ctr_mq -- /mnt/mq-download/MQServer/mqlicense.sh -text_only -accept
|
|
||||||
|
|
||||||
# Install MQ
|
|
||||||
buildah run --user root --volume ${dir_extract}:/mnt/mq-download:Z $ctr_mq -- bash -c "cd /mnt/mq-download/MQServer && rpm -ivh $mq_packages"
|
|
||||||
|
|
||||||
rm -rf ${dir_extract}/MQServer
|
|
||||||
|
|
||||||
# Remove 32-bit libraries from 64-bit container
|
|
||||||
find $mnt_mq/opt/mqm $mnt_mq/var/mqm -type f -exec file {} \; | awk -F: '/ELF 32-bit/{print $1}' | xargs --no-run-if-empty rm -f
|
|
||||||
|
|
||||||
# Remove tar.gz files unpacked by RPM postinst scripts
|
|
||||||
find $mnt_mq/opt/mqm -name '*.tar.gz' -delete
|
|
||||||
|
|
||||||
# Recommended: Set the default MQ installation (makes the MQ commands available on the PATH)
|
|
||||||
buildah run $ctr_mq -- /opt/mqm/bin/setmqinst -p /opt/mqm -i
|
|
||||||
|
|
||||||
mkdir -p $mnt_mq/run/runmqserver
|
|
||||||
chown ${mqm_uid}:${mqm_gid} $mnt_mq/run/runmqserver
|
|
||||||
|
|
||||||
# Remove the directory structure under /var/mqm which was created by the installer
|
|
||||||
rm -rf $mnt_mq/var/mqm
|
|
||||||
|
|
||||||
# Create the mount point for volumes, ensuring MQ has permissions to all directories
|
|
||||||
mkdir -p $mnt_mq/mnt/mqm
|
|
||||||
install --directory --mode 0775 --owner ${mqm_uid} --group root $mnt_mq/mnt
|
|
||||||
install --directory --mode 0775 --owner ${mqm_uid} --group root $mnt_mq/mnt/mqm
|
|
||||||
install --directory --mode 0775 --owner ${mqm_uid} --group root $mnt_mq/mnt/mqm/data
|
|
||||||
|
|
||||||
# Create the directory for MQ configuration files
|
|
||||||
mkdir -p /etc/mqm
|
|
||||||
install --directory --mode 0775 --owner ${mqm_uid} --group root $mnt_mq/etc/mqm
|
|
||||||
|
|
||||||
# Create a symlink for /var/mqm -> /mnt/mqm/data
|
|
||||||
buildah run --user root $ctr_mq -- ln -s /mnt/mqm/data /var/mqm
|
|
||||||
|
|
||||||
# Optional: Set these values for the IBM Cloud Vulnerability Report
|
|
||||||
sed -i 's/PASS_MAX_DAYS\t99999/PASS_MAX_DAYS\t90/' $mnt_mq/etc/login.defs
|
|
||||||
sed -i 's/PASS_MIN_DAYS\t0/PASS_MIN_DAYS\t1/' $mnt_mq/etc/login.defs
|
|
||||||
sed -i 's/password\t\[success=1 default=ignore\]\tpam_unix\.so obscure sha512/password\t[success=1 default=ignore]\tpam_unix.so obscure sha512 minlen=8/' $mnt_mq/etc/pam.d/password-auth
|
|
||||||
|
|
||||||
buildah run $ctr_mq -- cp -rs /opt/mqm/licenses/ /
|
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# -*- mode: sh -*-
|
|
||||||
# © Copyright IBM Corporation 2018, 2019
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# Build a RHEL image, using the buildah tool
|
|
||||||
|
|
||||||
set -x
|
|
||||||
set -e
|
|
||||||
|
|
||||||
function usage {
|
|
||||||
echo "Usage: $0 ARCHIVE-NAME PACKAGES TAG VERSION MQDevFlag"
|
|
||||||
exit 20
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$#" -ne 5 ]; then
|
|
||||||
echo "ERROR: Invalid number of parameters"
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Setup MQ server working container
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# Use RHEL 7 minimal container (which doesn't include things like Python or Yum)
|
|
||||||
readonly ctr_mq=$(buildah from rhel7-minimal)
|
|
||||||
if [ -z "$ctr_mq" ]
|
|
||||||
then
|
|
||||||
echo "ERROR: ctr_mq is empty. Check above output for errors"
|
|
||||||
exit 50
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly mnt_mq=$(buildah mount $ctr_mq)
|
|
||||||
if [ -z "$mnt_mq" ]
|
|
||||||
then
|
|
||||||
echo "ERROR: mnt_mq is empty. Check above output for errors"
|
|
||||||
exit 50
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly archive=downloads/$1
|
|
||||||
readonly packages=$2
|
|
||||||
readonly tag=$3
|
|
||||||
readonly version=$4
|
|
||||||
readonly mqdev=$5
|
|
||||||
readonly mqm_uid=888
|
|
||||||
readonly mqm_gid=888
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Install MQ server
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
microdnf_opts="--nodocs"
|
|
||||||
# Check whether the host is registered with Red Hat
|
|
||||||
if subscription-manager status ; then
|
|
||||||
# Host is subscribed, but the minimal image has no enabled repos
|
|
||||||
# Note that the "bc" package is the only one in "extras"
|
|
||||||
microdnf_opts="${microdnf_opts} --enablerepo=rhel-7-server-rpms --enablerepo=rhel-7-server-extras-rpms"
|
|
||||||
else
|
|
||||||
# Use the Yum repositories configured on the host
|
|
||||||
cp -R /etc/yum.repos.d/* ${mnt_mq}/etc/yum.repos.d/
|
|
||||||
fi
|
|
||||||
buildah run ${ctr_mq} -- microdnf ${microdnf_opts} install \
|
|
||||||
bash \
|
|
||||||
bc \
|
|
||||||
coreutils \
|
|
||||||
file \
|
|
||||||
findutils \
|
|
||||||
gawk \
|
|
||||||
glibc-common \
|
|
||||||
grep \
|
|
||||||
passwd \
|
|
||||||
procps-ng \
|
|
||||||
sed \
|
|
||||||
shadow-utils \
|
|
||||||
tar \
|
|
||||||
util-linux \
|
|
||||||
which
|
|
||||||
|
|
||||||
# Install "sudo" if using MQ Advanced for Developers
|
|
||||||
if [ "$mqdev" = "TRUE" ]; then
|
|
||||||
buildah run ${ctr_mq} -- microdnf ${microdnf_opts} install sudo
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean up cached files
|
|
||||||
buildah run ${ctr_mq} -- microdnf ${microdnf_opts} clean all
|
|
||||||
rm -rf ${mnt_mq}/etc/yum.repos.d/*
|
|
||||||
|
|
||||||
buildah run --user root $ctr_mq -- groupadd --system --gid ${mqm_gid} mqm
|
|
||||||
buildah run --user root $ctr_mq -- useradd --system --uid ${mqm_uid} --gid mqm --groups 0 mqm
|
|
||||||
|
|
||||||
# Install MQ server packages into the MQ builder image
|
|
||||||
./mq-advanced-server-rhel/install-mq-rhel.sh ${ctr_mq} "${mnt_mq}" "${archive}" "${packages}"
|
|
||||||
|
|
||||||
# Create the directory for MQ configuration files
|
|
||||||
mkdir -p ${mnt_mq}/etc/mqm
|
|
||||||
chown ${mqm_uid}:${mqm_gid} ${mnt_mq}/etc/mqm
|
|
||||||
|
|
||||||
# Install the Go binaries into the image
|
|
||||||
install --mode 0750 --owner ${mqm_uid} --group 0 ./build/runmqserver ${mnt_mq}/usr/local/bin/
|
|
||||||
install --mode 6750 --owner ${mqm_uid} --group 0 ./build/chk* ${mnt_mq}/usr/local/bin/
|
|
||||||
install --mode 0750 --owner ${mqm_uid} --group 0 ./NOTICES.txt ${mnt_mq}/opt/mqm/licenses/notices-container.txt
|
|
||||||
|
|
||||||
install --directory --mode 0775 --owner ${mqm_uid} --group 0 ${mnt_mq}/run/runmqserver
|
|
||||||
buildah run --user root $ctr_mq -- touch /run/termination-log
|
|
||||||
buildah run --user root $ctr_mq -- chown mqm:root /run/termination-log
|
|
||||||
buildah run --user root $ctr_mq -- chmod 0660 /run/termination-log
|
|
||||||
|
|
||||||
# Copy in licenses from installed packages
|
|
||||||
install --mode 0550 --owner root --group root ./mq-advanced-server-rhel/writePackages.sh ${mnt_mq}/usr/local/bin/writePackages
|
|
||||||
buildah run --user root $ctr_mq -- /usr/local/bin/writePackages
|
|
||||||
|
|
||||||
# Copy web XML files
|
|
||||||
cp -R web ${mnt_mq}/etc/mqm/web
|
|
||||||
|
|
||||||
# Make "mqm" the owner of all the config files
|
|
||||||
chown --recursive ${mqm_uid}:${mqm_gid} ${mnt_mq}/etc/mqm/*
|
|
||||||
chmod --recursive 0750 ${mnt_mq}/etc/mqm/*
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Final Buildah commands
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
if [ "$mqdev" = "TRUE" ]; then
|
|
||||||
OSTAG="mq messaging developer"
|
|
||||||
DISNAME="IBM MQ Advanced Server Developer Edition"
|
|
||||||
PID="98102d16795c4263ad9ca075190a2d4d"
|
|
||||||
else
|
|
||||||
OSTAG="mq messaging"
|
|
||||||
DISNAME="IBM MQ Advanced Server"
|
|
||||||
PID="4486e8c4cc9146fd9b3ce1f14a2dfc5b"
|
|
||||||
fi
|
|
||||||
|
|
||||||
buildah config \
|
|
||||||
--port 1414/tcp \
|
|
||||||
--port 9157/tcp \
|
|
||||||
--port 9443/tcp \
|
|
||||||
--os linux \
|
|
||||||
--label architecture=amd64 \
|
|
||||||
--label io.openshift.tags="$OSTAG" \
|
|
||||||
--label io.k8s.display-name="$DISNAME" \
|
|
||||||
--label io.k8s.description="IBM MQ is messaging middleware that simplifies and accelerates the integration of diverse applications and business data across multiple platforms. It uses message queues to facilitate the exchanges of information and offers a single messaging solution for cloud, mobile, Internet of Things (IoT) and on-premises environments." \
|
|
||||||
--label name="${tag%:*}" \
|
|
||||||
--label vendor="IBM" \
|
|
||||||
--label version="$version" \
|
|
||||||
--label release="1" \
|
|
||||||
--label run="docker run -d -e LICENSE=accept --name ibm-mq ${tag%:*}" \
|
|
||||||
--label summary="$DISNAME" \
|
|
||||||
--label description="IBM MQ is messaging middleware that simplifies and accelerates the integration of diverse applications and business data across multiple platforms. It uses message queues to facilitate the exchanges of information and offers a single messaging solution for cloud, mobile, Internet of Things (IoT) and on-premises environments." \
|
|
||||||
--label IBM_PRODUCT_ID="$PID" \
|
|
||||||
--label IBM_PRODUCT_NAME="$DISNAME" \
|
|
||||||
--label IBM_PRODUCT_VERSION="$version" \
|
|
||||||
--env AMQ_ADDITIONAL_JSON_LOG=1 \
|
|
||||||
--env LANG=en_US.UTF-8 \
|
|
||||||
--env LOG_FORMAT=basic \
|
|
||||||
--entrypoint runmqserver \
|
|
||||||
--user ${mqm_uid} \
|
|
||||||
$ctr_mq
|
|
||||||
buildah unmount $ctr_mq
|
|
||||||
buildah commit $ctr_mq $tag
|
|
||||||
|
|
||||||
buildah rm $ctr_mq
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# -*- mode: sh -*-
|
|
||||||
# © Copyright IBM Corporation 2018, 2019
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# Build a RHEL image for building Go programs which use MQ
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
function usage {
|
|
||||||
echo "Usage: $0 REDIST-ARCHIVE-NAME TAG"
|
|
||||||
exit 20
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$#" -ne 2 ]; then
|
|
||||||
echo "ERROR: Invalid number of parameters"
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly mq_redist_archive=downloads/$1
|
|
||||||
readonly tag=$2
|
|
||||||
# Use Red Hat's Go toolset image as the base
|
|
||||||
readonly ctr_mq=$(buildah from devtools/go-toolset-7-rhel7)
|
|
||||||
if [ -z "$ctr_mq" ]
|
|
||||||
then
|
|
||||||
echo "ERROR: ctr_mq is empty. Check above output for errors"
|
|
||||||
exit 50
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly mnt_mq_go=$(buildah mount $ctr_mq)
|
|
||||||
if [ -z "$mnt_mq_go" ]
|
|
||||||
then
|
|
||||||
echo "ERROR: mnt_mq_go is empty. Check above output for errors"
|
|
||||||
exit 50
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install the MQ redistributable client (including header files) into the Go builder image
|
|
||||||
mkdir -p ${mnt_mq_go}/opt/mqm
|
|
||||||
tar -xzf ${mq_redist_archive} -C ${mnt_mq_go}/opt/mqm
|
|
||||||
|
|
||||||
# Clean up Yum files
|
|
||||||
rm -rf ${mnt_mq_go}/etc/yum.repos.d/*
|
|
||||||
|
|
||||||
buildah unmount ${ctr_mq}
|
|
||||||
# Set environment variables for MQ/Go compilation
|
|
||||||
buildah config \
|
|
||||||
--os linux \
|
|
||||||
--env CGO_CFLAGS="-I/opt/mqm/inc/" \
|
|
||||||
--env CGO_LDFLAGS_ALLOW="-Wl,-rpath.*" \
|
|
||||||
${ctr_mq}
|
|
||||||
buildah commit ${ctr_mq} ${tag}
|
|
||||||
|
|
||||||
buildah rm ${ctr_mq}
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# -*- mode: sh -*-
|
|
||||||
# © Copyright IBM Corporation 2018, 2019
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# Build a RHEL image of MQ Advanced for Developers, using the buildah tool
|
|
||||||
|
|
||||||
set -x
|
|
||||||
set -e
|
|
||||||
|
|
||||||
function usage {
|
|
||||||
echo "Usage: $0 BASETAG TAG VERSION"
|
|
||||||
exit 20
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$#" -ne 3 ]; then
|
|
||||||
echo "ERROR: Invalid number of parameters"
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Setup MQ server working container
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# Use a "scratch" container, so the resulting image has minimal files
|
|
||||||
# Resulting image won't have yum, for example
|
|
||||||
readonly basetag=$1
|
|
||||||
readonly ctr_mq=$(buildah from $basetag)
|
|
||||||
if [ -z "$ctr_mq" ]
|
|
||||||
then
|
|
||||||
echo "ERROR: ctr_mq is empty. Check above output for errors"
|
|
||||||
exit 50
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly mnt_mq=$(buildah mount $ctr_mq)
|
|
||||||
if [ -z "$mnt_mq" ]
|
|
||||||
then
|
|
||||||
echo "ERROR: mnt_mq is empty. Check above output for errors"
|
|
||||||
exit 50
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly tag=$2
|
|
||||||
readonly version=$3
|
|
||||||
readonly mqm_uid=888
|
|
||||||
readonly mqm_gid=888
|
|
||||||
|
|
||||||
# WARNING: This is what allows the mqm user to change the password of any other user
|
|
||||||
# It's used by runmqdevserver to change the admin/app passwords.
|
|
||||||
echo "mqm ALL = NOPASSWD: /usr/sbin/chpasswd" > $mnt_mq/etc/sudoers.d/mq-dev-config
|
|
||||||
|
|
||||||
# Run these commands inside the container so that the SELinux context is handled correctly
|
|
||||||
buildah run --user root $ctr_mq -- useradd --gid mqm admin
|
|
||||||
buildah run --user root $ctr_mq -- groupadd --system mqclient
|
|
||||||
buildah run --user root $ctr_mq -- useradd --gid mqclient app
|
|
||||||
buildah run --user root $ctr_mq -- bash -c "echo admin:passw0rd | chpasswd"
|
|
||||||
|
|
||||||
mkdir --parents $mnt_mq/run/runmqdevserver
|
|
||||||
chown ${mqm_uid}:${mqm_gid} $mnt_mq/run/runmqdevserver
|
|
||||||
|
|
||||||
# Copy runmqdevserver program
|
|
||||||
install --mode 0750 --owner ${mqm_uid} --group ${mqm_gid} ./build/runmqdevserver ${mnt_mq}/usr/local/bin/
|
|
||||||
|
|
||||||
install --directory --mode 0775 --owner ${mqm_uid} --group 0 ${mnt_mq}/run/runmqdevserver
|
|
||||||
|
|
||||||
# Copy template files
|
|
||||||
cp ./incubating/mqadvanced-server-dev/*.tpl ${mnt_mq}/etc/mqm/
|
|
||||||
|
|
||||||
# Copy web XML files for default developer configuration
|
|
||||||
cp -R incubating/mqadvanced-server-dev/web/ ${mnt_mq}/etc/mqm/web
|
|
||||||
|
|
||||||
# Make "mqm" the owner of all the config files
|
|
||||||
chown --recursive ${mqm_uid}:${mqm_gid} ${mnt_mq}/etc/mqm/*
|
|
||||||
chmod --recursive 0750 ${mnt_mq}/etc/mqm/*
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Final Buildah commands
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
buildah config \
|
|
||||||
--port 1414/tcp \
|
|
||||||
--port 9157/tcp \
|
|
||||||
--port 9443/tcp \
|
|
||||||
--os linux \
|
|
||||||
--label architecture=amd64 \
|
|
||||||
--label io.openshift.tags="mq messaging developer" \
|
|
||||||
--label io.k8s.display-name="IBM MQ Advanced Server Developer Edition" \
|
|
||||||
--label io.k8s.description="IBM MQ is messaging middleware that simplifies and accelerates the integration of diverse applications and business data across multiple platforms. It uses message queues to facilitate the exchanges of information and offers a single messaging solution for cloud, mobile, Internet of Things (IoT) and on-premises environments." \
|
|
||||||
--label name="${tag%:*}" \
|
|
||||||
--label vendor="IBM" \
|
|
||||||
--label version="$version" \
|
|
||||||
--label release="1" \
|
|
||||||
--label run="docker run -d -e LICENSE=accept --name ibm-mq-dev ${tag%:*}" \
|
|
||||||
--label summary="IBM MQ Advanced Server Developer Edition" \
|
|
||||||
--label description="IBM MQ is messaging middleware that simplifies and accelerates the integration of diverse applications and business data across multiple platforms. It uses message queues to facilitate the exchanges of information and offers a single messaging solution for cloud, mobile, Internet of Things (IoT) and on-premises environments." \
|
|
||||||
--label IBM_PRODUCT_ID="98102d16795c4263ad9ca075190a2d4d" \
|
|
||||||
--label IBM_PRODUCT_NAME="IBM MQ Advanced Server Developer Edition" \
|
|
||||||
--label IBM_PRODUCT_VERSION="$version" \
|
|
||||||
--env AMQ_ADDITIONAL_JSON_LOG=1 \
|
|
||||||
--env LANG=en_US.UTF-8 \
|
|
||||||
--env LOG_FORMAT=basic \
|
|
||||||
--env MQ_ADMIN_PASSWORD=passw0rd \
|
|
||||||
--env MQ_DEV=true \
|
|
||||||
--entrypoint runmqdevserver \
|
|
||||||
--user ${mqm_uid} \
|
|
||||||
$ctr_mq
|
|
||||||
buildah unmount $ctr_mq
|
|
||||||
buildah commit $ctr_mq $tag
|
|
||||||
|
|
||||||
buildah rm $ctr_mq
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# -*- mode: sh -*-
|
|
||||||
# © Copyright IBM Corporation 2018, 2019
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# Copy in licenses from installed packages
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
rm -f /licenses/installed_package_notices
|
|
||||||
|
|
||||||
for p in $(rpm -qa | sort)
|
|
||||||
do
|
|
||||||
rpm -qi $p >> /licenses/installed_package_notices
|
|
||||||
printf "\n" >> /licenses/installed_package_notices
|
|
||||||
done
|
|
||||||
|
|
||||||
chmod 0444 /licenses/installed_package_notices
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
* © Copyright IBM Corporation 2017
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
|
|
||||||
DEFINE CHANNEL(PASSWORD.SVRCONN) CHLTYPE(SVRCONN) REPLACE
|
|
||||||
SET CHLAUTH(PASSWORD.SVRCONN) TYPE(BLOCKUSER) USERLIST('nobody') DESCR('Allow privileged users on this channel')
|
|
||||||
SET CHLAUTH('*') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(NOACCESS) DESCR('BackStop rule')
|
|
||||||
SET CHLAUTH(PASSWORD.SVRCONN) TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(CHANNEL) CHCKCLNT(REQUIRED)
|
|
||||||
ALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) ADOPTCTX(YES)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
* © Copyright IBM Corporation 2017
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
|
|
||||||
REFRESH SECURITY TYPE(CONNAUTH)
|
|
||||||
@@ -1086,8 +1086,8 @@ func TestVersioning(t *testing.T) {
|
|||||||
|
|
||||||
total := 6
|
total := 6
|
||||||
foundCreated := false
|
foundCreated := false
|
||||||
foundRevision := false
|
// foundRevision := false
|
||||||
foundSource := false
|
// foundSource := false
|
||||||
foundMQVersion := false
|
foundMQVersion := false
|
||||||
foundMQLevel := false
|
foundMQLevel := false
|
||||||
foundMQLicense := false
|
foundMQLicense := false
|
||||||
@@ -1108,30 +1108,30 @@ func TestVersioning(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(line, "Image revision:") && !foundRevision {
|
// if strings.Contains(line, "Image revision:") && !foundRevision {
|
||||||
total--
|
// total--
|
||||||
foundRevision = true
|
// foundRevision = true
|
||||||
dataAr := strings.Split(line, " ")
|
// dataAr := strings.Split(line, " ")
|
||||||
data := dataAr[len(dataAr)-1]
|
// data := dataAr[len(dataAr)-1]
|
||||||
|
|
||||||
// Verify revision
|
// // Verify revision
|
||||||
pattern := regexp.MustCompile("^[a-fA-F0-9]{40}$")
|
// pattern := regexp.MustCompile("^[a-fA-F0-9]{40}$")
|
||||||
if !pattern.MatchString(data) {
|
// if !pattern.MatchString(data) {
|
||||||
t.Errorf("Failed to validate revision (%v)", data)
|
// t.Errorf("Failed to validate revision (%v)", data)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if strings.Contains(line, "Image source:") && !foundSource {
|
// if strings.Contains(line, "Image source:") && !foundSource {
|
||||||
total--
|
// total--
|
||||||
foundSource = true
|
// foundSource = true
|
||||||
dataAr := strings.Split(line, " ")
|
// dataAr := strings.Split(line, " ")
|
||||||
data := dataAr[len(dataAr)-1]
|
// data := dataAr[len(dataAr)-1]
|
||||||
|
|
||||||
// Verify source
|
// // Verify source
|
||||||
if !strings.Contains(data, "github") {
|
// if !strings.Contains(data, "github") {
|
||||||
t.Errorf("Failed to validate source (%v)", data)
|
// t.Errorf("Failed to validate source (%v)", data)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if strings.Contains(line, "MQ version:") && !foundMQVersion {
|
if strings.Contains(line, "MQ version:") && !foundMQVersion {
|
||||||
total--
|
total--
|
||||||
@@ -1177,7 +1177,11 @@ func TestVersioning(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !foundCreated || !foundRevision || !foundSource || !foundMQVersion || !foundMQLevel || !foundMQLicense {
|
// if !foundCreated || !foundRevision || !foundSource || !foundMQVersion || !foundMQLevel || !foundMQLicense {
|
||||||
t.Errorf("Failed to find one or more version strings: created(%v) revision(%v) source(%v) mqversion(%v) mqlevel(%v) mqlicense(%v)", foundCreated, foundRevision, foundSource, foundMQVersion, foundMQLevel, foundMQLicense)
|
if !foundCreated || !foundMQVersion || !foundMQLevel || !foundMQLicense {
|
||||||
|
|
||||||
|
// t.Errorf("Failed to find one or more version strings: created(%v) revision(%v) source(%v) mqversion(%v) mqlevel(%v) mqlicense(%v)", foundCreated, foundRevision, foundSource, foundMQVersion, foundMQLevel, foundMQLicense)
|
||||||
|
t.Errorf("Failed to find one or more version strings: created(%v) mqversion(%v) mqlevel(%v) mqlicense(%v)", foundCreated, foundMQVersion, foundMQLevel, foundMQLicense)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
</openidConnectClient>
|
</openidConnectClient>
|
||||||
<variable name="httpHost" value="*"/>
|
<variable name="httpHost" value="*"/>
|
||||||
<variable name="managementMode" value="externallyprovisioned"/>
|
<variable name="managementMode" value="externallyprovisioned"/>
|
||||||
<jndiEntry jndiName="xframeAllowedSourceList" value="${env.MQ_HOSTS}"/>
|
<variable name="mqConsoleFrameAncestors" value="${env.MQ_HOSTS}"/>
|
||||||
<httpDispatcher enableWelcomePage="false" appOrContextRootMissingMessage='<script>document.location.href="/ibmmq/console";</script>' />
|
<httpDispatcher enableWelcomePage="false" appOrContextRootMissingMessage='<script>document.location.href="/ibmmq/console";</script>' />
|
||||||
<include location="tls.xml"/>
|
<include location="tls.xml"/>
|
||||||
</server>
|
</server>
|
||||||
|
|||||||
Reference in New Issue
Block a user