Skip to content

Commit 6f8b47a

Browse files
authored
Merge pull request #23 from arthurbarr/master
Latest updates
2 parents e1829f3 + 8710721 commit 6f8b47a

File tree

382 files changed

+73412
-6629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

382 files changed

+73412
-6629
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
2+
.vscode
23
test/docker/coverage
34
test/docker/vendor
45
test/kubernetes/vendor

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ before_install:
1313
- sudo apt-get update
1414
- sudo apt-get -y install docker-ce
1515
- curl https://glide.sh/get | sh
16-
- sudo curl -Lo /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64
16+
- sudo curl -Lo /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64
1717
- sudo chmod +x /usr/local/bin/dep
1818

1919
install:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change log
22

3+
## master
4+
* Container's stdout can now be set to JSON format (set LOG_FORMAT=json)
5+
* MQ error logs (in JSON or plain text) are now mirrored on stdout for the container.
6+
* `chkmqready` now waits until MQSC scripts in `/etc/mqm` have been applied
7+
* `chkmqready` and `chkmqhealthy` now run as the "mqm" user
8+
* Added ability to optionally use an alternative base image
9+
* Various build and test improvements
10+
311
## 9.0.4 (2017-11-06)
412
* Updated to MQ version 9.0.4.0
513
* Updated to Go version 9

Dockerfile-server

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# © Copyright IBM Corporation 2015, 2017
1+
# © Copyright IBM Corporation 2015, 2018
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -26,7 +26,10 @@ RUN go build ./cmd/runmqserver/
2626
RUN go build ./cmd/chkmqready/
2727
RUN go build ./cmd/chkmqhealthy/
2828
# Run all unit tests
29-
RUN go test -v ./cmd/... ./internal/...
29+
RUN go test -v ./cmd/runmqserver/
30+
RUN go test -v ./cmd/chkmqready/
31+
RUN go test -v ./cmd/chkmqhealthy/
32+
RUN go test -v ./internal/...
3033

3134
###############################################################################
3235
# Main build stage, to build MQ image
@@ -47,16 +50,21 @@ RUN chmod u+x /usr/local/bin/install-mq.sh \
4750
&& sleep 1 \
4851
&& install-mq.sh
4952

53+
# Create a directory for runtime data from runmqserver
54+
RUN mkdir -p /run/runmqserver \
55+
&& chown mqm:mqm /run/runmqserver
56+
5057
COPY --from=builder /go/src/github.com/ibm-messaging/mq-container/runmqserver /usr/local/bin/
5158
COPY --from=builder /go/src/github.com/ibm-messaging/mq-container/chkmq* /usr/local/bin/
5259
COPY NOTICES.txt /opt/mqm/licenses/notices-container.txt
5360

54-
RUN chmod +x /usr/local/bin/runmqserver \
55-
&& chmod +x /usr/local/bin/chkmq*
61+
RUN chmod ug+x /usr/local/bin/runmqserver \
62+
&& chown mqm:mqm /usr/local/bin/*mq* \
63+
&& chmod ug+xs /usr/local/bin/chkmq*
5664

5765
# Always use port 1414
5866
EXPOSE 1414
5967

60-
ENV LANG=en_US.UTF-8 AMQ_DIAGNOSTIC_MSG_SEVERITY=1
68+
ENV LANG=en_US.UTF-8 AMQ_DIAGNOSTIC_MSG_SEVERITY=1 AMQ_ADDITIONAL_JSON_LOG=1 LOG_FORMAT=simple
6169

6270
ENTRYPOINT ["runmqserver"]

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# © Copyright IBM Corporation 2017
1+
# © Copyright IBM Corporation 2017, 2018
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -49,6 +49,7 @@ BUILD_SERVER_CONTAINER=build-server
4949
NUM_CPU=$(shell docker info --format "{{ .NCPU }}")
5050
# BASE_IMAGE_TAG is a normalized version of BASE_IMAGE, suitable for use in a Docker tag
5151
BASE_IMAGE_TAG=$(subst /,-,$(subst :,-,$(BASE_IMAGE)))
52+
MQ_IMAGE_DEVSERVER_BASE=mqadvanced-server-dev-base:$(MQ_VERSION)-$(ARCH)-$(BASE_IMAGE_TAG)
5253

5354
# Try to figure out which archive to use from the BASE_IMAGE
5455
ifeq "$(findstring ubuntu,$(BASE_IMAGE))" "ubuntu"
@@ -139,7 +140,7 @@ test-advancedserver: test/docker/vendor
139140
.PHONY: test-devserver
140141
test-devserver: test/docker/vendor
141142
$(info $(SPACER)$(shell printf $(TITLE)"Test $(DOCKER_FULL_DEVSERVER) on Docker"$(END)))
142-
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_DEVSERVER) go test -parallel $(NUM_CPU)
143+
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_DEVSERVER) go test -parallel $(NUM_CPU) $(TEST_OPTS_DOCKER)
143144

144145
.PHONY: test-advancedserver-cover
145146
test-advancedserver-cover: test/docker/vendor
@@ -189,10 +190,9 @@ define docker-build-mq
189190
--volume "$(realpath ./downloads/)":/usr/share/nginx/html:ro \
190191
--detach \
191192
nginx:alpine
192-
# Make sure we have the latest base image
193-
$(DOCKER) pull $(BASE_IMAGE)
194-
# Build the new image
193+
# Build the new image (use --pull to make sure we have the latest base image)
195194
$(DOCKER) build \
195+
--pull \
196196
--tag $1 \
197197
--file $2 \
198198
--network build \
@@ -220,8 +220,9 @@ build-advancedserver: downloads/$(MQ_ARCHIVE) docker-version
220220
.PHONY: build-devserver
221221
build-devserver: downloads/$(MQ_ARCHIVE_DEV) docker-version
222222
@test "$(shell uname -m)" = "x86_64" || (echo "Error: MQ Advanced for Developers is only available for x86_64 architecture" && exit 1)
223-
$(info $(shell printf $(TITLE)"Build $(MQ_IMAGE_DEVSERVER)"$(END)))
224-
$(call docker-build-mq,$(MQ_IMAGE_DEVSERVER),Dockerfile-server,$(MQ_ARCHIVE_DEV),"98102d16795c4263ad9ca075190a2d4d","IBM MQ Advanced for Developers (Non-Warranted)",$(MQ_VERSION))
223+
$(info $(shell printf $(TITLE)"Build $(MQ_IMAGE_DEVSERVER_BASE)"$(END)))
224+
$(call docker-build-mq,$(MQ_IMAGE_DEVSERVER_BASE),Dockerfile-server,$(MQ_ARCHIVE_DEV),"98102d16795c4263ad9ca075190a2d4d","IBM MQ Advanced for Developers (Non-Warranted)",$(MQ_VERSION))
225+
docker build --tag $(MQ_IMAGE_DEVSERVER) incubating/mqadvanced-server-dev
225226

226227
.PHONY: build-advancedserver-cover
227228
build-advancedserver-cover: docker-version

NOTICES.txt

Lines changed: 93 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,94 @@
1-
===============================================================================
2-
THE FOLLOWING SECTIONS IDENTIFY VARIOUS COMPONENTS CONTAINED IN THE PROGRAM, AND SPECIFY CERTAIN NOTICES AND OTHER INFORMATION REGARDING THOSE COMPONENTS THAT IBM IS REQUIRED TO PROVIDE TO YOU.
3-
4-
NOTWITHSTANDING ANY PROVISION CONTAINED IN ANY OF THE NOTICES AND OTHER INFORMATION SET FORTH BELOW, YOUR USE OF THESE PROGRAM COMPONENTS REMAINS SUBJECT TO THE TERMS AND CONDITIONS SET FORTH IN:
5-
6-
(i) THE PROGRAM'S LICENSE INFORMATION DOCUMENT; AND
7-
(ii) THE IBM LICENSE AGREEMENT SPECIFIED IN THAT LICENSE INFORMATION DOCUMENT.
8-
9-
===============================================================================
10-
11-
==============================================================================
12-
A. SUMMARY
13-
===============================================================================
14-
Section B. below contains provisions relating to certain other components of the Program, as follows:-
15-
16-
B.1 MIT license
17-
Affected Components:
18-
* github.com/hpcloud/tail
19-
Copyright 2015 Hewlett Packard Enterprise Development LP
20-
Copyright (c) 2014 ActiveState
21-
22-
B.2 BSD 3-Clause license
23-
Affected Components:
24-
* golang.org/x/crypto
25-
Copyright (c) 2009 The Go Authors. All rights reserved.
26-
* golang.org/x/sys
27-
Copyright (c) 2009 The Go Authors. All rights reserved.
28-
* gopkg.in/fsnotify.v1
29-
Copyright (c) 2012 The Go Authors. All rights reserved.
30-
Copyright (c) 2012 fsnotify Authors. All rights reserved.
31-
* gopkg.in/tomb.v1
32-
Copyright (c) 2010-2011 - Gustavo Niemeyer <[email protected]>. All rights reserved.
33-
34-
===============================================================================
35-
END OF A. SUMMARY
36-
===============================================================================
37-
==========================================================================
38-
B. LICENSE FILES AND OTHER INFORMATION
39-
==========================================================================
40-
==========================================================================
41-
B.1 MIT license
42-
==========================================================================
43-
Permission is hereby granted, free of charge, to any person obtaining a copy
44-
of this software and associated documentation files (the "Software"), to deal
45-
in the Software without restriction, including without limitation the rights
46-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
47-
copies of the Software, and to permit persons to whom the Software is
48-
furnished to do so, subject to the following conditions:
49-
The above copyright notice and this permission notice shall be included in all
50-
copies or substantial portions of the Software.
51-
52-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
58-
SOFTWARE.
59-
==========================================================================
60-
END OF B.1 MIT license
61-
==========================================================================
62-
63-
==========================================================================
64-
B.2 BSD 3-Clause license
65-
==========================================================================
66-
Redistribution and use in source and binary forms, with or without
67-
modification, are permitted provided that the following conditions are
68-
met:
69-
70-
* Redistributions of source code must retain the above copyright
71-
notice, this list of conditions and the following disclaimer.
72-
* Redistributions in binary form must reproduce the above
73-
copyright notice, this list of conditions and the following disclaimer
74-
in the documentation and/or other materials provided with the
75-
distribution.
76-
* Neither the name of Google Inc. nor the names of its
77-
contributors may be used to endorse or promote products derived from
78-
this software without specific prior written permission.
79-
80-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
81-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
82-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
83-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
84-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
85-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
86-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
87-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
88-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
89-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
90-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
91-
==========================================================================
92-
END OF B.2 BSD 3-Clause license
93-
==========================================================================
94-
95-
==========================================================================
96-
END OF B. LICENSE FILES AND OTHER INFORMATION
97-
==========================================================================
98-
99-
===========================================================
1+
===============================================================================
2+
THE FOLLOWING SECTIONS IDENTIFY VARIOUS COMPONENTS CONTAINED IN THE PROGRAM, AND SPECIFY CERTAIN NOTICES AND OTHER INFORMATION REGARDING THOSE COMPONENTS THAT IBM IS REQUIRED TO PROVIDE TO YOU.
3+
4+
NOTWITHSTANDING ANY PROVISION CONTAINED IN ANY OF THE NOTICES AND OTHER INFORMATION SET FORTH BELOW, YOUR USE OF THESE PROGRAM COMPONENTS REMAINS SUBJECT TO THE TERMS AND CONDITIONS SET FORTH IN:
5+
6+
(i) THE PROGRAM'S LICENSE INFORMATION DOCUMENT; AND
7+
(ii) THE IBM LICENSE AGREEMENT SPECIFIED IN THAT LICENSE INFORMATION DOCUMENT.
8+
9+
===============================================================================
10+
11+
==============================================================================
12+
A. SUMMARY
13+
===============================================================================
14+
Section B. below contains provisions relating to certain other components of the Program, as follows:-
15+
16+
B.1 MIT license
17+
Affected Components:
18+
* sirupsen/logrus
19+
Copyright (c) 2014 Simon Eskildsen
20+
21+
B.2 BSD 3-Clause license
22+
Affected Components:
23+
* golang.org/x/crypto
24+
Copyright (c) 2009 The Go Authors. All rights reserved.
25+
* golang.org/x/sys
26+
Copyright (c) 2009 The Go Authors. All rights reserved.
27+
28+
===============================================================================
29+
END OF A. SUMMARY
30+
===============================================================================
31+
==========================================================================
32+
B. LICENSE FILES AND OTHER INFORMATION
33+
==========================================================================
34+
==========================================================================
35+
B.1 MIT license
36+
==========================================================================
37+
Permission is hereby granted, free of charge, to any person obtaining a copy
38+
of this software and associated documentation files (the "Software"), to deal
39+
in the Software without restriction, including without limitation the rights
40+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
41+
copies of the Software, and to permit persons to whom the Software is
42+
furnished to do so, subject to the following conditions:
43+
The above copyright notice and this permission notice shall be included in all
44+
copies or substantial portions of the Software.
45+
46+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52+
SOFTWARE.
53+
==========================================================================
54+
END OF B.1 MIT license
55+
==========================================================================
56+
57+
==========================================================================
58+
B.2 BSD 3-Clause license
59+
==========================================================================
60+
Redistribution and use in source and binary forms, with or without
61+
modification, are permitted provided that the following conditions are
62+
met:
63+
64+
* Redistributions of source code must retain the above copyright
65+
notice, this list of conditions and the following disclaimer.
66+
* Redistributions in binary form must reproduce the above
67+
copyright notice, this list of conditions and the following disclaimer
68+
in the documentation and/or other materials provided with the
69+
distribution.
70+
* Neither the name of Google Inc. nor the names of its
71+
contributors may be used to endorse or promote products derived from
72+
this software without specific prior written permission.
73+
74+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
75+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
76+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
77+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
78+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
79+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
80+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
81+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
82+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
83+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
84+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
85+
==========================================================================
86+
END OF B.2 BSD 3-Clause license
87+
==========================================================================
88+
89+
==========================================================================
90+
END OF B. LICENSE FILES AND OTHER INFORMATION
91+
==========================================================================
92+
93+
===========================================================
10094
END OF NOTICES AND INFORMATION

README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,13 @@
22

33
# Overview
44

5-
Run [IBM® MQ](http://www-03.ibm.com/software/products/en/ibm-mq) in a container. The supplied [Helm](https://helm.sh/) chart can be used to run the container on a [Kubernetes](https://kubernetes.io) cluster, such as [IBM Cloud Private](https://www.ibm.com/cloud-computing/products/ibm-cloud-private/) or the [IBM Bluemix Container Service](https://www.ibm.com/cloud-computing/bluemix/containers).
5+
Run [IBM® MQ](http://www-03.ibm.com/software/products/en/ibm-mq) in a container. The supplied [Helm](https://helm.sh/) charts can be used to run the container on a [Kubernetes](https://kubernetes.io) cluster, such as [IBM Cloud Private](https://www.ibm.com/cloud-computing/products/ibm-cloud-private/) or the [IBM Cloud Container Service](https://www.ibm.com/cloud/container-service).
66

77
# Current status
88
MQ Advanced for Developers image - [![Build Status](https://travis-ci.org/ibm-messaging/mq-container.svg?branch=master)](https://travis-ci.org/ibm-messaging/mq-container)
99

1010
# Build
11-
After extracting the code from this repository, you can build an image with the latest version of MQ using the following command:
12-
13-
## Building MQ Advanced
14-
You can build an image for MQ Advanced, follow these steps:
15-
16-
1. Clone this repository into the correct location in your [`GOPATH`](https://github.com/golang/go/wiki/GOPATH)
17-
2. Create a directory called `downloads` under the cloned directory tree
18-
3. Download the MQ Advanced for Ubuntu (debs) installer package file `CNLE4ML.tar.gz` into the `downloads` directory
19-
4. Run `make build-advancedserver`
11+
After extracting the code from this repository, you can build an image by following the instructions [here](docs/building.md)
2012

2113
# Usage
2214
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.
@@ -27,6 +19,7 @@ In order to use the image, it is necessary to accept the terms of the IBM MQ lic
2719
* **LICENSE** - Set this to `accept` to agree to the MQ Advanced for Developers license. If you wish to see the license you can set this to `view`.
2820
* **LANG** - Set this to the language you would like the license to be printed in.
2921
* **MQ_QMGR_NAME** - Set this to the name you want your Queue Manager to be created with.
22+
* **LOG_FORMAT** - Set this to change the format of the logs which are printed on the container's stdout. Set to "json" to use JSON format (JSON object per line); set to "simple" to use a simple human-readable. Defaults to "simple".
3023

3124

3225
# Issues and contributions
@@ -47,4 +40,4 @@ Note: The IBM MQ Advanced for Developers license does not permit further distrib
4740

4841
# Copyright
4942

50-
© Copyright IBM Corporation 2015, 2017
43+
© Copyright IBM Corporation 2015, 2018

cmd/chkmqhealthy/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ limitations under the License.
1818
package main
1919

2020
import (
21+
"fmt"
2122
"os"
2223
"os/exec"
2324
"strings"
@@ -35,8 +36,10 @@ func queueManagerHealthy() (bool, error) {
3536
// Run the command and wait for completion
3637
out, err := cmd.CombinedOutput()
3738
if err != nil {
39+
fmt.Println(err)
3840
return false, err
3941
}
42+
fmt.Println(out)
4043
if !strings.Contains(string(out), "(RUNNING)") {
4144
return false, nil
4245
}

0 commit comments

Comments
 (0)