Compare commits
335 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fd8184445 | ||
|
|
6c6c7fe1e3 | ||
|
|
684a2d1b04 | ||
|
|
851ede7bd9 | ||
|
|
b8a7167c4e | ||
|
|
dc00231ec1 | ||
|
|
8a8ea6c6a9 | ||
|
|
9714d0d513 | ||
|
|
6691438fa1 | ||
|
|
426c6c3b9a | ||
|
|
8088cb2902 | ||
|
|
a2ce23aa96 | ||
|
|
95ba16cdb2 | ||
|
|
83fe77b222 | ||
|
|
7ab30723cd | ||
|
|
3f9fc0eaa5 | ||
|
|
ee4351e55d | ||
|
|
ebf55608d7 | ||
|
|
b3fd5f7562 | ||
|
|
3c9ec5f14c | ||
|
|
81c0b70a6f | ||
|
|
a6f307c6b5 | ||
|
|
6f677e2a59 | ||
|
|
612fe3a9ec | ||
|
|
0a9c745d96 | ||
|
|
b64c060ef4 | ||
|
|
8e22763f16 | ||
|
|
40b64e620e | ||
|
|
700cc53c07 | ||
|
|
44d75b169c | ||
|
|
c0bf371b9e | ||
|
|
e362644a55 | ||
|
|
c079c1b60d | ||
|
|
4a3bdf3b53 | ||
|
|
5ff269d2e3 | ||
|
|
3fb2d3fe61 | ||
|
|
6c72c894f7 | ||
|
|
63af43f19d | ||
|
|
64bb5aed8a | ||
|
|
f05a7d3eaf | ||
|
|
723fe2b998 | ||
|
|
44d0e0a432 | ||
|
|
33defc0fc9 | ||
|
|
d69befed71 | ||
|
|
0934289b61 | ||
|
|
f6231cd51c | ||
|
|
d5f04bc470 | ||
|
|
d8cbf4566e | ||
|
|
493bc7bfd4 | ||
|
|
1fa4f6f148 | ||
|
|
ce664dd654 | ||
|
|
f8e057a1d6 | ||
|
|
efd550822d | ||
|
|
d4df05fd2a | ||
|
|
194b04ac13 | ||
|
|
6848038165 | ||
|
|
0d3e177147 | ||
|
|
13f620f21a | ||
|
|
d4a81741cc | ||
|
|
0047301335 | ||
|
|
5ef532d2c1 | ||
|
|
281cdc4578 | ||
|
|
d68c051104 | ||
|
|
c5a52e616c | ||
|
|
c441de7d26 | ||
|
|
a194545f08 | ||
|
|
4f57d1bae2 | ||
|
|
cc0f072908 | ||
|
|
d834ac7c9c | ||
|
|
2dbee560fe | ||
|
|
17d3238161 | ||
|
|
c08ca2e79f | ||
|
|
84df0e8362 | ||
|
|
cc213f429f | ||
|
|
c29159dd38 | ||
|
|
f345ccf920 | ||
|
|
d1b1cfc5d8 | ||
|
|
a19c455ea4 | ||
|
|
694b31d6e8 | ||
|
|
33f82d76ff | ||
|
|
77319629fe | ||
|
|
d9c70c48c5 | ||
|
|
599f5f4b53 | ||
|
|
6840a575f9 | ||
|
|
1b8c816f57 | ||
|
|
9a8ff9b524 | ||
|
|
f3c858184f | ||
|
|
43676049b7 | ||
|
|
df6ce917c2 | ||
|
|
d3eb6e0d3d | ||
|
|
2bfdd51a01 | ||
|
|
be11b3cda1 | ||
|
|
525ff82fe7 | ||
|
|
3e07814bf6 | ||
|
|
b1daacf377 | ||
|
|
9c8b3825be | ||
|
|
4145f077b6 | ||
|
|
c063ddd67d | ||
|
|
5f000ff891 | ||
|
|
e33710eb00 | ||
|
|
2fdd2c51ff | ||
|
|
b73ad12011 | ||
|
|
b276e0b4ef | ||
|
|
a3c0af9648 | ||
|
|
1208a5d08b | ||
|
|
fe8a87b39f | ||
|
|
9a34e9b15c | ||
|
|
78ce84b3a1 | ||
|
|
6d11b0d8ae | ||
|
|
d0fce28ef3 | ||
|
|
31f604cc47 | ||
|
|
c6a921efee | ||
|
|
822a073c4e | ||
|
|
a854c4c627 | ||
|
|
3989661778 | ||
|
|
9a7d44fef6 | ||
|
|
f73347a9cf | ||
|
|
ad1b2db1fd | ||
|
|
11b94de1c0 | ||
|
|
1906896038 | ||
|
|
d5ec1fa505 | ||
|
|
e03ceff7c9 | ||
|
|
64f5ce3624 | ||
|
|
b921bb82d3 | ||
|
|
92e57f2cb1 | ||
|
|
0281e52b47 | ||
|
|
8bdba41f75 | ||
|
|
aa04229d85 | ||
|
|
9e04bfc68a | ||
|
|
8fcdfeb1c4 | ||
|
|
a2d3abfb86 | ||
|
|
e66bcfd77f | ||
|
|
d2ea8d4f06 | ||
|
|
fc19776c04 | ||
|
|
3f07b1e77f | ||
|
|
00568adc6d | ||
|
|
ba1b4f8ef9 | ||
|
|
9b98555886 | ||
|
|
dbfc47591e | ||
|
|
b087f37505 | ||
|
|
08299dd0d1 | ||
|
|
b8f96d0148 | ||
|
|
6bb669d6ac | ||
|
|
80384a65a2 | ||
|
|
c11c0a2bf4 | ||
|
|
29dfe38d32 | ||
|
|
89eae35724 | ||
|
|
b751640b79 | ||
|
|
0bef0e224e | ||
|
|
7166727528 | ||
|
|
cafa841f63 | ||
|
|
f2a9bb4e9d | ||
|
|
e4f02d55cf | ||
|
|
59eaa9c7d2 | ||
|
|
79bfd99911 | ||
|
|
5583cc6fac | ||
|
|
75efeae51b | ||
|
|
7822c2c3bc | ||
|
|
f0e681e23f | ||
|
|
4b1b417b8b | ||
|
|
be0ce898d7 | ||
|
|
1800482934 | ||
|
|
65449ffea8 | ||
|
|
3a2efabdb7 | ||
|
|
bf330ee926 | ||
|
|
fcbb241f07 | ||
|
|
1e2ced3594 | ||
|
|
626fc05d78 | ||
|
|
ea7105c82c | ||
|
|
5c176cce15 | ||
|
|
854a0119de | ||
|
|
4d4051312e | ||
|
|
4ad8f269ee | ||
|
|
9624d7eeb0 | ||
|
|
7f51184821 | ||
|
|
62c7516465 | ||
|
|
ecace2b033 | ||
|
|
5a63591b18 | ||
|
|
29dcccad32 | ||
|
|
0769ebd309 | ||
|
|
1358b32f66 | ||
|
|
4ec2887047 | ||
|
|
74659dbf59 | ||
|
|
0b9a9186cf | ||
|
|
cd46078d2a | ||
|
|
0f9cd3f204 | ||
|
|
bff2f6bfae | ||
|
|
a1ae6b3a97 | ||
|
|
2e0aad0318 | ||
|
|
d6f689d515 | ||
|
|
4984beb139 | ||
|
|
6ded21daac | ||
|
|
32a3fdf2fd | ||
|
|
616cb179d6 | ||
|
|
d4d5e09a02 | ||
|
|
16e244427b | ||
|
|
f0faac6af7 | ||
|
|
aaa86d65e5 | ||
|
|
b887c1a277 | ||
|
|
4660c0622c | ||
|
|
b570a9f019 | ||
|
|
9805c1eaf8 | ||
|
|
63ce0b3377 | ||
|
|
2e3dee931c | ||
|
|
dae2a65e8b | ||
|
|
19f22cd994 | ||
|
|
172a4b0420 | ||
|
|
53fdfe55de | ||
|
|
16abf50f9a | ||
|
|
c409179f4a | ||
|
|
7551ce3812 | ||
|
|
4dfe8ed855 | ||
|
|
2939a9fd1a | ||
|
|
5d0a87ae0a | ||
|
|
2af6953b2b | ||
|
|
0f4e79c0a6 | ||
|
|
f8b500e0a1 | ||
|
|
bcfef94b08 | ||
|
|
ab01d124a9 | ||
|
|
be9c759a1c | ||
|
|
70f45d58bf | ||
|
|
143649deb6 | ||
|
|
0b36edae58 | ||
|
|
45e970e18a | ||
|
|
9f3032f014 | ||
|
|
54f0ae65a6 | ||
|
|
6996f2b9b3 | ||
|
|
987b629a27 | ||
|
|
00a0b1574b | ||
|
|
531f2710c7 | ||
|
|
1ce796a9e2 | ||
|
|
91e20f0f98 | ||
|
|
6f079ca0bb | ||
|
|
7f78ba89bf | ||
|
|
4bbdb36da0 | ||
|
|
a4b9a9abaf | ||
|
|
e251839639 | ||
|
|
9b595a0e01 | ||
|
|
6493e82fa6 | ||
|
|
3127abd5ad | ||
|
|
adad573f99 | ||
|
|
5d3519d9bb | ||
|
|
36a24d8864 | ||
|
|
e18dcbd8e8 | ||
|
|
5da57489e2 | ||
|
|
c389886d3c | ||
|
|
6775264bcc | ||
|
|
77c0cfa221 | ||
|
|
04bb404eee | ||
|
|
d8b6b78d66 | ||
|
|
8eb937b8e0 | ||
|
|
f051325deb | ||
|
|
3aa46e0793 | ||
|
|
bf36f8bb2c | ||
|
|
2be0501904 | ||
|
|
6895097d36 | ||
|
|
d7633d8313 | ||
|
|
818cbaca8d | ||
|
|
60d098d86d | ||
|
|
0075b5b727 | ||
|
|
13981cef86 | ||
|
|
363c8487df | ||
|
|
9d46e6e25a | ||
|
|
4826e83c9e | ||
|
|
1cba663922 | ||
|
|
c9e7ae194e | ||
|
|
d61cc9c686 | ||
|
|
20a2b3f593 | ||
|
|
a382984ab9 | ||
|
|
477d39da9f | ||
|
|
a6f4bdb598 | ||
|
|
e478f8cc67 | ||
|
|
2a858abff8 | ||
|
|
57b4eab2b6 | ||
|
|
55cfb59c75 | ||
|
|
88ca989b41 | ||
|
|
3be0d0d1dd | ||
|
|
a69c06dbf3 | ||
|
|
49e90d2e54 | ||
|
|
1affe991cc | ||
|
|
cde2a5186e | ||
|
|
c55d8f3956 | ||
|
|
460aec3863 | ||
|
|
3d569b3e8c | ||
|
|
831f0695a9 | ||
|
|
81e921162b | ||
|
|
f96304ae8f | ||
|
|
1752e45934 | ||
|
|
9851743ae2 | ||
|
|
ff016cf2be | ||
|
|
d56fce65c2 | ||
|
|
faea308506 | ||
|
|
6773496d99 | ||
|
|
3fcc7b4c6e | ||
|
|
516c8ecc41 | ||
|
|
eea80d139a | ||
|
|
2397966a86 | ||
|
|
3449dc31ad | ||
|
|
9a02ddfa48 | ||
|
|
7009f3a392 | ||
|
|
7c36a9ceea | ||
|
|
bec2e4457d | ||
|
|
9c71fa1c6c | ||
|
|
b41a58645b | ||
|
|
6f3672df4f | ||
|
|
28f2076882 | ||
|
|
fd0f0e0b3a | ||
|
|
ef04949036 | ||
|
|
f9ef635f37 | ||
|
|
6287a25156 | ||
|
|
ab5d7ca1d1 | ||
|
|
b02d8d27b2 | ||
|
|
13e41aeb37 | ||
|
|
f5beed0bef | ||
|
|
778cd07400 | ||
|
|
96311df366 | ||
|
|
89ee583336 | ||
|
|
4968ba2516 | ||
|
|
7e8c8b1f0f | ||
|
|
2910ae363c | ||
|
|
a525c8c380 | ||
|
|
9fb0170f1f | ||
|
|
189637e518 | ||
|
|
b40db6b816 | ||
|
|
3479455449 | ||
|
|
fa8867b9bd | ||
|
|
fcb7377575 | ||
|
|
0e71468826 | ||
|
|
749a459f33 | ||
|
|
2d59a94168 | ||
|
|
54885597fa | ||
|
|
94a4eac2ca | ||
|
|
357cfcba66 | ||
|
|
ab3b44e84b | ||
|
|
913465620b |
@@ -1,3 +1,2 @@
|
|||||||
charts
|
|
||||||
downloads
|
downloads
|
||||||
test
|
.git
|
||||||
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Fore LF line endings to prevent errors in Bash on Windows
|
||||||
|
* text=auto
|
||||||
|
*.sh text eol=lf
|
||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -6,3 +6,9 @@ test/kubernetes/vendor
|
|||||||
build
|
build
|
||||||
coverage
|
coverage
|
||||||
downloads
|
downloads
|
||||||
|
incubating/mqipt/ms81*
|
||||||
|
vendor/github.com/prometheus/client_model/bin/
|
||||||
|
vendor/github.com/prometheus/client_model/.classpath
|
||||||
|
vendor/github.com/prometheus/client_model/.project
|
||||||
|
vendor/github.com/prometheus/client_model/.settings*
|
||||||
|
gosec_results.json
|
||||||
|
|||||||
79
.travis.yml
79
.travis.yml
@@ -1,25 +1,80 @@
|
|||||||
|
# © 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.
|
||||||
|
|
||||||
|
dist: xenial
|
||||||
|
|
||||||
sudo: required
|
sudo: required
|
||||||
language: go
|
language: go
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.9
|
- "1.10"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
|
go_import_path: "github.com/ibm-messaging/mq-container"
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- downloads
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
include:
|
||||||
|
- stage: build and test
|
||||||
|
env:
|
||||||
|
- BASE_IMAGE=ubuntu:16.04
|
||||||
|
- DOCKER_DOWNGRADE="echo nothing to be done"
|
||||||
|
- env:
|
||||||
|
- BASE_IMAGE=centos:7
|
||||||
|
- DOCKER_DOWNGRADE="echo nothing to be done"
|
||||||
|
- if: type IN (pull_request) OR tag IS present
|
||||||
|
env:
|
||||||
|
- BASE_IMAGE=ubuntu:16.04
|
||||||
|
- DOCKER_DOWNGRADE="docker save -o images.tar mqadvanced-server-dev mq-dev-jms-test &&
|
||||||
|
sudo apt-get autoremove -y docker-ce &&
|
||||||
|
curl -fsSL \"https://apt.dockerproject.org/gpg\" | sudo apt-key add - &&
|
||||||
|
sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" &&
|
||||||
|
sudo apt-get update &&
|
||||||
|
sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs) &&
|
||||||
|
docker load -q -i images.tar &&
|
||||||
|
export DOCKER_API_VERSION=\"1.24\""
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
- ./install-build-deps-ubuntu.sh
|
||||||
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
|
||||||
- sudo apt-get update
|
|
||||||
- sudo apt-get -y install docker-ce
|
|
||||||
- curl https://glide.sh/get | sh
|
|
||||||
- sudo curl -Lo /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64
|
|
||||||
- sudo chmod +x /usr/local/bin/dep
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- echo nothing
|
- echo nothing
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- echo 'Downloading Go dependencies...' && echo -en 'travis_fold:start:deps\\r'
|
||||||
|
- make deps
|
||||||
|
- echo -en 'travis_fold:end:deps\\r'
|
||||||
|
- echo 'Building Developer image...' && echo -en 'travis_fold:start:build-devserver\\r'
|
||||||
|
# Use the containerized build explicitly
|
||||||
|
- make build-devserver-ctr
|
||||||
|
- echo -en 'travis_fold:end:build-devserver\\r'
|
||||||
|
- echo 'Building Developer JMS test image...' && echo -en 'travis_fold:start:build-devjmstest\\r'
|
||||||
|
- make build-devjmstest
|
||||||
|
- echo -en 'travis_fold:end:build-devjmstest\\r'
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make deps
|
- echo 'Downgrading Docker (if necessary)...' && echo -en 'travis_fold:start:docker-downgrade\\r'
|
||||||
- make build-devserver
|
- eval "$DOCKER_DOWNGRADE"
|
||||||
- make test-devserver
|
- echo -en 'travis_fold:end:docker-downgrade\\r'
|
||||||
|
- echo 'Testing Developer image...' && echo -en 'travis_fold:start:test-devserver\\r'
|
||||||
|
- make test-devserver
|
||||||
|
- echo -en 'travis_fold:end:test-devserver\\r'
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- make lint
|
||||||
|
|||||||
72
CHANGELOG.md
72
CHANGELOG.md
@@ -1,14 +1,83 @@
|
|||||||
# Change log
|
# Change log
|
||||||
|
|
||||||
## master
|
## 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)
|
||||||
|
|
||||||
|
**Breaking changes**:
|
||||||
|
* UID of the mqm user is now 888. You need to run the container with an entrypoint of `runmqserver -i` under the root user to update any existing files.
|
||||||
|
* MQSC files supplied will be verified before being run. Files containing invalid MQSC will cause the container to fail to start
|
||||||
|
|
||||||
|
**Other changes**:
|
||||||
|
* Security fixes
|
||||||
|
* Web console added to production image
|
||||||
|
* Container built on RedHat host
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
* 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
|
||||||
|
* Fixes for the following issues:
|
||||||
|
* Brackets no longer appear in termination log
|
||||||
|
* Test timeouts weren't being used correctly
|
||||||
|
* Building on subscribed and unsubscribed hosts ([#273](https://github.com/ibm-messaging/mq-container/pull/273))
|
||||||
|
* Gosec failures ([#286](https://github.com/ibm-messaging/mq-container/pull/286))
|
||||||
|
* Security fix for perl-base ([#253](https://github.com/ibm-messaging/mq-container/pull/253))
|
||||||
|
|
||||||
|
## 9.1.1.0 (2018-11-30)
|
||||||
|
|
||||||
|
* Updated to MQ version 9.1.1.0
|
||||||
|
* Created seperate RedHat Makefile for building images on RedHat machines with buildah
|
||||||
|
* Enabled REST messaging capability for app user.
|
||||||
|
* Added support for container supplementary groups
|
||||||
|
* Removed IBM MQ version 9.0.5 details.
|
||||||
|
* Added additional Diagnostics ([#203](https://github.com/ibm-messaging/mq-container/pull/203))
|
||||||
|
* Implementted GOSec to perform code scans for security vulnerabilities. (([#227](https://github.com/ibm-messaging/mq-container/pull/227)))
|
||||||
|
* Removed Queue manager create option from the MQ Console.
|
||||||
|
* Fixes for the following issues:
|
||||||
|
* Check explicitly for `/mnt/mqm` ([#175](https://github.com/ibm-messaging/mq-container/pull/175))
|
||||||
|
* Force string output in chkmqhealthy ([#174](https://github.com/ibm-messaging/mq-container/pull/174))
|
||||||
|
* Use -aG not -G when adding a group for a user
|
||||||
|
* Security fixes for libsystemd0 systemd systemd-sysv & libudev1
|
||||||
|
|
||||||
|
## 9.1.0.0 (2018-07-23)
|
||||||
|
|
||||||
|
* Updated to MQ version 9.1.0.0
|
||||||
|
* Added Docker 1.12 tests
|
||||||
|
* Added MQ SDK Docker image sample
|
||||||
|
* Added MQ Golang SDK Docker image sample
|
||||||
|
* Added Prometheus metric gathering implementation
|
||||||
|
* Added MQ Internet Pass-Thru (MS81) Docker image sample
|
||||||
|
* Added POWER & z/Linux image builds
|
||||||
|
* `devjmstest` image now built with Maven instead of gradle
|
||||||
|
* Added FAT manifests for Docker Hub/Docker Store
|
||||||
|
* Added Red Hat Enterprise Linux image build
|
||||||
|
* Added basic versioning debug information into golang programs
|
||||||
|
* Removed 9.0.4
|
||||||
|
|
||||||
|
## 9.0.5.0 (2018-03-13)
|
||||||
|
|
||||||
|
* Updated to MQ version 9.0.5.0
|
||||||
* Container's stdout can now be set to JSON format (set LOG_FORMAT=json)
|
* Container's stdout can now be set to JSON format (set LOG_FORMAT=json)
|
||||||
* MQ error logs (in JSON or plain text) are now mirrored on stdout for the container.
|
* MQ error logs (in JSON or plain text) are now mirrored on stdout for the container.
|
||||||
* `chkmqready` now waits until MQSC scripts in `/etc/mqm` have been applied
|
* `chkmqready` now waits until MQSC scripts in `/etc/mqm` have been applied
|
||||||
* `chkmqready` and `chkmqhealthy` now run as the "mqm" user
|
* `chkmqready` and `chkmqhealthy` now run as the "mqm" user
|
||||||
* Added ability to optionally use an alternative base image
|
* Added ability to optionally use an alternative base image
|
||||||
* Various build and test improvements
|
* Various build and test improvements
|
||||||
|
* Removed 9.0.3
|
||||||
|
|
||||||
## 9.0.4 (2017-11-06)
|
## 9.0.4 (2017-11-06)
|
||||||
|
|
||||||
* Updated to MQ version 9.0.4.0
|
* Updated to MQ version 9.0.4.0
|
||||||
* Updated to Go version 9
|
* Updated to Go version 9
|
||||||
* Removed packages `curl`, `ca-certificates`, and their dependencies, which were only used at build time
|
* Removed packages `curl`, `ca-certificates`, and their dependencies, which were only used at build time
|
||||||
@@ -18,4 +87,5 @@
|
|||||||
* Updated to use multi-stage Docker build, so that Go code is built inside a container
|
* Updated to use multi-stage Docker build, so that Go code is built inside a container
|
||||||
|
|
||||||
## 9.0.3 (2017-10-17)
|
## 9.0.3 (2017-10-17)
|
||||||
|
|
||||||
* Initial version
|
* Initial version
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# © Copyright IBM Corporation 2015, 2018
|
# © Copyright IBM Corporation 2015, 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,59 +12,141 @@
|
|||||||
# 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=ubuntu:16.04
|
ARG BASE_IMAGE=registry.access.redhat.com/ubi7/ubi-minimal
|
||||||
|
ARG BASE_TAG=7.6-237
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Build stage to build Go code
|
# Build stage to build Go code
|
||||||
###############################################################################
|
###############################################################################
|
||||||
FROM golang:1.9 as builder
|
FROM registry.access.redhat.com/devtools/go-toolset-7-rhel7 as builder
|
||||||
WORKDIR /go/src/github.com/ibm-messaging/mq-container/
|
# FROM docker.io/centos/go-toolset-7-centos7 as builder
|
||||||
|
# The URL to download the MQ installer from in tar.gz format
|
||||||
|
# This assumes an archive containing the MQ RPM install packages
|
||||||
|
ARG MQ_URL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev912_linux_x86-64.tar.gz"
|
||||||
|
ARG IMAGE_REVISION="Not specified"
|
||||||
|
ARG IMAGE_SOURCE="Not specified"
|
||||||
|
ARG IMAGE_TAG="Not specified"
|
||||||
|
ARG MQM_UID=888
|
||||||
|
USER 0
|
||||||
|
COPY install-mq.sh /usr/local/bin/
|
||||||
|
RUN chmod a+x /usr/local/bin/install-mq.sh \
|
||||||
|
&& sleep 1 \
|
||||||
|
&& MQ_PACKAGES="MQSeriesRuntime-*.rpm MQSeriesSDK-*.rpm MQSeriesSamples*.rpm" install-mq.sh $MQM_UID
|
||||||
|
WORKDIR /opt/app-root/src/go/src/github.com/ibm-messaging/mq-container/
|
||||||
COPY cmd/ ./cmd
|
COPY cmd/ ./cmd
|
||||||
COPY internal/ ./internal
|
COPY internal/ ./internal
|
||||||
COPY vendor/ ./vendor
|
COPY vendor/ ./vendor
|
||||||
RUN go build ./cmd/runmqserver/
|
ENV PATH="${PATH}:/opt/rh/go-toolset-7/root/usr/bin" \
|
||||||
|
CGO_CFLAGS="-I/opt/mqm/inc/" \
|
||||||
|
CGO_LDFLAGS_ALLOW="-Wl,-rpath.*"
|
||||||
|
RUN go build -ldflags "-X \"main.ImageCreated=$(date --iso-8601=seconds)\" -X \"main.ImageRevision=$IMAGE_REVISION\" -X \"main.ImageSource=$IMAGE_SOURCE\" -X \"main.ImageTag=$IMAGE_TAG\"" ./cmd/runmqserver/
|
||||||
RUN go build ./cmd/chkmqready/
|
RUN go build ./cmd/chkmqready/
|
||||||
RUN go build ./cmd/chkmqhealthy/
|
RUN go build ./cmd/chkmqhealthy/
|
||||||
# Run all unit tests
|
RUN go build ./cmd/runmqdevserver/
|
||||||
|
RUN go test -v ./cmd/runmqdevserver/...
|
||||||
RUN go test -v ./cmd/runmqserver/
|
RUN go test -v ./cmd/runmqserver/
|
||||||
RUN go test -v ./cmd/chkmqready/
|
RUN go test -v ./cmd/chkmqready/
|
||||||
RUN go test -v ./cmd/chkmqhealthy/
|
RUN go test -v ./cmd/chkmqhealthy/
|
||||||
RUN go test -v ./internal/...
|
RUN go test -v ./internal/...
|
||||||
|
RUN go vet ./cmd/... ./internal/...
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Main build stage, to build MQ image
|
# Main build stage, to build MQ image
|
||||||
###############################################################################
|
###############################################################################
|
||||||
FROM $BASE_IMAGE
|
FROM $BASE_IMAGE:$BASE_TAG AS mq-server
|
||||||
|
|
||||||
# The URL to download the MQ installer from in tar.gz format
|
|
||||||
# This assumes an archive containing the MQ Debian (.deb) install packages
|
|
||||||
ARG MQ_URL
|
|
||||||
|
|
||||||
# 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_PACKAGES
|
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="ibmmq-server ibmmq-java ibmmq-jre ibmmq-gskit ibmmq-msg-.* ibmmq-samples ibmmq-web ibmmq-ams"
|
||||||
|
ARG MQM_UID=888
|
||||||
|
ARG BASE_IMAGE
|
||||||
|
ARG BASE_TAG
|
||||||
|
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 vendor="IBM"
|
||||||
|
LABEL distribution-scope="private"
|
||||||
|
LABEL authoritative-source-url="https://www.ibm.com/software/passportadvantage/"
|
||||||
|
LABEL url="https://www.ibm.com/products/mq/advanced"
|
||||||
|
LABEL io.openshift.tags="mq messaging"
|
||||||
|
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 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/
|
||||||
# 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.
|
||||||
RUN chmod u+x /usr/local/bin/install-mq.sh \
|
RUN env && chmod u+x /usr/local/bin/install-*.sh \
|
||||||
&& sleep 1 \
|
&& sleep 1 \
|
||||||
&& install-mq.sh
|
&& install-mq-server-prereqs.sh $MQM_UID \
|
||||||
|
&& install-mq.sh $MQM_UID
|
||||||
# Create a directory for runtime data from runmqserver
|
# Create a directory for runtime data from runmqserver
|
||||||
RUN mkdir -p /run/runmqserver \
|
RUN mkdir -p /run/runmqserver \
|
||||||
&& chown mqm:mqm /run/runmqserver
|
&& chown mqm:mqm /run/runmqserver
|
||||||
|
COPY --from=builder /opt/app-root/src/go/src/github.com/ibm-messaging/mq-container/runmqserver /usr/local/bin/
|
||||||
COPY --from=builder /go/src/github.com/ibm-messaging/mq-container/runmqserver /usr/local/bin/
|
COPY --from=builder /opt/app-root/src/go/src/github.com/ibm-messaging/mq-container/chkmq* /usr/local/bin/
|
||||||
COPY --from=builder /go/src/github.com/ibm-messaging/mq-container/chkmq* /usr/local/bin/
|
|
||||||
COPY NOTICES.txt /opt/mqm/licenses/notices-container.txt
|
COPY NOTICES.txt /opt/mqm/licenses/notices-container.txt
|
||||||
|
# Copy web XML files
|
||||||
|
COPY web /etc/mqm/web
|
||||||
|
COPY etc/mqm/*.tpl /etc/mqm/
|
||||||
RUN chmod ug+x /usr/local/bin/runmqserver \
|
RUN chmod ug+x /usr/local/bin/runmqserver \
|
||||||
&& chown mqm:mqm /usr/local/bin/*mq* \
|
&& chown mqm:mqm /usr/local/bin/*mq* \
|
||||||
&& chmod ug+xs /usr/local/bin/chkmq*
|
&& chmod ug+xs /usr/local/bin/chkmq* \
|
||||||
|
&& chown -R mqm:mqm /etc/mqm/* \
|
||||||
# Always use port 1414
|
&& install --directory --mode 0775 --owner mqm --group root /run/runmqserver \
|
||||||
EXPOSE 1414
|
&& touch /run/termination-log \
|
||||||
|
&& chown mqm:root /run/termination-log \
|
||||||
|
&& chmod 0660 /run/termination-log
|
||||||
|
# Always use port 1414 for MQ & 9157 for the metrics
|
||||||
|
EXPOSE 1414 9157 9443
|
||||||
ENV LANG=en_US.UTF-8 AMQ_DIAGNOSTIC_MSG_SEVERITY=1 AMQ_ADDITIONAL_JSON_LOG=1 LOG_FORMAT=basic
|
ENV LANG=en_US.UTF-8 AMQ_DIAGNOSTIC_MSG_SEVERITY=1 AMQ_ADDITIONAL_JSON_LOG=1 LOG_FORMAT=basic
|
||||||
|
USER $MQM_UID
|
||||||
ENTRYPOINT ["runmqserver"]
|
ENTRYPOINT ["runmqserver"]
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Add default developer config
|
||||||
|
###############################################################################
|
||||||
|
FROM mq-server AS mq-dev-server
|
||||||
|
ARG MQM_UID=888
|
||||||
|
ARG BASE_IMAGE
|
||||||
|
ARG BASE_TAG
|
||||||
|
# Enable MQ developer default configuration
|
||||||
|
ENV MQ_DEV=true
|
||||||
|
# Default administrator password
|
||||||
|
ENV MQ_ADMIN_PASSWORD=passw0rd
|
||||||
|
LABEL summary="IBM MQ Advanced for Developers 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 vendor="IBM"
|
||||||
|
LABEL distribution-scope="private"
|
||||||
|
LABEL authoritative-source-url="https://www.ibm.com/software/passportadvantage/"
|
||||||
|
LABEL url="https://www.ibm.com/products/mq/advanced"
|
||||||
|
LABEL io.openshift.tags="mq messaging"
|
||||||
|
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 base-image=$BASE_IMAGE
|
||||||
|
LABEL base-image-release=$BASE_TAG
|
||||||
|
USER 0
|
||||||
|
COPY incubating/mqadvanced-server-dev/install-extra-packages.sh /usr/local/bin/
|
||||||
|
RUN chmod u+x /usr/local/bin/install-extra-packages.sh \
|
||||||
|
&& sleep 1 \
|
||||||
|
&& install-extra-packages.sh
|
||||||
|
# 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.
|
||||||
|
RUN echo "mqm ALL = NOPASSWD: /usr/sbin/chpasswd" > /etc/sudoers.d/mq-dev-config
|
||||||
|
## Add admin and app users, and set a default password for admin
|
||||||
|
RUN useradd admin -G mqm \
|
||||||
|
&& groupadd mqclient \
|
||||||
|
&& useradd app -G mqclient \
|
||||||
|
&& echo admin:$MQ_ADMIN_PASSWORD | chpasswd
|
||||||
|
# Create a directory for runtime data from runmqserver
|
||||||
|
RUN mkdir -p /run/runmqdevserver \
|
||||||
|
&& chown mqm:mqm /run/runmqdevserver
|
||||||
|
COPY --from=builder /opt/app-root/src/go/src/github.com/ibm-messaging/mq-container/runmqdevserver /usr/local/bin/
|
||||||
|
# Copy template files
|
||||||
|
COPY incubating/mqadvanced-server-dev/*.tpl /etc/mqm/
|
||||||
|
# Copy web XML files for default developer configuration
|
||||||
|
COPY incubating/mqadvanced-server-dev/web /etc/mqm/web
|
||||||
|
RUN chown -R mqm:mqm /etc/mqm/* \
|
||||||
|
&& chmod +x /usr/local/bin/runmq* \
|
||||||
|
&& install --directory --mode 0775 --owner mqm --group root /run/runmqdevserver
|
||||||
|
ENV MQ_ENABLE_EMBEDDED_WEB_SERVER=1
|
||||||
|
USER $MQM_UID
|
||||||
|
ENTRYPOINT ["runmqdevserver"]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# © Copyright IBM Corporation 2017
|
# © Copyright IBM Corporation 2017, 2018
|
||||||
#
|
#
|
||||||
# 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.
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
ARG BASE_IMAGE
|
ARG BASE_IMAGE
|
||||||
|
|
||||||
# Build stage to build Go code
|
# Build stage to build Go code
|
||||||
FROM golang:1.9 as builder
|
FROM golang:1.10 as builder
|
||||||
WORKDIR /go/src/github.com/ibm-messaging/mq-container/
|
WORKDIR /go/src/github.com/ibm-messaging/mq-container/
|
||||||
COPY cmd/ ./cmd
|
COPY cmd/ ./cmd
|
||||||
COPY internal/ ./internal
|
COPY internal/ ./internal
|
||||||
|
|||||||
13
LICENSE
13
LICENSE
@@ -176,18 +176,7 @@
|
|||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
© Copyright IBM Corporation. 2015, 2019
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
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.
|
||||||
|
|||||||
329
Makefile
329
Makefile
@@ -1,4 +1,4 @@
|
|||||||
# © Copyright IBM Corporation 2017, 2018
|
# © Copyright IBM Corporation 2017, 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,68 +16,99 @@
|
|||||||
# Conditional variables - you can override the values of these variables from
|
# Conditional variables - you can override the values of these variables from
|
||||||
# the command line
|
# the command line
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# BASE_IMAGE is the base image to use for MQ, for example "ubuntu" or "rhel"
|
|
||||||
BASE_IMAGE ?= ubuntu:16.04
|
|
||||||
# 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.0.4.0
|
MQ_VERSION ?= 9.1.3.0
|
||||||
|
# RELEASE shows what release of the container code has been built
|
||||||
|
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.
|
||||||
MQ_ARCHIVE ?= IBM_MQ_$(MQ_VERSION)_$(MQ_ARCHIVE_TYPE)_$(MQ_ARCHIVE_ARCH).tar.gz
|
MQ_ARCHIVE ?= IBM_MQ_$(MQ_VERSION_VRM)_$(MQ_ARCHIVE_TYPE)_$(MQ_ARCHIVE_ARCH).tar.gz
|
||||||
# MQ_ARCHIVE_DEV is the name of the file, under the downloads directory, from which MQ Advanced
|
# MQ_ARCHIVE_DEV is the name of the file, under the downloads directory, from which MQ Advanced
|
||||||
# for Developers can be installed
|
# for Developers can be installed
|
||||||
MQ_ARCHIVE_DEV ?= $(MQ_ARCHIVE_DEV_$(MQ_VERSION))
|
MQ_ARCHIVE_DEV ?= $(MQ_ARCHIVE_DEV_$(MQ_VERSION))
|
||||||
|
# MQ_SDK_ARCHIVE specifies the archive to use for building the golang programs. Defaults vary on developer or advanced.
|
||||||
|
MQ_SDK_ARCHIVE ?= $(MQ_ARCHIVE_DEV_$(MQ_VERSION))
|
||||||
# Options to `go test` for the Docker tests
|
# Options to `go test` for the Docker tests
|
||||||
TEST_OPTS_DOCKER ?=
|
TEST_OPTS_DOCKER ?=
|
||||||
# Options to `go test` for the Kubernetes tests
|
# MQ_IMAGE_ADVANCEDSERVER is the name of the built MQ Advanced image
|
||||||
TEST_OPTS_KUBERNETES ?=
|
MQ_IMAGE_ADVANCEDSERVER ?=mqadvanced-server
|
||||||
# MQ_IMAGE_ADVANCEDSERVER is the name and tag of the built MQ Advanced image
|
# MQ_IMAGE_DEVSERVER is the name of the built MQ Advanced for Developers image
|
||||||
MQ_IMAGE_ADVANCEDSERVER ?=mqadvanced-server:$(MQ_VERSION)-$(ARCH)-$(BASE_IMAGE_TAG)
|
MQ_IMAGE_DEVSERVER ?=mqadvanced-server-dev
|
||||||
# MQ_IMAGE_DEVSERVER is the name and tag of the built MQ Advanced for Developers image
|
# MQ_TAG is the tag of the built MQ Advanced image & MQ Advanced for Developers image
|
||||||
MQ_IMAGE_DEVSERVER ?=mqadvanced-server-dev:$(MQ_VERSION)-$(ARCH)-$(BASE_IMAGE_TAG)
|
MQ_TAG ?=$(MQ_VERSION)-$(ARCH)
|
||||||
# DOCKER is the Docker command to run
|
# DOCKER is the Docker command to run. Defaults to "podman" if it's available, otherwise "docker"
|
||||||
DOCKER ?= 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 ?=
|
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 ?= 888
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Other variables
|
# Other variables
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# ARCH is the platform architecture (e.g. x86_64, ppc64le or s390x)
|
GO_PKG_DIRS = ./cmd ./internal ./test
|
||||||
ARCH = $(shell uname -m)
|
MQ_ARCHIVE_TYPE=LINUX
|
||||||
|
MQ_ARCHIVE_DEV_PLATFORM=linux
|
||||||
|
# ARCH is the platform architecture (e.g. amd64, ppc64le or s390x)
|
||||||
|
ARCH=$(if $(findstring x86_64,$(shell uname -m)),amd64,$(shell uname -m))
|
||||||
# BUILD_SERVER_CONTAINER is the name of the web server container used at build time
|
# BUILD_SERVER_CONTAINER is the name of the web server container used at build time
|
||||||
BUILD_SERVER_CONTAINER=build-server
|
BUILD_SERVER_CONTAINER=build-server
|
||||||
# NUM_CPU is the number of CPUs available to Docker. Used to control how many
|
# NUM_CPU is the number of CPUs available to Docker. Used to control how many
|
||||||
# test run in parallel
|
# test run in parallel
|
||||||
NUM_CPU=$(shell docker info --format "{{ .NCPU }}")
|
NUM_CPU = $(or $(shell docker info --format "{{ .NCPU }}"),2)
|
||||||
# BASE_IMAGE_TAG is a normalized version of BASE_IMAGE, suitable for use in a Docker tag
|
# BASE_IMAGE_TAG is a normalized version of BASE_IMAGE, suitable for use in a Docker tag
|
||||||
BASE_IMAGE_TAG=$(subst /,-,$(subst :,-,$(BASE_IMAGE)))
|
BASE_IMAGE_TAG=$(lastword $(subst /, ,$(subst :,-,$(BASE_IMAGE))))
|
||||||
MQ_IMAGE_DEVSERVER_BASE=mqadvanced-server-dev-base:$(MQ_VERSION)-$(ARCH)-$(BASE_IMAGE_TAG)
|
#BASE_IMAGE_TAG=$(subst /,-,$(subst :,-,$(BASE_IMAGE)))
|
||||||
|
MQ_IMAGE_DEVSERVER_BASE=mqadvanced-server-dev-base
|
||||||
|
# Docker image name to use for JMS tests
|
||||||
|
DEV_JMS_IMAGE=mq-dev-jms-test
|
||||||
|
# Variables for versioning
|
||||||
|
IMAGE_REVISION=$(shell git rev-parse HEAD)
|
||||||
|
IMAGE_SOURCE=$(shell git config --get remote.origin.url)
|
||||||
|
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.3 instead of 9.1.3.0
|
||||||
|
MQ_VERSION_VRM=$(subst $(SPACE),.,$(wordlist 1,3,$(subst .,$(SPACE),$(MQ_VERSION))))
|
||||||
|
|
||||||
# Try to figure out which archive to use from the BASE_IMAGE
|
# Set variable if running on a Red Hat Enterprise Linux host
|
||||||
ifeq "$(findstring ubuntu,$(BASE_IMAGE))" "ubuntu"
|
ifneq ($(wildcard /etc/redhat-release),)
|
||||||
MQ_ARCHIVE_TYPE=UBUNTU
|
REDHAT_RELEASE = $(shell cat /etc/redhat-release)
|
||||||
else
|
ifeq "$(findstring Red Hat,$(REDHAT_RELEASE))" "Red Hat"
|
||||||
MQ_ARCHIVE_TYPE=LINUX
|
RHEL_HOST = "true"
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(findstring Microsoft,$(shell uname -r)))
|
||||||
|
DOWNLOADS_DIR=$(patsubst /mnt/c%,C:%,$(realpath ./downloads/))
|
||||||
|
else ifneq (,$(findstring Windows,$(shell echo ${OS})))
|
||||||
|
DOWNLOADS_DIR=$(shell pwd)/downloads/
|
||||||
|
else
|
||||||
|
DOWNLOADS_DIR=$(realpath ./downloads/)
|
||||||
|
endif
|
||||||
|
|
||||||
# Try to figure out which archive to use from the architecture
|
# Try to figure out which archive to use from the architecture
|
||||||
ifeq "$(ARCH)" "x86_64"
|
ifeq "$(ARCH)" "amd64"
|
||||||
MQ_ARCHIVE_ARCH=X86-64
|
MQ_ARCHIVE_ARCH=X86-64
|
||||||
|
MQ_DEV_ARCH=x86-64
|
||||||
else ifeq "$(ARCH)" "ppc64le"
|
else ifeq "$(ARCH)" "ppc64le"
|
||||||
MQ_ARCHIVE_ARCH=LE_POWER
|
MQ_ARCHIVE_ARCH=LE_POWER
|
||||||
|
MQ_DEV_ARCH=ppcle
|
||||||
else ifeq "$(ARCH)" "s390x"
|
else ifeq "$(ARCH)" "s390x"
|
||||||
MQ_ARCHIVE_ARCH=SYSTEM_Z
|
MQ_ARCHIVE_ARCH=SYSTEM_Z
|
||||||
|
MQ_DEV_ARCH=s390x
|
||||||
endif
|
endif
|
||||||
# Archive names for IBM MQ Advanced for Developers for Ubuntu
|
# Archive names for IBM MQ Advanced for Developers
|
||||||
MQ_ARCHIVE_DEV_9.0.3.0=mqadv_dev903_ubuntu_x86-64.tar.gz
|
MQ_ARCHIVE_DEV_9.1.0.0=mqadv_dev910_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
|
||||||
MQ_ARCHIVE_DEV_9.0.4.0=mqadv_dev904_ubuntu_x86-64.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.3.0=mqadv_dev913_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Build targets
|
# Build targets
|
||||||
###############################################################################
|
###############################################################################
|
||||||
.PHONY: vars
|
.PHONY: vars
|
||||||
vars:
|
vars:
|
||||||
#ifeq "$(findstring ubuntu,$(BASE_IMAGE))","ubuntu"
|
|
||||||
@echo $(MQ_ARCHIVE_ARCH)
|
@echo $(MQ_ARCHIVE_ARCH)
|
||||||
@echo $(MQ_ARCHIVE_TYPE)
|
@echo $(MQ_ARCHIVE_TYPE)
|
||||||
@echo $(MQ_ARCHIVE)
|
@echo $(MQ_ARCHIVE)
|
||||||
@@ -89,44 +120,33 @@ default: build-devserver test
|
|||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: build-devserver build-advancedserver
|
all: build-devserver build-advancedserver
|
||||||
|
|
||||||
|
.PHONY: test-all
|
||||||
|
test-all: build-devjmstest test-devserver test-advancedserver
|
||||||
|
|
||||||
.PHONY: devserver
|
.PHONY: devserver
|
||||||
devserver: build-devserver test-devserver
|
devserver: build-devserver build-devjmstest test-devserver
|
||||||
|
|
||||||
# Build incubating components
|
# Build incubating components
|
||||||
.PHONY: incubating
|
.PHONY: incubating
|
||||||
incubating: build-explorer
|
incubating: build-explorer
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -rf ./coverage
|
|
||||||
rm -rf ./build
|
|
||||||
rm -rf ./deps
|
|
||||||
|
|
||||||
downloads/$(MQ_ARCHIVE_DEV):
|
downloads/$(MQ_ARCHIVE_DEV):
|
||||||
$(info $(SPACER)$(shell printf $(TITLE)"Downloading IBM MQ Advanced for Developers"$(END)))
|
$(info $(SPACER)$(shell printf $(TITLE)"Downloading IBM MQ Advanced for Developers "$(MQ_VERSION)$(END)))
|
||||||
mkdir -p downloads
|
mkdir -p downloads
|
||||||
cd downloads; curl -LO https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/$(MQ_ARCHIVE_DEV)
|
cd downloads; curl -LO https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/$(MQ_ARCHIVE_DEV)
|
||||||
|
|
||||||
.PHONY: downloads
|
downloads/$(MQ_SDK_ARCHIVE):
|
||||||
downloads: downloads/$(MQ_ARCHIVE_DEV)
|
$(info $(SPACER)$(shell printf $(TITLE)"Downloading IBM MQ Advanced for Developers "$(MQ_VERSION)$(END)))
|
||||||
|
mkdir -p downloads
|
||||||
|
cd downloads; curl -LO https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/$(MQ_SDK_ARCHIVE)
|
||||||
|
|
||||||
.PHONY: deps
|
.PHONY: downloads
|
||||||
deps:
|
downloads: downloads/$(MQ_ARCHIVE_DEV) downloads/$(MQ_SDK_ARCHIVE)
|
||||||
glide install --strip-vendor
|
|
||||||
|
|
||||||
# Vendor Go dependencies for the Docker tests
|
# Vendor Go dependencies for the Docker tests
|
||||||
test/docker/vendor:
|
test/docker/vendor:
|
||||||
cd test/docker && dep ensure -vendor-only
|
cd test/docker && dep ensure -vendor-only
|
||||||
|
|
||||||
# Vendor Go dependencies for the Kubernetes tests
|
|
||||||
test/kubernetes/vendor:
|
|
||||||
cd test/docker && dep ensure -vendor-only
|
|
||||||
|
|
||||||
.PHONY: build-cov
|
|
||||||
build-cov:
|
|
||||||
mkdir -p build
|
|
||||||
cd build; go test -c -covermode=count ../cmd/runmqserver
|
|
||||||
|
|
||||||
# Shortcut to just run the unit tests
|
# Shortcut to just run the unit tests
|
||||||
.PHONY: test-unit
|
.PHONY: test-unit
|
||||||
test-unit:
|
test-unit:
|
||||||
@@ -134,17 +154,28 @@ test-unit:
|
|||||||
|
|
||||||
.PHONY: test-advancedserver
|
.PHONY: test-advancedserver
|
||||||
test-advancedserver: test/docker/vendor
|
test-advancedserver: test/docker/vendor
|
||||||
$(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_ADVANCEDSERVER) on Docker"$(END)))
|
$(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG) on $(shell docker --version)"$(END)))
|
||||||
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_ADVANCEDSERVER) go test -parallel $(NUM_CPU) $(TEST_OPTS_DOCKER)
|
docker inspect $(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG)
|
||||||
|
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG) EXPECTED_LICENSE=Production go test -parallel $(NUM_CPU) $(TEST_OPTS_DOCKER)
|
||||||
|
|
||||||
|
.PHONY: build-devjmstest
|
||||||
|
build-devjmstest:
|
||||||
|
$(info $(SPACER)$(shell printf $(TITLE)"Build JMS tests for developer config"$(END)))
|
||||||
|
cd test/messaging && docker build --tag $(DEV_JMS_IMAGE) .
|
||||||
|
|
||||||
.PHONY: test-devserver
|
.PHONY: test-devserver
|
||||||
test-devserver: test/docker/vendor
|
test-devserver: test/docker/vendor
|
||||||
$(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_DEVSERVER) on Docker"$(END)))
|
$(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_DEVSERVER):$(MQ_TAG) on $(shell docker --version)"$(END)))
|
||||||
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_DEVSERVER) go test -parallel $(NUM_CPU) -tags mqdev $(TEST_OPTS_DOCKER)
|
docker inspect $(MQ_IMAGE_DEVSERVER):$(MQ_TAG)
|
||||||
|
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_DEVSERVER):$(MQ_TAG) EXPECTED_LICENSE=Developer DEV_JMS_IMAGE=$(DEV_JMS_IMAGE) IBMJRE=true go test -parallel $(NUM_CPU) -tags mqdev $(TEST_OPTS_DOCKER)
|
||||||
|
|
||||||
|
.PHONY: coverage
|
||||||
|
coverage:
|
||||||
|
mkdir coverage
|
||||||
|
|
||||||
.PHONY: test-advancedserver-cover
|
.PHONY: test-advancedserver-cover
|
||||||
test-advancedserver-cover: test/docker/vendor
|
test-advancedserver-cover: test/docker/vendor coverage
|
||||||
$(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_ADVANCEDSERVER) on Docker with code coverage"$(END)))
|
$(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG) with code coverage on $(shell docker --version)"$(END)))
|
||||||
rm -f ./coverage/unit*.cov
|
rm -f ./coverage/unit*.cov
|
||||||
# Run unit tests with coverage, for each package under 'internal'
|
# Run unit tests with coverage, for each package under 'internal'
|
||||||
go list -f '{{.Name}}' ./internal/... | xargs -I {} go test -cover -covermode count -coverprofile ./coverage/unit-{}.cov ./internal/{}
|
go list -f '{{.Name}}' ./internal/... | xargs -I {} go test -cover -covermode count -coverprofile ./coverage/unit-{}.cov ./internal/{}
|
||||||
@@ -156,7 +187,7 @@ test-advancedserver-cover: test/docker/vendor
|
|||||||
rm -f ./test/docker/coverage/*.cov
|
rm -f ./test/docker/coverage/*.cov
|
||||||
rm -f ./coverage/docker.*
|
rm -f ./coverage/docker.*
|
||||||
mkdir -p ./test/docker/coverage/
|
mkdir -p ./test/docker/coverage/
|
||||||
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_ADVANCEDSERVER)-cover TEST_COVER=true go test $(TEST_OPTS_DOCKER)
|
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_ADVANCEDSERVER):$(MQ_TAG)-cover TEST_COVER=true go test $(TEST_OPTS_DOCKER)
|
||||||
echo 'mode: count' > ./coverage/docker.cov
|
echo 'mode: count' > ./coverage/docker.cov
|
||||||
tail -q -n +2 ./test/docker/coverage/*.cov >> ./coverage/docker.cov
|
tail -q -n +2 ./test/docker/coverage/*.cov >> ./coverage/docker.cov
|
||||||
go tool cover -html=./coverage/docker.cov -o ./coverage/docker.html
|
go tool cover -html=./coverage/docker.cov -o ./coverage/docker.html
|
||||||
@@ -165,20 +196,7 @@ test-advancedserver-cover: test/docker/vendor
|
|||||||
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
|
||||||
|
|
||||||
.PHONY: test-kubernetes-devserver
|
define build-mq
|
||||||
test-kubernetes-devserver: test/kubernetes/vendor
|
|
||||||
$(call test-kubernetes,$(MQ_IMAGE_DEVSERVER),"../../charts/ibm-mqadvanced-server-dev")
|
|
||||||
|
|
||||||
.PHONY: test-kubernetes-advancedserver
|
|
||||||
test-kubernetes-advancedserver: test/kubernetes/vendor
|
|
||||||
$(call test-kubernetes,$(MQ_IMAGE_ADVANCEDSERVER),"../../charts/ibm-mqadvanced-server-prod")
|
|
||||||
|
|
||||||
define test-kubernetes
|
|
||||||
$(info $(SPACER)$(shell printf $(TITLE)"Test $1 on Kubernetes"$(END)))
|
|
||||||
cd test/kubernetes && TEST_IMAGE=$1 TEST_CHART=$2 go test $(TEST_OPTS_KUBERNETES)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define docker-build-mq
|
|
||||||
# Create a temporary network to use for the build
|
# Create a temporary network to use for the build
|
||||||
$(DOCKER) network create build
|
$(DOCKER) network create build
|
||||||
# Start a web server to host the MQ downloadable (tar.gz) file
|
# Start a web server to host the MQ downloadable (tar.gz) file
|
||||||
@@ -187,24 +205,54 @@ define docker-build-mq
|
|||||||
--name $(BUILD_SERVER_CONTAINER) \
|
--name $(BUILD_SERVER_CONTAINER) \
|
||||||
--network build \
|
--network build \
|
||||||
--network-alias build \
|
--network-alias build \
|
||||||
--volume "$(realpath ./downloads/)":/usr/share/nginx/html:ro \
|
--volume $(DOWNLOADS_DIR):/usr/share/nginx/html:ro \
|
||||||
--detach \
|
--detach \
|
||||||
nginx:alpine
|
docker.io/nginx:alpine
|
||||||
# Build the new image (use --pull to make sure we have the latest base image)
|
# Build the new image
|
||||||
$(DOCKER) build \
|
$(DOCKER) build \
|
||||||
--pull \
|
--tag $1:$2 \
|
||||||
--tag $1 \
|
--file $3 \
|
||||||
--file $2 \
|
|
||||||
--network build \
|
--network build \
|
||||||
--build-arg MQ_URL=http://build:80/$3 \
|
--build-arg MQ_URL=http://build:80/$4 \
|
||||||
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
|
|
||||||
--label IBM_PRODUCT_ID=$4 \
|
|
||||||
--label IBM_PRODUCT_NAME=$5 \
|
|
||||||
--label IBM_PRODUCT_VERSION=$6 \
|
|
||||||
--build-arg MQ_PACKAGES="$(MQ_PACKAGES)" \
|
--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 $5 \
|
||||||
. ; $(DOCKER) kill $(BUILD_SERVER_CONTAINER) && $(DOCKER) network rm build
|
. ; $(DOCKER) kill $(BUILD_SERVER_CONTAINER) && $(DOCKER) network rm build
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
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
|
.PHONY: docker-version
|
||||||
@@ -213,25 +261,116 @@ docker-version:
|
|||||||
@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)
|
||||||
|
|
||||||
.PHONY: build-advancedserver
|
.PHONY: build-advancedserver
|
||||||
build-advancedserver: downloads/$(MQ_ARCHIVE) docker-version
|
ifdef RHEL_HOST
|
||||||
$(info $(SPACER)$(shell printf $(TITLE)"Build $(MQ_IMAGE_ADVANCEDSERVER)"$(END)))
|
# Build using Buildah inside a container on RHEL hosts
|
||||||
$(call docker-build-mq,$(MQ_IMAGE_ADVANCEDSERVER),Dockerfile-server,$(MQ_ARCHIVE),"4486e8c4cc9146fd9b3ce1f14a2dfc5b","IBM MQ Advanced",$(MQ_VERSION))
|
build-advancedserver: build-advancedserver-ctr
|
||||||
|
else
|
||||||
|
build-advancedserver: build-advancedserver-host
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: build-advancedserver-host
|
||||||
|
build-advancedserver-host: downloads/$(MQ_ARCHIVE) docker-version
|
||||||
|
$(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)
|
||||||
|
|
||||||
|
.PHONY: build-advancedserver-ctr
|
||||||
|
build-advancedserver-ctr: downloads/$(MQ_ARCHIVE)
|
||||||
|
$(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
|
||||||
# Target-specific variable to add web server into devserver image
|
ifdef RHEL_HOST
|
||||||
build-devserver: MQ_PACKAGES=ibmmq-server ibmmq-java ibmmq-jre ibmmq-gskit ibmmq-msg-.* ibmmq-samples ibmmq-ams ibmmq-web
|
# Build using Buildah inside a container on RHEL hosts
|
||||||
build-devserver: downloads/$(MQ_ARCHIVE_DEV) docker-version
|
build-devserver: build-devserver-ctr
|
||||||
@test "$(shell uname -m)" = "x86_64" || (echo "Error: MQ Advanced for Developers is only available for x86_64 architecture" && exit 1)
|
else
|
||||||
$(info $(shell printf $(TITLE)"Build $(MQ_IMAGE_DEVSERVER_BASE)"$(END)))
|
build-devserver: build-devserver-host
|
||||||
$(call docker-build-mq,$(MQ_IMAGE_DEVSERVER_BASE),Dockerfile-server,$(MQ_ARCHIVE_DEV),"98102d16795c4263ad9ca075190a2d4d","IBM MQ Advanced for Developers (Non-Warranted)",$(MQ_VERSION))
|
endif
|
||||||
docker build --tag $(MQ_IMAGE_DEVSERVER) --file incubating/mqadvanced-server-dev/Dockerfile .
|
|
||||||
|
.PHONY: build-devserver-host
|
||||||
|
build-devserver-host: downloads/$(MQ_ARCHIVE_DEV) docker-version
|
||||||
|
$(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)
|
||||||
|
|
||||||
|
.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: docker-version
|
||||||
$(DOCKER) build --build-arg BASE_IMAGE=$(MQ_IMAGE_ADVANCEDSERVER) -t $(MQ_IMAGE_ADVANCEDSERVER)-cover -f Dockerfile-server.cover .
|
$(DOCKER) 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)
|
||||||
$(call docker-build-mq,mq-explorer:latest-$(ARCH),incubating/mq-explorer/Dockerfile-mq-explorer,$(MQ_ARCHIVE_DEV),"98102d16795c4263ad9ca075190a2d4d","IBM MQ Advanced for Developers (Non-Warranted)",$(MQ_VERSION))
|
$(call build-mq,mq-explorer,latest-$(ARCH),incubating/mq-explorer/Dockerfile,$(MQ_ARCHIVE_DEV),mq-explorer)
|
||||||
|
|
||||||
|
.PHONY: build-sdk
|
||||||
|
build-sdk: downloads/$(MQ_ARCHIVE_DEV)
|
||||||
|
$(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)
|
||||||
|
|
||||||
|
.PHONY: debug-vars
|
||||||
|
debug-vars:
|
||||||
|
@echo MQ_VERSION=$(MQ_VERSION)
|
||||||
|
@echo MQ_VERSION_VRM=$(MQ_VERSION_VRM)
|
||||||
|
@echo MQ_ARCHIVE=$(MQ_ARCHIVE)
|
||||||
|
@echo MQ_IMAGE_DEVSERVER=$(MQ_IMAGE_DEVSERVER)
|
||||||
|
@echo MQ_IMAGE_ADVANCEDSERVER=$(MQ_IMAGE_ADVANCEDSERVER)
|
||||||
|
|
||||||
|
include formatting.mk
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf ./coverage
|
||||||
|
rm -rf ./build
|
||||||
|
rm -rf ./deps
|
||||||
|
|
||||||
|
.PHONY: deps
|
||||||
|
deps:
|
||||||
|
glide install --strip-vendor
|
||||||
|
|
||||||
|
.PHONY: build-cov
|
||||||
|
build-cov:
|
||||||
|
mkdir -p build
|
||||||
|
cd build; go test -c -covermode=count ../cmd/runmqserver
|
||||||
|
|
||||||
|
.PHONY: precommit
|
||||||
|
precommit: fmt lint
|
||||||
|
|
||||||
|
.PHONY: fmt
|
||||||
|
fmt: $(addsuffix /$(wildcard *.go), $(GO_PKG_DIRS))
|
||||||
|
go fmt $(addsuffix /..., $(GO_PKG_DIRS))
|
||||||
|
|
||||||
|
.PHONY: lint
|
||||||
|
lint: $(addsuffix /$(wildcard *.go), $(GO_PKG_DIRS))
|
||||||
|
@# This expression is necessary because /... includes the vendor directory in golint
|
||||||
|
@# As of 11/04/2018 there is an open issue to fix it: https://github.com/golang/lint/issues/320
|
||||||
|
golint -set_exit_status $(sort $(dir $(wildcard $(addsuffix /*/*.go, $(GO_PKG_DIRS)))))
|
||||||
|
|
||||||
|
.PHONY: gosec
|
||||||
|
gosec: $(info $(SPACER)$(shell printf "Running gosec test"$(END)))
|
||||||
|
@gosec -fmt=json -out=gosec_results.json cmd/... internal/... 2> /dev/null ;\
|
||||||
|
cat "gosec_results.json" ;\
|
||||||
|
cat gosec_results.json | grep HIGH | grep severity > /dev/null ;\
|
||||||
|
if [ $$? -eq 0 ]; then \
|
||||||
|
printf "\nFAILURE: gosec found files containing HIGH severity issues - see results.json\n" ;\
|
||||||
|
exit 1 ;\
|
||||||
|
else \
|
||||||
|
printf "\ngosec found no HIGH severity issues\n" ;\
|
||||||
|
fi ;\
|
||||||
|
cat gosec_results.json | grep MEDIUM | grep severity > /dev/null ;\
|
||||||
|
if [ $$? -eq 0 ]; then \
|
||||||
|
printf "\nFAILURE: gosec found files containing MEDIUM severity issues - see results.json\n" ;\
|
||||||
|
exit 1 ;\
|
||||||
|
else \
|
||||||
|
printf "\ngosec found no MEDIUM severity issues\n" ;\
|
||||||
|
fi ;\
|
||||||
|
cat gosec_results.json | grep LOW | grep severity > /dev/null;\
|
||||||
|
if [ $$? -eq 0 ]; then \
|
||||||
|
printf "\nFAILURE: gosec found files containing LOW severity issues - see results.json\n" ;\
|
||||||
|
exit 1;\
|
||||||
|
else \
|
||||||
|
printf "\ngosec found no LOW severity issues\n" ;\
|
||||||
|
fi ;\
|
||||||
|
|
||||||
include formatting.mk
|
include formatting.mk
|
||||||
|
|||||||
60
NOTICES.txt
60
NOTICES.txt
@@ -20,6 +20,14 @@ Affected Components:
|
|||||||
* golang.org/x/sys
|
* golang.org/x/sys
|
||||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||||
|
|
||||||
|
B.2 MIT license
|
||||||
|
* github.com/genuinetools/amicontained
|
||||||
|
Copyright (c) 2018 The Genuinetools Authors
|
||||||
|
|
||||||
|
B.3 BSD 2-Clause license
|
||||||
|
* github.com/syndtr/gocapability/
|
||||||
|
Copyright 2013 Suryandaru Triandana <syndtr@gmail.com>
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
END OF A. SUMMARY
|
END OF A. SUMMARY
|
||||||
===============================================================================
|
===============================================================================
|
||||||
@@ -58,6 +66,58 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
END OF B.1 BSD 3-Clause license
|
END OF B.1 BSD 3-Clause license
|
||||||
==========================================================================
|
==========================================================================
|
||||||
|
|
||||||
|
==========================================================================
|
||||||
|
B.2 MIT license
|
||||||
|
==========================================================================
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
==========================================================================
|
||||||
|
END OF B.2 MIT license
|
||||||
|
==========================================================================
|
||||||
|
|
||||||
|
==========================================================================
|
||||||
|
B.3 BSD 2-Clause license
|
||||||
|
==========================================================================
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
==========================================================================
|
||||||
|
END OF B.3 BSD 2-Clause license
|
||||||
|
==========================================================================
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
END OF B. LICENSE FILES AND OTHER INFORMATION
|
END OF B. LICENSE FILES AND OTHER INFORMATION
|
||||||
==========================================================================
|
==========================================================================
|
||||||
|
|||||||
56
README.md
56
README.md
@@ -1,43 +1,55 @@
|
|||||||

|
# IBM MQ container
|
||||||
|
|
||||||
# Overview
|
[](https://travis-ci.org/ibm-messaging/mq-container)
|
||||||
|
|
||||||
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).
|
**Note**: The `master` branch may be in an *unstable or even broken state* during development.
|
||||||
|
To get a stable version, please use the correct [branch](https://github.com/ibm-messaging/mq-container/branches) for your MQ version, instead of the `master` branch.
|
||||||
|
|
||||||
# Current status
|
## Overview
|
||||||
MQ Advanced for Developers image - [](https://travis-ci.org/ibm-messaging/mq-container)
|
|
||||||
|
|
||||||
# Build
|
Run [IBM® MQ](http://www-03.ibm.com/software/products/en/ibm-mq) in a container.
|
||||||
After extracting the code from this repository, you can build an image by following the instructions [here](docs/building.md)
|
|
||||||
|
|
||||||
# Usage
|
You can build an image containing either IBM MQ Advanced, or IBM MQ Advanced for Developers. The developer image includes a [default developer configuration](docs/developer-config.md), to make it easier to get started. There is also an [incubating](incubating) folder for additional images for other MQ components, which you might find useful.
|
||||||
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.
|
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
## List of all Environment variables supported by this image
|
After extracting the code from this repository, you can follow the [build documentation](docs/building.md) to build an image.
|
||||||
|
|
||||||
* **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`.
|
## Usage
|
||||||
* **LANG** - Set this to the language you would like the license to be printed in.
|
|
||||||
* **MQ_QMGR_NAME** - Set this to the name you want your Queue Manager to be created with.
|
|
||||||
* **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 "basic" to use a simple human-readable format. Defaults to "basic".
|
|
||||||
|
|
||||||
|
See the [usage documentation](docs/usage.md) for details on how to run a container.
|
||||||
|
|
||||||
# Issues and contributions
|
Note that in order to use the image, it is necessary to accept the terms of the [IBM MQ license](#license).
|
||||||
|
|
||||||
|
### Environment variables supported by this image
|
||||||
|
|
||||||
|
- **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`.
|
||||||
|
- **LANG** - Set this to the language you would like the license to be printed in.
|
||||||
|
- **MQ_QMGR_NAME** - Set this to the name you want your Queue Manager to be created with.
|
||||||
|
- **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 "basic" to use a simple human-readable format. Defaults to "basic".
|
||||||
|
- **MQ_ENABLE_METRICS** - Set this to `true` to generate Prometheus metrics for your Queue Manager.
|
||||||
|
|
||||||
|
See the [default developer configuration docs](docs/developer-config.md) for the extra environment variables supported by the MQ Advanced for Developers image.
|
||||||
|
|
||||||
|
### Kubernetes
|
||||||
|
|
||||||
|
If you want to use IBM MQ in [Kubernetes](https://kubernetes.io), you can find an example [Helm](https://helm.sh/) chart here: [IBM charts](https://github.com/IBM/charts). This can be used to run the container on a cluster, such as [IBM Cloud Private](https://www.ibm.com/cloud-computing/products/ibm-cloud-private/) or the [IBM Cloud Kubernetes Service](https://www.ibm.com/cloud/container-service).
|
||||||
|
|
||||||
|
## Issues and contributions
|
||||||
|
|
||||||
For issues relating specifically to the container image or Helm chart, please use the [GitHub issue tracker](https://github.com/ibm-messaging/mq-container/issues). If you do submit a Pull Request related to this Docker image, please indicate in the Pull Request that you accept and agree to be bound by the terms of the [IBM Contributor License Agreement](CLA.md).
|
For issues relating specifically to the container image or Helm chart, please use the [GitHub issue tracker](https://github.com/ibm-messaging/mq-container/issues). If you do submit a Pull Request related to this Docker image, please indicate in the Pull Request that you accept and agree to be bound by the terms of the [IBM Contributor License Agreement](CLA.md).
|
||||||
|
|
||||||
|
## License
|
||||||
# License
|
|
||||||
|
|
||||||
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-AKHJY4) (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-AKHJJP) (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.
|
||||||
|
|
||||||
# Copyright
|
## Copyright
|
||||||
|
|
||||||
© Copyright IBM Corporation 2015, 2018
|
© Copyright IBM Corporation 2015, 2019
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# © Copyright IBM Corporation 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,19 +12,12 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
apiVersion: v1
|
# Fedora includes more recent versions of buildah (need buildah V1.7 to get
|
||||||
kind: Service
|
# multi-stage builds to work properly)
|
||||||
metadata:
|
FROM docker.io/fedora:29
|
||||||
name: {{ template "fullname" . }}
|
RUN yum install -y buildah
|
||||||
labels:
|
COPY build.sh /usr/local/bin/build
|
||||||
app: {{ template "fullname" . }}
|
RUN chmod +x /usr/local/bin/build
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
ENV STORAGE_DRIVER=vfs
|
||||||
release: "{{ .Release.Name }}"
|
ENV BUILDAH_ISOLATION=chroot
|
||||||
heritage: "{{ .Release.Service }}"
|
ENTRYPOINT ["build"]
|
||||||
spec:
|
|
||||||
type: {{ .Values.service.type }}
|
|
||||||
ports:
|
|
||||||
- port: 1414
|
|
||||||
name: {{ .Values.service.name }}-server
|
|
||||||
selector:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
41
buildah/build.sh
Normal file
41
buildah/build.sh
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/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
|
||||||
51
buildah/mq-buildah
Executable file
51
buildah/mq-buildah
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
#!/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} "$@"
|
||||||
@@ -1,739 +0,0 @@
|
|||||||
The translated license terms can be viewed here: https://www-03.ibm.com/software/sla/sladb.nsf/displaylis/1CF4B88EAF6FB60B8525812F005F71E2?OpenDocument
|
|
||||||
|
|
||||||
LICENSE INFORMATION
|
|
||||||
|
|
||||||
The Programs listed below are licensed under the following License Information terms and conditions in addition to the Program license terms previously agreed to by Client and IBM. If Client does not have previously agreed to license terms in effect for the Program, the International License Agreement for Non-Warranted Programs (Z125-5589-05) applies.
|
|
||||||
|
|
||||||
Program Name (Program Number):
|
|
||||||
IBM MQ Advanced for Developers (Non-Warranted) V9.0.3 (5724-H72)
|
|
||||||
|
|
||||||
The following standard terms apply to Licensee's use of the Program.
|
|
||||||
|
|
||||||
Bundled Programs
|
|
||||||
|
|
||||||
The Program is licensed as a multi-product package consisting of the Bundled Programs identified below. Licensee is authorized to install and use such Bundled Programs within the limits of the Proofs of Entitlement for the Program and as stated in this License Information document. Licensee is not authorized to transfer or remarket the Bundled Programs separate from the multi-product package. A Bundled Program may be accompanied by license terms, and those terms, if any, apply to Licensee's use of that Bundled Program. In the event of conflict, the terms in this License Information document supersede the Bundled Program's terms. When Licensee's right to use the Program expires or terminates, Licensee must discontinue use, destroy or promptly return all copies of the Bundled Programs to the party from whom Licensee acquired the Program. If Licensee downloaded the Bundled Programs, Licensee should contact the party from whom Licensee acquired the Program. If Licensee wishes to license the Bundled Programs for any use beyond the limits set forth above, please contact an IBM Sales Representative or the party from whom Licensee acquired the Program to obtain the appropriate license.
|
|
||||||
|
|
||||||
The following are Bundled Programs licensed with the Program:
|
|
||||||
IBM MQ V9.0.3
|
|
||||||
|
|
||||||
Developer Limitation
|
|
||||||
|
|
||||||
If the Program is designated as for "Developers", the Program can only be deployed as part of Licensee's internal development and unit testing on a developer machine. A developer machine is a physical or virtual desktop environment, running a primary operating system and the Program, both of which are accessible and used by no more than one specified developer. Licensee is not authorized to use the Program for processing production workloads, simulating production workloads or testing scalability of any code, application or system. Licensee is not authorized to use any part of the Program for any other purposes without acquiring the appropriate production entitlements.
|
|
||||||
|
|
||||||
Components Not Used for Establishing Required Entitlements
|
|
||||||
|
|
||||||
When determining the number of entitlements required for Licensee's installation or use of the Program, the installation or use of the following Program components are not taken into consideration. In other words, Licensee may install and use the following Program components, under the license terms, but these components are not used to determine the number of entitlements required for the Program.
|
|
||||||
IBM MQ Managed File Transfer Agent V9.0.1
|
|
||||||
IBM MQ Telemetry V9.0.1
|
|
||||||
|
|
||||||
Source Components and Sample Materials
|
|
||||||
|
|
||||||
The Program may include some components in source code form ("Source Components") and other materials identified as Sample Materials. Licensee may copy and modify Source Components and Sample Materials for internal use only provided such use is within the limits of the license rights under this Agreement, provided however that Licensee may not alter or delete any copyright information or notices contained in the Source Components or Sample Materials. IBM provides the Source Components and Sample Materials without obligation of support and "AS IS", WITH NO WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTY OF TITLE, NON-INFRINGEMENT OR NON-INTERFERENCE AND THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
L/N: L-APIG-AKHJY4
|
|
||||||
D/N: L-APIG-AKHJY4
|
|
||||||
P/N: L-APIG-AKHJY4
|
|
||||||
|
|
||||||
|
|
||||||
International License Agreement for Non-Warranted Programs
|
|
||||||
|
|
||||||
Part 1 - General Terms
|
|
||||||
|
|
||||||
BY DOWNLOADING, INSTALLING, COPYING, ACCESSING, CLICKING ON AN "ACCEPT" BUTTON, OR OTHERWISE USING THE PROGRAM, LICENSEE AGREES TO THE TERMS OF THIS AGREEMENT. IF YOU ARE ACCEPTING THESE TERMS ON BEHALF OF LICENSEE, YOU REPRESENT AND WARRANT THAT YOU HAVE FULL AUTHORITY TO BIND LICENSEE TO THESE TERMS. IF YOU DO NOT AGREE TO THESE TERMS,
|
|
||||||
|
|
||||||
* DO NOT DOWNLOAD, INSTALL, COPY, ACCESS, CLICK ON AN "ACCEPT" BUTTON, OR USE THE PROGRAM; AND
|
|
||||||
|
|
||||||
* PROMPTLY RETURN THE UNUSED MEDIA AND DOCUMENTATION TO THE PARTY FROM WHOM IT WAS OBTAINED FOR A REFUND OF THE AMOUNT PAID. IF THE PROGRAM WAS DOWNLOADED, DESTROY ALL COPIES OF THE PROGRAM.
|
|
||||||
|
|
||||||
1. Definitions
|
|
||||||
|
|
||||||
"Authorized Use" - the specified level at which Licensee is authorized to execute or run the Program. That level may be measured by number of users, millions of service units ("MSUs"), Processor Value Units ("PVUs"), or other level of use specified by IBM.
|
|
||||||
|
|
||||||
"IBM" - International Business Machines Corporation or one of its subsidiaries.
|
|
||||||
|
|
||||||
"License Information" ("LI") - a document that provides information and any additional terms specific to a Program. The Program's LI is available at www.ibm.com/software/sla. The LI can also be found in the Program's directory, by the use of a system command, or as a booklet included with the Program.
|
|
||||||
|
|
||||||
"Program" - the following, including the original and all whole or partial copies: 1) machine-readable instructions and data, 2) components, files, and modules, 3) audio-visual content (such as images, text, recordings, or pictures), and 4) related licensed materials (such as keys and documentation).
|
|
||||||
|
|
||||||
2. Agreement Structure
|
|
||||||
|
|
||||||
This Agreement includes Part 1 - General Terms, Part 2 - Country-unique Terms (if any) and the LI and is the complete agreement between Licensee and IBM regarding the use of the Program. It replaces any prior oral or written communications between Licensee and IBM concerning Licensee's use of the Program. The terms of Part 2 may replace or modify those of Part 1. To the extent of any conflict, the LI prevails over both Parts.
|
|
||||||
|
|
||||||
3. License Grant
|
|
||||||
|
|
||||||
The Program is owned by IBM or an IBM supplier, and is copyrighted and licensed, not sold.
|
|
||||||
|
|
||||||
IBM grants Licensee a nonexclusive license to 1) use the Program up to the Authorized Use specified in the invoice, 2) make and install copies to support such Authorized Use, and 3) make a backup copy, all provided that
|
|
||||||
|
|
||||||
a. Licensee has lawfully obtained the Program and complies with the terms of this Agreement;
|
|
||||||
|
|
||||||
b. the backup copy does not execute unless the backed-up Program cannot execute;
|
|
||||||
|
|
||||||
c. Licensee reproduces all copyright notices and other legends of ownership on each copy, or partial copy, of the Program;
|
|
||||||
|
|
||||||
d. Licensee ensures that anyone who uses the Program (accessed either locally or remotely) 1) does so only on Licensee's behalf and 2) complies with the terms of this Agreement;
|
|
||||||
|
|
||||||
e. Licensee does not 1) use, copy, modify, or distribute the Program except as expressly permitted in this Agreement; 2) reverse assemble, reverse compile, otherwise translate, or reverse engineer the Program, except as expressly permitted by law without the possibility of contractual waiver; 3) use any of the Program's components, files, modules, audio-visual content, or related licensed materials separately from that Program; or 4) sublicense, rent, or lease the Program; and
|
|
||||||
|
|
||||||
f. if Licensee obtains this Program as a Supporting Program, Licensee uses this Program only to support the Principal Program and subject to any limitations in the license to the Principal Program, or, if Licensee obtains this Program as a Principal Program, Licensee uses all Supporting Programs only to support this Program, and subject to any limitations in this Agreement. For purposes of this Item "f," a "Supporting Program" is a Program that is part of another IBM Program ("Principal Program") and identified as a Supporting Program in the Principal Program's LI. (To obtain a separate license to a Supporting Program without these restrictions, Licensee should contact the party from whom Licensee obtained the Supporting Program.)
|
|
||||||
|
|
||||||
This license applies to each copy of the Program that Licensee makes.
|
|
||||||
|
|
||||||
3.1 Trade-ups, Updates, Fixes, and Patches
|
|
||||||
|
|
||||||
3.1.1 Trade-ups
|
|
||||||
|
|
||||||
If the Program is replaced by a trade-up Program, the replaced Program's license is promptly terminated.
|
|
||||||
|
|
||||||
3.1.2 Updates, Fixes, and Patches
|
|
||||||
|
|
||||||
When Licensee receives an update, fix, or patch to a Program, Licensee accepts any additional or different terms that are applicable to such update, fix, or patch that are specified in its LI. If no additional or different terms are provided, then the update, fix, or patch is subject solely to this Agreement. If the Program is replaced by an update, Licensee agrees to promptly discontinue use of the replaced Program.
|
|
||||||
|
|
||||||
3.2 Fixed Term Licenses
|
|
||||||
|
|
||||||
If IBM licenses the Program for a fixed term, Licensee's license is terminated at the end of the fixed term, unless Licensee and IBM agree to renew it.
|
|
||||||
|
|
||||||
3.3 Term and Termination
|
|
||||||
|
|
||||||
This Agreement is effective until terminated.
|
|
||||||
|
|
||||||
IBM may terminate Licensee's license if Licensee fails to comply with the terms of this Agreement.
|
|
||||||
|
|
||||||
If the license is terminated for any reason by either party, Licensee agrees to promptly discontinue use of and destroy all of Licensee's copies of the Program. Any terms of this Agreement that by their nature extend beyond termination of this Agreement remain in effect until fulfilled, and apply to both parties' respective successors and assignees.
|
|
||||||
|
|
||||||
4. Charges
|
|
||||||
|
|
||||||
Charges, if any, are based on Authorized Use obtained, which is specified in the invoice. IBM does not give credits or refunds for charges already due or paid, except as specified elsewhere in this Agreement.
|
|
||||||
|
|
||||||
If Licensee wishes to increase its Authorized Use, Licensee must notify IBM or an authorized IBM reseller in advance and pay any applicable charges.
|
|
||||||
|
|
||||||
5. Taxes
|
|
||||||
|
|
||||||
If any authority imposes on the Program a duty, tax, levy, or fee, excluding those based on IBM's net income, then Licensee agrees to pay that amount, as specified in an invoice, or supply exemption documentation. Licensee is responsible for any personal property taxes for the Program from the date that Licensee obtains it. If any authority imposes a customs duty, tax, levy, or fee for the import into or the export, transfer, access, or use of the Program outside the country in which the original Licensee was granted the license, then Licensee agrees that it is responsible for, and will pay, any amount imposed.
|
|
||||||
|
|
||||||
6. Money-back Guarantee
|
|
||||||
|
|
||||||
If Licensee is dissatisfied with the Program for any reason and is the original Licensee, Licensee may terminate the license and obtain a refund of the amount Licensee paid, if any, for the Program, provided that Licensee returns the Program to the party from whom Licensee obtained it within 30 days of the invoice date. If the license is for a fixed term that is subject to renewal, then Licensee may obtain a refund only if the Program is returned within the first 30 days of the initial term. If Licensee downloaded the Program, Licensee should contact the party from whom Licensee obtained it for instructions on how to obtain the refund.
|
|
||||||
|
|
||||||
7. Program Transfer
|
|
||||||
|
|
||||||
Licensee may transfer the Program and all of Licensee's license rights and obligations to another party only if that party agrees to the terms of this Agreement. If the license is terminated for any reason by either party, Licensee is prohibited from transferring the Program to another party. Licensee may not transfer a portion of 1) the Program or 2) the Program's Authorized Use. When Licensee transfers the Program, Licensee must also transfer a hard copy of this Agreement, including the LI. Immediately after the transfer, Licensee's license terminates.
|
|
||||||
|
|
||||||
8. No Warranties
|
|
||||||
|
|
||||||
SUBJECT TO ANY STATUTORY WARRANTIES THAT CANNOT BE EXCLUDED, IBM MAKES NO WARRANTIES OR CONDITIONS, EXPRESS OR IMPLIED, REGARDING THE PROGRAM OR SUPPORT, IF ANY, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, AND TITLE, AND ANY WARRANTY OR CONDITION OF NON-INFRINGEMENT.
|
|
||||||
|
|
||||||
SOME STATES OR JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF EXPRESS OR IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY NOT APPLY TO LICENSEE. IN THAT EVENT, SUCH WARRANTIES ARE LIMITED IN DURATION TO THE MINIMUM PERIOD REQUIRED BY LAW. NO WARRANTIES APPLY AFTER THAT PERIOD. SOME STATES OR JURISDICTIONS DO NOT ALLOW LIMITATIONS ON HOW LONG AN IMPLIED WARRANTY LASTS, SO THE ABOVE LIMITATION MAY NOT APPLY TO LICENSEE. LICENSEE MAY HAVE OTHER RIGHTS THAT VARY FROM STATE TO STATE OR JURISDICTION TO JURISDICTION.
|
|
||||||
|
|
||||||
THE DISCLAIMERS AND EXCLUSIONS IN THIS SECTION 8 ALSO APPLY TO ANY OF IBM'S PROGRAM DEVELOPERS AND SUPPLIERS.
|
|
||||||
|
|
||||||
MANUFACTURERS, SUPPLIERS, OR PUBLISHERS OF NON-IBM PROGRAMS MAY PROVIDE THEIR OWN WARRANTIES.
|
|
||||||
|
|
||||||
IBM DOES NOT PROVIDE SUPPORT OF ANY KIND, UNLESS IBM SPECIFIES OTHERWISE. IN SUCH EVENT, ANY SUPPORT PROVIDED BY IBM IS SUBJECT TO THE DISCLAIMERS AND EXCLUSIONS IN THIS SECTION 8.
|
|
||||||
|
|
||||||
9. Licensee Data and Databases
|
|
||||||
|
|
||||||
To assist Licensee in isolating the cause of a problem with the Program, IBM may request that Licensee 1) allow IBM to remotely access Licensee's system or 2) send Licensee information or system data to IBM. However, IBM is not obligated to provide such assistance unless IBM and Licensee enter a separate written agreement under which IBM agrees to provide to Licensee that type of support, which is beyond IBM's obligations in this Agreement. In any event, IBM uses information about errors and problems to improve its products and services, and assist with its provision of related support offerings. For these purposes, IBM may use IBM entities and subcontractors (including in one or more countries other than the one in which Licensee is located), and Licensee authorizes IBM to do so.
|
|
||||||
|
|
||||||
Licensee remains responsible for 1) any data and the content of any database Licensee makes available to IBM, 2) the selection and implementation of procedures and controls regarding access, security, encryption, use, and transmission of data (including any personally-identifiable data), and 3) backup and recovery of any database and any stored data. Licensee will not send or provide IBM access to any personally-identifiable information, whether in data or any other form, and will be responsible for reasonable costs and other amounts that IBM may incur relating to any such information mistakenly provided to IBM or the loss or disclosure of such information by IBM, including those arising out of any third party claims.
|
|
||||||
|
|
||||||
10. Limitation of Liability
|
|
||||||
|
|
||||||
The limitations and exclusions in this Section 10 (Limitation of Liability) apply to the full extent they are not prohibited by applicable law without the possibility of contractual waiver.
|
|
||||||
|
|
||||||
10.1 Items for Which IBM May Be Liable
|
|
||||||
|
|
||||||
Circumstances may arise where, because of a default on IBM's part or other liability, Licensee is entitled to recover damages from IBM. Regardless of the basis on which Licensee is entitled to claim damages from IBM (including fundamental breach, negligence, misrepresentation, or other contract or tort claim), IBM's entire liability for all claims in the aggregate arising from or related to each Program or otherwise arising under this Agreement will not exceed the amount of any 1) damages for bodily injury (including death) and damage to real property and tangible personal property and 2) other actual direct damages up to the charges (if the Program is subject to fixed term charges, up to twelve months' charges) Licensee paid for the Program that is the subject of the claim.
|
|
||||||
|
|
||||||
This limit also applies to any of IBM's Program developers and suppliers. It is the maximum for which IBM and its Program developers and suppliers are collectively responsible.
|
|
||||||
|
|
||||||
10.2 Items for Which IBM Is Not Liable
|
|
||||||
|
|
||||||
UNDER NO CIRCUMSTANCES IS IBM, ITS PROGRAM DEVELOPERS OR SUPPLIERS LIABLE FOR ANY OF THE FOLLOWING, EVEN IF INFORMED OF THEIR POSSIBILITY:
|
|
||||||
|
|
||||||
a. LOSS OF, OR DAMAGE TO, DATA;
|
|
||||||
|
|
||||||
b. SPECIAL, INCIDENTAL, EXEMPLARY, OR INDIRECT DAMAGES, OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES; OR
|
|
||||||
|
|
||||||
c. LOST PROFITS, BUSINESS, REVENUE, GOODWILL, OR ANTICIPATED SAVINGS.
|
|
||||||
|
|
||||||
11. Compliance Verification
|
|
||||||
|
|
||||||
For purposes of this Section 11 (Compliance Verification), "ILAN Program Terms" means 1) this Agreement and applicable amendments and transaction documents provided by IBM, and 2) IBM software policies that may be found at the IBM Software Policy website (www.ibm.com/softwarepolicies), including but not limited to those policies concerning backup, sub-capacity pricing, and migration.
|
|
||||||
|
|
||||||
The rights and obligations set forth in this Section 11 remain in effect during the period the Program is licensed to Licensee, and for two years thereafter.
|
|
||||||
|
|
||||||
11.1 Verification Process
|
|
||||||
|
|
||||||
Licensee agrees to create, retain, and provide to IBM and its auditors accurate written records, system tool outputs, and other system information sufficient to provide auditable verification that Licensee's use of all Programs is in compliance with the ILAN Program Terms, including, without limitation, all of IBM's applicable licensing and pricing qualification terms. Licensee is responsible for 1) ensuring that it does not exceed its Authorized Use, and 2) remaining in compliance with ILAN Program Terms.
|
|
||||||
|
|
||||||
Upon reasonable notice, IBM may verify Licensee's compliance with ILAN Program Terms at all sites and for all environments in which Licensee uses (for any purpose) Programs subject to ILAN Program Terms. Such verification will be conducted in a manner that minimizes disruption to Licensee's business, and may be conducted on Licensee's premises, during normal business hours. IBM may use an independent auditor to assist with such verification, provided IBM has a written confidentiality agreement in place with such auditor.
|
|
||||||
|
|
||||||
11.2 Resolution
|
|
||||||
|
|
||||||
IBM will notify Licensee in writing if any such verification indicates that Licensee has used any Program in excess of its Authorized Use or is otherwise not in compliance with the ILAN Program Terms. Licensee agrees to promptly pay directly to IBM the charges that IBM specifies in an invoice for 1) any such excess use, 2) support for such excess use for the lesser of the duration of such excess use or two years, and 3) any additional charges and other liabilities determined as a result of such verification.
|
|
||||||
|
|
||||||
12. Third Party Notices
|
|
||||||
|
|
||||||
The Program may include third party code that IBM, not the third party, licenses to Licensee under this Agreement. Notices, if any, for the third party code ("Third Party Notices") are included for Licensee's information only. These notices can be found in the Program's NOTICES file(s). Information on how to obtain source code for certain third party code can be found in the Third Party Notices. If in the Third Party Notices IBM identifies third party code as "Modifiable Third Party Code," IBM authorizes Licensee to 1) modify the Modifiable Third Party Code and 2) reverse engineer the Program modules that directly interface with the Modifiable Third Party Code provided that it is only for the purpose of debugging Licensee's modifications to such third party code. IBM's service and support obligations, if any, apply only to the unmodified Program.
|
|
||||||
|
|
||||||
13. General
|
|
||||||
|
|
||||||
a. Nothing in this Agreement affects any statutory rights of consumers that cannot be waived or limited by contract.
|
|
||||||
|
|
||||||
b. For Programs IBM provides to Licensee in tangible form, IBM fulfills its shipping and delivery obligations upon the delivery of such Programs to the IBM-designated carrier, unless otherwise agreed to in writing by Licensee and IBM.
|
|
||||||
|
|
||||||
c. If any provision of this Agreement is held to be invalid or unenforceable, the remaining provisions of this Agreement remain in full force and effect.
|
|
||||||
|
|
||||||
d. Licensee agrees to comply with all applicable export and import laws and regulations, including U.S. embargo and sanctions regulations and prohibitions on export for certain end uses or to certain users.
|
|
||||||
|
|
||||||
e. Licensee authorizes International Business Machines Corporation and its subsidiaries (and their successors and assigns, contractors and IBM Business Partners) to store and use Licensee's business contact information wherever they do business, in connection with IBM products and services, or in furtherance of IBM's business relationship with Licensee.
|
|
||||||
|
|
||||||
f. Each party will allow the other reasonable opportunity to comply before it claims that the other has not met its obligations under this Agreement. The parties will attempt in good faith to resolve all disputes, disagreements, or claims between the parties relating to this Agreement.
|
|
||||||
|
|
||||||
g. Unless otherwise required by applicable law without the possibility of contractual waiver or limitation: 1) neither party will bring a legal action, regardless of form, for any claim arising out of or related to this Agreement more than two years after the cause of action arose; and 2) upon the expiration of such time limit, any such claim and all respective rights related to the claim lapse.
|
|
||||||
|
|
||||||
h. Neither Licensee nor IBM is responsible for failure to fulfill any obligations due to causes beyond its control.
|
|
||||||
|
|
||||||
i. No right or cause of action for any third party is created by this Agreement, nor is IBM responsible for any third party claims against Licensee, except as permitted in Subsection 10.1 (Items for Which IBM May Be Liable) above for bodily injury (including death) or damage to real or tangible personal property for which IBM is legally liable to that third party.
|
|
||||||
|
|
||||||
j. In entering into this Agreement, neither party is relying on any representation not specified in this Agreement, including but not limited to any representation concerning: 1) the performance or function of the Program; 2) the experiences or recommendations of other parties; or 3) any results or savings that Licensee may achieve.
|
|
||||||
|
|
||||||
k. IBM has signed agreements with certain organizations (called "IBM Business Partners") to promote, market, and support certain Programs. IBM Business Partners remain independent and separate from IBM. IBM is not responsible for the actions or statements of IBM Business Partners or obligations they have to Licensee.
|
|
||||||
|
|
||||||
l. The license and intellectual property indemnification terms of Licensee's other agreements with IBM (such as the IBM Customer Agreement) do not apply to Program licenses granted under this Agreement.
|
|
||||||
|
|
||||||
m. Both parties agree that all information exchanged is nonconfidential. If either party requires the exchange of confidential information, it will be made under a signed confidentiality agreement.
|
|
||||||
|
|
||||||
14. Geographic Scope and Governing Law
|
|
||||||
|
|
||||||
14.1 Governing Law
|
|
||||||
|
|
||||||
Both parties agree to the application of the laws of the country in which Licensee obtained the Program license to govern, interpret, and enforce all of Licensee's and IBM's respective rights, duties, and obligations arising from, or relating in any manner to, the subject matter of this Agreement, without regard to conflict of law principles.
|
|
||||||
|
|
||||||
The United Nations Convention on Contracts for the International Sale of Goods does not apply.
|
|
||||||
|
|
||||||
14.2 Jurisdiction
|
|
||||||
|
|
||||||
All rights, duties, and obligations are subject to the courts of the country in which Licensee obtained the Program license.
|
|
||||||
|
|
||||||
Part 2 - Country-unique Terms
|
|
||||||
|
|
||||||
For licenses granted in the countries specified below, the following terms replace or modify the referenced terms in Part 1. All terms in Part 1 that are not changed by these amendments remain unchanged and in effect. This Part 2 is organized as follows:
|
|
||||||
|
|
||||||
* Multiple country amendments to Part 1, Section 14 (Governing Law and Jurisdiction);
|
|
||||||
|
|
||||||
* Americas country amendments to other Agreement terms;
|
|
||||||
|
|
||||||
* Asia Pacific country amendments to other Agreement terms; and
|
|
||||||
|
|
||||||
* Europe, Middle East, and Africa country amendments to other Agreement terms.
|
|
||||||
|
|
||||||
Multiple country amendments to Part 1, Section 14 (Governing Law and Jurisdiction)
|
|
||||||
|
|
||||||
14.1 Governing Law
|
|
||||||
|
|
||||||
The phrase "the laws of the country in which Licensee obtained the Program license" in the first paragraph of 14.1 Governing Law is replaced by the following phrases in the countries below:
|
|
||||||
|
|
||||||
AMERICAS
|
|
||||||
|
|
||||||
(1) In Canada: the laws in the Province of Ontario;
|
|
||||||
|
|
||||||
(2) in Mexico: the federal laws of the Republic of Mexico;
|
|
||||||
|
|
||||||
(3) in the United States, Anguilla, Antigua/Barbuda, Aruba, British Virgin Islands, Cayman Islands, Dominica, Grenada, Guyana, Saint Kitts and Nevis, Saint Lucia, Saint Maarten, and Saint Vincent and the Grenadines: the laws of the State of New York, United States;
|
|
||||||
|
|
||||||
(4) in Venezuela: the laws of the Bolivarian Republic of Venezuela;
|
|
||||||
|
|
||||||
ASIA PACIFIC
|
|
||||||
|
|
||||||
(5) in Cambodia and Laos: the laws of the State of New York, United States;
|
|
||||||
|
|
||||||
(6) in Australia: the laws of the State or Territory in which the transaction is performed;
|
|
||||||
|
|
||||||
(7) in Hong Kong SAR and Macau SAR: the laws of Hong Kong Special Administrative Region ("SAR");
|
|
||||||
|
|
||||||
(8) in Taiwan: the laws of Taiwan;
|
|
||||||
|
|
||||||
EUROPE, MIDDLE EAST, AND AFRICA
|
|
||||||
|
|
||||||
(9) in Albania, Armenia, Azerbaijan, Belarus, Bosnia-Herzegovina, Bulgaria, Croatia, Former Yugoslav Republic of Macedonia, Georgia, Hungary, Kazakhstan, Kyrgyzstan, Moldova, Montenegro, Poland, Romania, Russia, Serbia, Slovakia, Tajikistan, Turkmenistan, Ukraine, and Uzbekistan: the laws of Austria;
|
|
||||||
|
|
||||||
(10) in Algeria, Andorra, Benin, Burkina Faso, Cameroon, Cape Verde, Central African Republic, Chad, Comoros, Congo Republic, Djibouti, Democratic Republic of Congo, Equatorial Guinea, French Guiana, French Polynesia, Gabon, Gambia, Guinea, Guinea-Bissau, Ivory Coast, Lebanon, Madagascar, Mali, Mauritania, Mauritius, Mayotte, Morocco, New Caledonia, Niger, Reunion, Senegal, Seychelles, Togo, Tunisia, Vanuatu, and Wallis and Futuna: the laws of France;
|
|
||||||
|
|
||||||
(11) in Estonia, Latvia, and Lithuania: the laws of Finland;
|
|
||||||
|
|
||||||
(12) in Angola, Bahrain, Botswana, Burundi, Egypt, Eritrea, Ethiopia, Ghana, Jordan, Kenya, Kuwait, Liberia, Malawi, Malta, Mozambique, Nigeria, Oman, Pakistan, Qatar, Rwanda, Sao Tome and Principe, Saudi Arabia, Sierra Leone, Somalia, Tanzania, Uganda, United Arab Emirates, the United Kingdom, West Bank/Gaza, Yemen, Zambia, and Zimbabwe: the laws of England; and
|
|
||||||
|
|
||||||
(13) in South Africa, Namibia, Lesotho, and Swaziland: the laws of the Republic of South Africa.
|
|
||||||
|
|
||||||
14.2 Jurisdiction
|
|
||||||
|
|
||||||
The following paragraph pertains to jurisdiction and replaces Subsection 14.2 (Jurisdiction) as it applies for those countries identified below:
|
|
||||||
|
|
||||||
All rights, duties, and obligations are subject to the courts of the country in which Licensee obtained the Program license except that in the countries identified below all disputes arising out of or related to this Agreement, including summary proceedings, will be brought before and subject to the exclusive jurisdiction of the following courts of competent jurisdiction:
|
|
||||||
|
|
||||||
AMERICAS
|
|
||||||
|
|
||||||
(1) In Argentina: the Ordinary Commercial Court of the city of Buenos Aires;
|
|
||||||
|
|
||||||
(2) in Brazil: the court of Rio de Janeiro, RJ;
|
|
||||||
|
|
||||||
(3) in Chile: the Civil Courts of Justice of Santiago;
|
|
||||||
|
|
||||||
(4) in Ecuador: the civil judges of Quito for executory or summary proceedings (as applicable);
|
|
||||||
|
|
||||||
(5) in Mexico: the courts located in Mexico City, Federal District;
|
|
||||||
|
|
||||||
(6) in Peru: the judges and tribunals of the judicial district of Lima, Cercado;
|
|
||||||
|
|
||||||
(7) in Uruguay: the courts of the city of Montevideo;
|
|
||||||
|
|
||||||
(8) in Venezuela: the courts of the metropolitan area of the city of Caracas;
|
|
||||||
|
|
||||||
EUROPE, MIDDLE EAST, AND AFRICA
|
|
||||||
|
|
||||||
(9) in Austria: the court of law in Vienna, Austria (Inner-City);
|
|
||||||
|
|
||||||
(10) in Algeria, Andorra, Benin, Burkina Faso, Cameroon, Cape Verde, Central African Republic, Chad, Comoros, Congo Republic, Djibouti, Democratic Republic of Congo, Equatorial Guinea, France, French Guiana, French Polynesia, Gabon, Gambia, Guinea, Guinea-Bissau, Ivory Coast, Lebanon, Madagascar, Mali, Mauritania, Mauritius, Mayotte, Monaco, Morocco, New Caledonia, Niger, Reunion, Senegal, Seychelles, Togo, Tunisia, Vanuatu, and Wallis and Futuna: the Commercial Court of Paris;
|
|
||||||
|
|
||||||
(11) in Angola, Bahrain, Botswana, Burundi, Egypt, Eritrea, Ethiopia, Ghana, Jordan, Kenya, Kuwait, Liberia, Malawi, Malta, Mozambique, Nigeria, Oman, Pakistan, Qatar, Rwanda, Sao Tome and Principe, Saudi Arabia, Sierra Leone, Somalia, Tanzania, Uganda, United Arab Emirates, the United Kingdom, West Bank/Gaza, Yemen, Zambia, and Zimbabwe: the English courts;
|
|
||||||
|
|
||||||
(12) in South Africa, Namibia, Lesotho, and Swaziland: the High Court in Johannesburg;
|
|
||||||
|
|
||||||
(13) in Greece: the competent court of Athens;
|
|
||||||
|
|
||||||
(14) in Israel: the courts of Tel Aviv-Jaffa;
|
|
||||||
|
|
||||||
(15) in Italy: the courts of Milan;
|
|
||||||
|
|
||||||
(16) in Portugal: the courts of Lisbon;
|
|
||||||
|
|
||||||
(17) in Spain: the courts of Madrid; and
|
|
||||||
|
|
||||||
(18) in Turkey: the Istanbul Central Courts and Execution Directorates of Istanbul, the Republic of Turkey.
|
|
||||||
|
|
||||||
14.3 Arbitration
|
|
||||||
|
|
||||||
The following paragraph is added as a new Subsection 14.3 (Arbitration) as it applies for those countries identified below. The provisions of this Subsection 14.3 prevail over those of Subsection 14.2 (Jurisdiction) to the extent permitted by the applicable governing law and rules of procedure:
|
|
||||||
|
|
||||||
ASIA PACIFIC
|
|
||||||
|
|
||||||
(1) In Cambodia, India, Laos, Philippines, and Vietnam:
|
|
||||||
|
|
||||||
Disputes arising out of or in connection with this Agreement will be finally settled by arbitration which will be held in Singapore in accordance with the Arbitration Rules of Singapore International Arbitration Center ("SIAC Rules") then in effect. The arbitration award will be final and binding for the parties without appeal and will be in writing and set forth the findings of fact and the conclusions of law.
|
|
||||||
|
|
||||||
The number of arbitrators will be three, with each side to the dispute being entitled to appoint one arbitrator. The two arbitrators appointed by the parties will appoint a third arbitrator who will act as chairman of the proceedings. Vacancies in the post of chairman will be filled by the president of the SIAC. Other vacancies will be filled by the respective nominating party. Proceedings will continue from the stage they were at when the vacancy occurred.
|
|
||||||
|
|
||||||
If one of the parties refuses or otherwise fails to appoint an arbitrator within 30 days of the date the other party appoints its, the first appointed arbitrator will be the sole arbitrator, provided that the arbitrator was validly and properly appointed.
|
|
||||||
|
|
||||||
All proceedings will be conducted, including all documents presented in such proceedings, in the English language. The English language version of this Agreement prevails over any other language version.
|
|
||||||
|
|
||||||
(2) In the People's Republic of China:
|
|
||||||
|
|
||||||
In case no settlement can be reached, the disputes will be submitted to China International Economic and Trade Arbitration Commission for arbitration according to the then effective rules of the said Arbitration Commission. The arbitration will take place in Beijing and be conducted in Chinese. The arbitration award will be final and binding on both parties. During the course of arbitration, this agreement will continue to be performed except for the part which the parties are disputing and which is undergoing arbitration.
|
|
||||||
|
|
||||||
(3) In Indonesia:
|
|
||||||
|
|
||||||
Each party will allow the other reasonable opportunity to comply before it claims that the other has not met its obligations under this Agreement. The parties will attempt in good faith to resolve all disputes, disagreements, or claims between the parties relating to this Agreement. Unless otherwise required by applicable law without the possibility of contractual waiver or limitation, i) neither party will bring a legal action, regardless of form, arising out of or related to this Agreement or any transaction under it more than two years after the cause of action arose; and ii) after such time limit, any legal action arising out of this Agreement or any transaction under it and all respective rights related to any such action lapse.
|
|
||||||
|
|
||||||
Disputes arising out of or in connection with this Agreement shall be finally settled by arbitration that shall be held in Jakarta, Indonesia in accordance with the rules of Board of the Indonesian National Board of Arbitration (Badan Arbitrase Nasional Indonesia or "BANI") then in effect. The arbitration award shall be final and binding for the parties without appeal and shall be in writing and set forth the findings of fact and the conclusions of law.
|
|
||||||
|
|
||||||
The number of arbitrators shall be three, with each side to the dispute being entitled to appoint one arbitrator. The two arbitrators appointed by the parties shall appoint a third arbitrator who shall act as chairman of the proceedings. Vacancies in the post of chairman shall be filled by the chairman of the BANI. Other vacancies shall be filled by the respective nominating party. Proceedings shall continue from the stage they were at when the vacancy occurred.
|
|
||||||
|
|
||||||
If one of the parties refuses or otherwise fails to appoint an arbitrator within 30 days of the date the other party appoints its, the first appointed arbitrator shall be the sole arbitrator, provided that the arbitrator was validly and properly appointed.
|
|
||||||
|
|
||||||
All proceedings shall be conducted, including all documents presented in such proceedings, in the English and/or Indonesian language.
|
|
||||||
|
|
||||||
EUROPE, MIDDLE EAST, AND AFRICA
|
|
||||||
|
|
||||||
(4) In Albania, Armenia, Azerbaijan, Belarus, Bosnia-Herzegovina, Bulgaria, Croatia, Former Yugoslav Republic of Macedonia, Georgia, Hungary, Kazakhstan, Kyrgyzstan, Moldova, Montenegro, Poland, Romania, Russia, Serbia, Slovakia, Tajikistan, Turkmenistan, Ukraine, and Uzbekistan:
|
|
||||||
|
|
||||||
All disputes arising out of this Agreement or related to its violation, termination or nullity will be finally settled under the Rules of Arbitration and Conciliation of the International Arbitral Center of the Federal Economic Chamber in Vienna (Vienna Rules) by three arbitrators appointed in accordance with these rules. The arbitration will be held in Vienna, Austria, and the official language of the proceedings will be English. The decision of the arbitrators will be final and binding upon both parties. Therefore, pursuant to paragraph 598 (2) of the Austrian Code of Civil Procedure, the parties expressly waive the application of paragraph 595 (1) figure 7 of the Code. IBM may, however, institute proceedings in a competent court in the country of installation.
|
|
||||||
|
|
||||||
(5) In Estonia, Latvia, and Lithuania:
|
|
||||||
|
|
||||||
All disputes arising in connection with this Agreement will be finally settled in arbitration that will be held in Helsinki, Finland in accordance with the arbitration laws of Finland then in effect. Each party will appoint one arbitrator. The arbitrators will then jointly appoint the chairman. If arbitrators cannot agree on the chairman, then the Central Chamber of Commerce in Helsinki will appoint the chairman.
|
|
||||||
|
|
||||||
AMERICAS COUNTRY AMENDMENTS
|
|
||||||
|
|
||||||
CANADA
|
|
||||||
|
|
||||||
10.1 Items for Which IBM May Be Liable
|
|
||||||
|
|
||||||
The following replaces Item 1 in the first paragraph of this Subsection 10.1 (Items for Which IBM May Be Liable):
|
|
||||||
|
|
||||||
1) damages for bodily injury (including death) and physical harm to real property and tangible personal property caused by IBM's negligence; and
|
|
||||||
|
|
||||||
13. General
|
|
||||||
|
|
||||||
The following replaces Item 13.d:
|
|
||||||
|
|
||||||
d. Licensee agrees to comply with all applicable export and import laws and regulations, including those of that apply to goods of United States origin and that prohibit or limit export for certain uses or to certain users.
|
|
||||||
|
|
||||||
The following replaces Item 13.i:
|
|
||||||
|
|
||||||
i. No right or cause of action for any third party is created by this Agreement or any transaction under it, nor is IBM responsible for any third party claims against Licensee except as permitted by the Limitation of Liability section above for bodily injury (including death) or physical harm to real or tangible personal property caused by IBM's negligence for which IBM is legally liable to that third party.
|
|
||||||
|
|
||||||
The following is added as Item 13.n:
|
|
||||||
|
|
||||||
n. For purposes of this Item 13.n, "Personal Data" refers to information relating to an identified or identifiable individual made available by one of the parties, its personnel or any other individual to the other in connection with this Agreement. The following provisions apply in the event that one party makes Personal Data available to the other:
|
|
||||||
|
|
||||||
(1) General
|
|
||||||
|
|
||||||
(a) Each party is responsible for complying with any obligations applying to it under applicable Canadian data privacy laws and regulations ("Laws").
|
|
||||||
|
|
||||||
(b) Neither party will request Personal Data beyond what is necessary to fulfill the purpose(s) for which it is requested. The purpose(s) for requesting Personal Data must be reasonable. Each party will agree in advance as to the type of Personal Data that is required to be made available.
|
|
||||||
|
|
||||||
(2) Security Safeguards
|
|
||||||
|
|
||||||
(a) Each party acknowledges that it is solely responsible for determining and communicating to the other the appropriate technological, physical and organizational security measures required to protect Personal Data.
|
|
||||||
|
|
||||||
(b) Each party will ensure that Personal Data is protected in accordance with the security safeguards communicated and agreed to by the other.
|
|
||||||
|
|
||||||
(c) Each party will ensure that any third party to whom Personal Data is transferred is bound by the applicable terms of this section.
|
|
||||||
|
|
||||||
(d) Additional or different services required to comply with the Laws will be deemed a request for new services.
|
|
||||||
|
|
||||||
(3) Use
|
|
||||||
|
|
||||||
Each party agrees that Personal Data will only be used, accessed, managed, transferred, disclosed to third parties or otherwise processed to fulfill the purpose(s) for which it was made available.
|
|
||||||
|
|
||||||
(4) Access Requests
|
|
||||||
|
|
||||||
(a) Each party agrees to reasonably cooperate with the other in connection with requests to access or amend Personal Data.
|
|
||||||
|
|
||||||
(b) Each party agrees to reimburse the other for any reasonable charges incurred in providing each other assistance.
|
|
||||||
|
|
||||||
(c) Each party agrees to amend Personal Data only upon receiving instructions to do so from the other party or its personnel.
|
|
||||||
|
|
||||||
(5) Retention
|
|
||||||
|
|
||||||
Each party will promptly return to the other or destroy all Personal Data that is no longer necessary to fulfill the purpose(s) for which it was made available, unless otherwise instructed by the other or its personnel or required by law.
|
|
||||||
|
|
||||||
(6) Public Bodies Who Are Subject to Public Sector Privacy Legislation
|
|
||||||
|
|
||||||
For Licensees who are public bodies subject to public sector privacy legislation, this Item 13.n applies only to Personal Data made available to Licensee in connection with this Agreement, and the obligations in this section apply only to Licensee, except that: 1) section (2)(a) applies only to IBM; 2) sections (1)(a) and (4)(a) apply to both parties; and 3) section (4)(b) and the last sentence in (1)(b) do not apply.
|
|
||||||
|
|
||||||
PERU
|
|
||||||
|
|
||||||
10. Limitation of Liability
|
|
||||||
|
|
||||||
The following is added to the end of this Section 10 (Limitation of Liability):
|
|
||||||
|
|
||||||
Except as expressly required by law without the possibility of contractual waiver, Licensee and IBM intend that the limitation of liability in this Limitation of Liability section applies to damages caused by all types of claims and causes of action. If any limitation on or exclusion from liability in this section is held by a court of competent jurisdiction to be unenforceable with respect to a particular claim or cause of action, the parties intend that it nonetheless apply to the maximum extent permitted by applicable law to all other claims and causes of action.
|
|
||||||
|
|
||||||
10.1 Items for Which IBM May Be Liable
|
|
||||||
|
|
||||||
The following is added to the end of this Subsection 10.1:
|
|
||||||
|
|
||||||
In accordance with Article 1328 of the Peruvian Civil Code, the limitations and exclusions specified in this section will not apply to damages caused by IBM's willful misconduct ("dolo") or gross negligence ("culpa inexcusable").
|
|
||||||
|
|
||||||
UNITED STATES OF AMERICA
|
|
||||||
|
|
||||||
5. Taxes
|
|
||||||
|
|
||||||
The following is added to the end of this Section 5 (Taxes):
|
|
||||||
|
|
||||||
For Programs delivered electronically in the United States for which Licensee claims a state sales and use tax exemption, Licensee agrees not to receive any tangible personal property (e.g., media and publications) associated with the electronic program.
|
|
||||||
|
|
||||||
Licensee agrees to be responsible for any sales and use tax liabilities that may arise as a result of Licensee's subsequent redistribution of Programs after delivery by IBM.
|
|
||||||
|
|
||||||
13. General
|
|
||||||
|
|
||||||
The following is added to Section 13 as Item 13.n:
|
|
||||||
|
|
||||||
n. U.S. Government Users Restricted Rights - Use, duplication or disclosure is restricted by the GSA IT Schedule 70 Contract with the IBM Corporation.
|
|
||||||
|
|
||||||
The following is added to Item 13.f:
|
|
||||||
|
|
||||||
Each party waives any right to a jury trial in any proceeding arising out of or related to this Agreement.
|
|
||||||
|
|
||||||
ASIA PACIFIC COUNTRY AMENDMENTS
|
|
||||||
|
|
||||||
AUSTRALIA
|
|
||||||
|
|
||||||
5. Taxes
|
|
||||||
|
|
||||||
The following sentences replace the first two sentences of Section 5 (Taxes):
|
|
||||||
|
|
||||||
If any government or authority imposes a duty, tax (other than income tax), levy, or fee, on this Agreement or on the Program itself, that is not otherwise provided for in the amount payable, Licensee agrees to pay it when IBM invoices Licensee. If the rate of GST changes, IBM may adjust the charge or other amount payable to take into account that change from the date the change becomes effective.
|
|
||||||
|
|
||||||
8. No Warranties
|
|
||||||
|
|
||||||
The following is added to the first paragraph of Section 8 (No Warranties):
|
|
||||||
|
|
||||||
Although IBM specifies that there are no warranties, Licensee may have certain rights under the Competition and Consumer Act 2010 or other legislation and are only limited to the extent permitted by the applicable legislation.
|
|
||||||
|
|
||||||
10.1 Items for Which IBM May Be Liable
|
|
||||||
|
|
||||||
The following is added to Subsection 10.1 (Items for Which IBM Maybe Liable):
|
|
||||||
|
|
||||||
Where IBM is in breach of a condition or warranty implied by the Competition and Consumer Act 2010, IBM's liability is limited to the repair or replacement of the goods, or the supply of equivalent goods. Where that condition or warranty relates to right to sell, quiet possession or clear title, or the goods are of a kind ordinarily obtained for personal, domestic or household use or consumption, then none of the limitations in this paragraph apply.
|
|
||||||
|
|
||||||
HONG KONG SAR, MACAU SAR, AND TAIWAN
|
|
||||||
|
|
||||||
As applies to licenses obtained in Taiwan and the special administrative regions, phrases throughout this Agreement containing the word "country" (for example, "the country in which the original Licensee was granted the license" and "the country in which Licensee obtained the Program license") are replaced with the following:
|
|
||||||
|
|
||||||
(1) In Hong Kong SAR: "Hong Kong SAR"
|
|
||||||
|
|
||||||
(2) In Macau SAR: "Macau SAR" except in the Governing Law clause (Section 14.1)
|
|
||||||
|
|
||||||
(3) In Taiwan: "Taiwan."
|
|
||||||
|
|
||||||
INDIA
|
|
||||||
|
|
||||||
10.1 Items for Which IBM May Be Liable
|
|
||||||
|
|
||||||
The following replaces the terms of Items 1 and 2 of the first paragraph:
|
|
||||||
|
|
||||||
1) liability for bodily injury (including death) or damage to real property and tangible personal property will be limited to that caused by IBM's negligence; and 2) as to any other actual damage arising in any situation involving nonperformance by IBM pursuant to, or in any way related to the subject of this Agreement, IBM's liability will be limited to the charge paid by Licensee for the individual Program that is the subject of the claim.
|
|
||||||
|
|
||||||
13. General
|
|
||||||
|
|
||||||
The following replaces the terms of Item 13.g:
|
|
||||||
|
|
||||||
g. If no suit or other legal action is brought, within three years after the cause of action arose, in respect of any claim that either party may have against the other, the rights of the concerned party in respect of such claim will be forfeited and the other party will stand released from its obligations in respect of such claim.
|
|
||||||
|
|
||||||
INDONESIA
|
|
||||||
|
|
||||||
3.3 Term and Termination
|
|
||||||
|
|
||||||
The following is added to the last paragraph:
|
|
||||||
|
|
||||||
Both parties waive the provision of article 1266 of the Indonesian Civil Code, to the extent the article provision requires such court decree for the termination of an agreement creating mutual obligations.
|
|
||||||
|
|
||||||
JAPAN
|
|
||||||
|
|
||||||
13. General
|
|
||||||
|
|
||||||
The following is inserted as Item 13.n:
|
|
||||||
|
|
||||||
n. Any doubts concerning this Agreement will be initially resolved between us in good faith and in accordance with the principle of mutual trust.
|
|
||||||
|
|
||||||
MALAYSIA
|
|
||||||
|
|
||||||
10.2 Items for Which IBM Is Not Liable
|
|
||||||
|
|
||||||
The word "SPECIAL" in Item 10.2b is deleted.
|
|
||||||
|
|
||||||
NEW ZEALAND
|
|
||||||
|
|
||||||
8. No Warranties
|
|
||||||
|
|
||||||
The following is added to the first paragraph of this Section 8 (No Warranties):
|
|
||||||
|
|
||||||
Although IBM specifies that there are no warranties, Licensee may have certain rights under the Consumer Guarantees Act 1993 or other legislation which cannot be excluded or limited. The Consumer Guarantees Act 1993 will not apply in respect of any goods which IBM provides, if Licensee requires the goods for the purposes of a business as defined in that Act.
|
|
||||||
|
|
||||||
10. Limitation of Liability
|
|
||||||
|
|
||||||
The following is added:
|
|
||||||
|
|
||||||
Where Programs are not obtained for the purposes of a business as defined in the Consumer Guarantees Act 1993, the limitations in this Section are subject to the limitations in that Act.
|
|
||||||
|
|
||||||
PEOPLE'S REPUBLIC OF CHINA
|
|
||||||
|
|
||||||
4. Charges
|
|
||||||
|
|
||||||
The following is added:
|
|
||||||
|
|
||||||
All banking charges incurred in the People's Republic of China will be borne by Licensee and those incurred outside the People's Republic of China will be borne by IBM.
|
|
||||||
|
|
||||||
PHILIPPINES
|
|
||||||
|
|
||||||
10.2 Items for Which IBM Is Not Liable
|
|
||||||
|
|
||||||
The following replaces the terms of Item 10.2b:
|
|
||||||
|
|
||||||
b. special (including nominal and exemplary damages), moral, incidental, or indirect damages or for any economic consequential damages; or
|
|
||||||
|
|
||||||
SINGAPORE
|
|
||||||
|
|
||||||
10.2 Items for Which IBM Is Not Liable
|
|
||||||
|
|
||||||
The words "SPECIAL" and "ECONOMIC" are deleted from Item 10.2b.
|
|
||||||
|
|
||||||
13. General
|
|
||||||
|
|
||||||
The following replaces the terms of Item 13.i:
|
|
||||||
|
|
||||||
i. Subject to the rights provided to IBM's suppliers and Program developers as provided in Section 10 above (Limitation of Liability), a person who is not a party to this Agreement will have no right under the Contracts (Right of Third Parties) Act to enforce any of its terms.
|
|
||||||
|
|
||||||
TAIWAN
|
|
||||||
|
|
||||||
10.1 Items for Which IBM May Be Liable
|
|
||||||
|
|
||||||
The following sentences are deleted:
|
|
||||||
|
|
||||||
This limit also applies to any of IBM's subcontractors and Program developers. It is the maximum for which IBM and its subcontractors and Program developers are collectively responsible.
|
|
||||||
|
|
||||||
EUROPE, MIDDLE EAST, AFRICA (EMEA) COUNTRY AMENDMENTS
|
|
||||||
|
|
||||||
EUROPEAN UNION MEMBER STATES
|
|
||||||
|
|
||||||
8. No Warranties
|
|
||||||
|
|
||||||
The following is added to Section 8 (No Warranties):
|
|
||||||
|
|
||||||
In the European Union ("EU"), consumers have legal rights under applicable national legislation governing the sale of consumer goods. Such rights are not affected by the provisions set out in this Section 8 (No Warranties).
|
|
||||||
|
|
||||||
EU MEMBER STATES AND THE COUNTRIES IDENTIFIED BELOW
|
|
||||||
|
|
||||||
Iceland, Liechtenstein, Norway, Switzerland, Turkey, and any other European country that has enacted local data privacy or protection legislation similar to the EU model.
|
|
||||||
|
|
||||||
13. General
|
|
||||||
|
|
||||||
The following replaces Item 13.e:
|
|
||||||
|
|
||||||
(1) Definitions - For the purposes of this Item 13.e, the following additional definitions apply:
|
|
||||||
|
|
||||||
(a) Business Contact Information - business-related contact information disclosed by Licensee to IBM, including names, job titles, business addresses, telephone numbers and email addresses of Licensee's employees and contractors. For Austria, Italy and Switzerland, Business Contact Information also includes information about Licensee and its contractors as legal entities (for example, Licensee's revenue data and other transactional information)
|
|
||||||
|
|
||||||
(b) Business Contact Personnel - Licensee employees and contractors to whom the Business Contact Information relates.
|
|
||||||
|
|
||||||
(c) Data Protection Authority - the authority established by the Data Protection and Electronic Communications Legislation in the applicable country or, for non-EU countries, the authority responsible for supervising the protection of personal data in that country, or (for any of the foregoing) any duly appointed successor entity thereto.
|
|
||||||
|
|
||||||
(d) Data Protection & Electronic Communications Legislation - (i) the applicable local legislation and regulations in force implementing the requirements of EU Directive 95/46/EC (on the protection of individuals with regard to the processing of personal data and on the free movement of such data) and of EU Directive 2002/58/EC (concerning the processing of personal data and the protection of privacy in the electronic communications sector); or (ii) for non-EU countries, the legislation and/or regulations passed in the applicable country relating to the protection of personal data and the regulation of electronic communications involving personal data, including (for any of the foregoing) any statutory replacement or modification thereof.
|
|
||||||
|
|
||||||
(e) IBM Group - International Business Machines Corporation of Armonk, New York, USA, its subsidiaries, and their respective Business Partners and subcontractors.
|
|
||||||
|
|
||||||
(2) Licensee authorizes IBM:
|
|
||||||
|
|
||||||
(a) to process and use Business Contact Information within IBM Group in support of Licensee including the provision of support services, and for the purpose of furthering the business relationship between Licensee and IBM Group, including, without limitation, contacting Business Contact Personnel (by email or otherwise) and marketing IBM Group products and services (the "Specified Purpose"); and
|
|
||||||
|
|
||||||
(b) to disclose Business Contact Information to other members of IBM Group in pursuit of the Specified Purpose only.
|
|
||||||
|
|
||||||
(3) IBM agrees that all Business Contact Information will be processed in accordance with the Data Protection & Electronic Communications Legislation and will be used only for the Specified Purpose.
|
|
||||||
|
|
||||||
(4) To the extent required by the Data Protection & Electronic Communications Legislation, Licensee represents that (a) it has obtained (or will obtain) any consents from (and has issued (or will issue) any notices to) the Business Contact Personnel as are necessary in order to enable IBM Group to process and use the Business Contact Information for the Specified Purpose.
|
|
||||||
|
|
||||||
(5) Licensee authorizes IBM to transfer Business Contact Information outside the European Economic Area, provided that the transfer is made on contractual terms approved by the Data Protection Authority or the transfer is otherwise permitted under the Data Protection & Electronic Communications Legislation.
|
|
||||||
|
|
||||||
AUSTRIA
|
|
||||||
|
|
||||||
8. No Warranties
|
|
||||||
|
|
||||||
In Austria (and Germany) the following replaces Section 8 (No Warranties) in its entirety, including its title, if Licensee paid a charge to obtain the Program.
|
|
||||||
|
|
||||||
8. Warranties and Exclusions
|
|
||||||
|
|
||||||
The warranty period is twelve months from the date of delivery. The limitation period for consumers in action for breach of warranty is the statutory period as a minimum.
|
|
||||||
|
|
||||||
The warranty for an IBM Program covers the functionality of the Program for its normal use and the Program's conformity to its specifications.
|
|
||||||
|
|
||||||
IBM warrants that when the Program is used in the specified operating environment it will conform to its specifications. IBM does not warrant uninterrupted or error-free operation of the Program or that IBM will correct all Program defects. Licensee is responsible for the results obtained from the use of the Program.
|
|
||||||
|
|
||||||
The warranty applies only to the unmodified portion of the Program.
|
|
||||||
|
|
||||||
If the Program does not function as warranted during the warranty period and the problem cannot be resolved with information available, Licensee may return the Program to the party from whom Licensee acquired it and receive a refund of the amount Licensee paid. If Licensee down loaded the Program, Licensee may contact the party from whom Licensee acquired it to obtain the refund.
|
|
||||||
|
|
||||||
This is IBM's sole obligation to Licensee, except as otherwise required by applicable statutory law.
|
|
||||||
|
|
||||||
10. Limitation of Liability
|
|
||||||
|
|
||||||
The following is added:
|
|
||||||
|
|
||||||
The following limitations and exclusions of IBM's liability do not apply for damages caused by gross negligence or willful misconduct.
|
|
||||||
|
|
||||||
10.1 Items for Which IBM May Be Liable
|
|
||||||
|
|
||||||
The following replaces the first sentence in the first paragraph:
|
|
||||||
|
|
||||||
Circumstances may arise where, because of a default by IBM in the performance of its obligations under this Agreement or other liability, Licensee is entitled to recover damages from IBM.
|
|
||||||
|
|
||||||
In the second sentence of the first paragraph, delete entirely the parenthetical phrase:
|
|
||||||
|
|
||||||
"(including fundamental breach, negligence, misrepresentation, or other contract or tort claim)".
|
|
||||||
|
|
||||||
10.2 Items for Which IBM Is Not Liable
|
|
||||||
|
|
||||||
The following replaces Item 10.2b:
|
|
||||||
|
|
||||||
b. indirect damages or consequential damages; or
|
|
||||||
|
|
||||||
BELGIUM, FRANCE, ITALY, AND LUXEMBOURG
|
|
||||||
|
|
||||||
10. Limitation of Liability
|
|
||||||
|
|
||||||
The following replaces the terms of Section 10 (Limitation of Liability) in its entirety:
|
|
||||||
|
|
||||||
Except as otherwise provided by mandatory law:
|
|
||||||
|
|
||||||
10.1 Items for Which IBM May Be Liable
|
|
||||||
|
|
||||||
IBM's entire liability for all claims in the aggregate for any damages and losses that may arise as a consequence of the fulfillment of its obligations under or in connection with this Agreement or due to any other cause related to this Agreement is limited to the compensation of only those damages and losses proved and actually arising as an immediate and direct consequence of the non-fulfillment of such obligations (if IBM is at fault) or of such cause, for a maximum amount equal to the charges (if the Program is subject to fixed term charges, up to twelve months' charges) Licensee paid for the Program that has caused the damages.
|
|
||||||
|
|
||||||
The above limitation will not apply to damages for bodily injuries (including death) and damages to real property and tangible personal property for which IBM is legally liable.
|
|
||||||
|
|
||||||
10.2 Items for Which IBM Is Not Liable
|
|
||||||
|
|
||||||
UNDER NO CIRCUMSTANCES IS IBM OR ANY OF ITS PROGRAM DEVELOPERS LIABLE FOR ANY OF THE FOLLOWING, EVEN IF INFORMED OF THEIR POSSIBILITY: 1) LOSS OF, OR DAMAGE TO, DATA; 2) INCIDENTAL, EXEMPLARY OR INDIRECT DAMAGES, OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES; AND / OR 3) LOST PROFITS, BUSINESS, REVENUE, GOODWILL, OR ANTICIPATED SAVINGS, EVEN IF THEY ARISE AS AN IMMEDIATE CONSEQUENCE OF THE EVENT THAT GENERATED THE DAMAGES.
|
|
||||||
|
|
||||||
10.3 Suppliers and Program Developers
|
|
||||||
|
|
||||||
The limitation and exclusion of liability herein agreed applies not only to the activities performed by IBM but also to the activities performed by its suppliers and Program developers, and represents the maximum amount for which IBM as well as its suppliers and Program developers are collectively responsible.
|
|
||||||
|
|
||||||
GERMANY
|
|
||||||
|
|
||||||
8. No Warranties
|
|
||||||
|
|
||||||
This Section 8 (No Warranties) is amended as specified for AUSTRIA.
|
|
||||||
|
|
||||||
10. Limitation of Liability
|
|
||||||
|
|
||||||
The following replaces this Section 10 (Limitation of Liability) in its entirety:
|
|
||||||
|
|
||||||
a. IBM will be liable without limit for 1) loss or damage caused by a breach of an express guarantee; 2) damages or losses resulting in bodily injury (including death); and 3) damages caused intentionally or by gross negligence.
|
|
||||||
|
|
||||||
b. In the event of loss, damage and frustrated expenditures caused by slight negligence or in breach of essential contractual obligations, IBM will be liable, regardless of the basis on which Licensee is entitled to claim damages from IBM (including fundamental breach, negligence, misrepresentation, or other contract or tort claim), per claim only up to the greater of 500,000 euro or the charges (if the Program is subject to fixed term charges, up to 12 months' charges) Licensee paid for the Program that caused the loss or damage. A number of defaults which together result in, or contribute to, substantially the same loss or damage will be treated as one default.
|
|
||||||
|
|
||||||
c. In the event of loss, damage and frustrated expenditures caused by slight negligence, IBM will not be liable for indirect or consequential damages, even if IBM was informed about the possibility of such loss or damage.
|
|
||||||
|
|
||||||
d. In case of delay on IBM's part: 1) IBM will pay to Licensee an amount not exceeding the loss or damage caused by IBM's delay and 2) IBM will be liable only in respect of the resulting damages that Licensee suffers, subject to the provisions of Items a and b above.
|
|
||||||
|
|
||||||
13. General
|
|
||||||
|
|
||||||
The following replaces the provisions of 13.g:
|
|
||||||
|
|
||||||
g. Any claims resulting from this Agreement are subject to a limitation period of three years, except as stated in Section 8 (No Warranties) of this Agreement.
|
|
||||||
|
|
||||||
The following replaces the provisions of 13.i:
|
|
||||||
|
|
||||||
i. No right or cause of action for any third party is created by this Agreement, nor is IBM responsible for any third party claims against Licensee, except (to the extent permitted in Section 10 (Limitation of Liability)) for: i) bodily injury (including death); or ii) damage to real or tangible personal property for which (in either case) IBM is legally liable to that third party.
|
|
||||||
|
|
||||||
IRELAND
|
|
||||||
|
|
||||||
8. No Warranties
|
|
||||||
|
|
||||||
The following sentence is added to the second paragraph of this Section 8 (No Warranties):
|
|
||||||
|
|
||||||
Except as expressly provided in these terms and conditions, or Section 12 of the Sale of Goods Act 1893 as amended by the Sale of Goods and Supply of Services Act, 1980 (the "1980 Act"), all conditions or warranties (express or implied, statutory or otherwise) are hereby excluded including, without limitation, any warranties implied by the Sale of Goods Act 1893 as amended by the 1980 Act (including, for the avoidance of doubt, Section 39 of the 1980 Act).
|
|
||||||
|
|
||||||
IRELAND AND UNITED KINGDOM
|
|
||||||
|
|
||||||
2. Agreement Structure
|
|
||||||
|
|
||||||
The following sentence is added:
|
|
||||||
|
|
||||||
Nothing in this paragraph shall have the effect of excluding or limiting liability for fraud.
|
|
||||||
|
|
||||||
10.1 Items for Which IBM May Be Liable
|
|
||||||
|
|
||||||
The following replaces the first paragraph of the Subsection:
|
|
||||||
|
|
||||||
For the purposes of this section, a "Default" means any act, statement, omission or negligence on the part of IBM in connection with, or in relation to, the subject matter of an Agreement in respect of which IBM is legally liable to Licensee, whether in contract or in tort. A number of Defaults which together result in, or contribute to, substantially the same loss or damage will be treated as one Default.
|
|
||||||
|
|
||||||
Circumstances may arise where, because of a Default by IBM in the performance of its obligations under this Agreement or other liability, Licensee is entitled to recover damages from IBM. Regardless of the basis on which Licensee is entitled to claim damages from IBM and except as expressly required by law without the possibility of contractual waiver, IBM's entire liability for any one Default will not exceed the amount of any direct damages, to the extent actually suffered by Licensee as an immediate and direct consequence of the Default, up to the greater of (1) 500,000 euro (or the equivalent in local currency) or (2) 125% of the charges (if the Program is subject to fixed term charges, up to 12 months' charges) for the Program that is the subject of the claim. Notwithstanding the foregoing, the amount of any damages for bodily injury (including death) and damage to real property and tangible personal property for which IBM is legally liable is not subject to such limitation.
|
|
||||||
|
|
||||||
10.2 Items for Which IBM Is Not Liable
|
|
||||||
|
|
||||||
The following replaces Items 10.2b and 10.2c:
|
|
||||||
|
|
||||||
b. special, incidental, exemplary, or indirect damages or consequential damages; or
|
|
||||||
|
|
||||||
c. wasted management time or lost profits, business, revenue, goodwill, or anticipated savings.
|
|
||||||
|
|
||||||
Z125-5589-05 (07/2011)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
License information for Ubuntu packages may be found inside the image: /usr/share/doc/${package}/copyright
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
# IBM MQ
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
# Introduction
|
|
||||||
|
|
||||||
This chart deploys a single IBM MQ Advanced for Developers server (queue manager) into an IBM Cloud private or other Kubernetes environment.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- Kubernetes 1.6 or greater, with beta APIs enabled
|
|
||||||
- If persistence is enabled (see [configuration](#configuration)), then you either need to create a PersistentVolume, or specify a Storage Class if classes are defined in your cluster.
|
|
||||||
¸
|
|
||||||
## Installing the Chart
|
|
||||||
|
|
||||||
To install the chart with the release name `foo`:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
helm install --name foo stable/ibm-mqadvanced-server-dev --set license=accept
|
|
||||||
```
|
|
||||||
|
|
||||||
This command accepts the [IBM MQ Advanced for Developers license](LICENSE) and deploys an MQ Advanced for Developers server on the Kubernetes cluster. The [configuration](#configuration) section lists the parameters that can be configured during installation.
|
|
||||||
|
|
||||||
> **Tip**: See all the resources deployed by the chart using `kubectl get all -l release=foo`
|
|
||||||
|
|
||||||
## Uninstalling the Chart
|
|
||||||
|
|
||||||
To uninstall/delete the `foo` release:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
helm delete foo
|
|
||||||
```
|
|
||||||
|
|
||||||
The command removes all the Kubernetes components associated with the chart, except any Persistent Volume Claims (PVCs). This is the default behavior of Kubernetes, and ensures that valuable data is not deleted. In order to delete the Queue Manager's data, you can delete the PVC using the following command:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
kubectl delete pvc -l release=foo
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
The following table lists the configurable parameters of the `ibm-mqadvanced-server-dev` chart and their default values.
|
|
||||||
|
|
||||||
| Parameter | Description | Default |
|
|
||||||
| -------------------------------- | ----------------------------------------------- | ---------------------------------------------------------- |
|
|
||||||
| `license` | Set to `accept` to accept the terms of the IBM license | `not accepted` |
|
|
||||||
| `image.repository` | Image full name including repository | `ibmcom/mq` |
|
|
||||||
| `image.tag` | Image tag | `9` |
|
|
||||||
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
|
||||||
| `image.pullSecret` | Image pull secret, if you are using a private Docker registry | `nil` |
|
|
||||||
| `persistence.enabled` | Use persistent volumes for all defined volumes | `true` |
|
|
||||||
| `persistence.useDynamicProvisioning` | Use dynamic provisioning (storage classes) for all volumes | `true` |
|
|
||||||
| `dataPVC.name` | Suffix for the PVC name | `"data"` |
|
|
||||||
| `dataPVC.storageClassName` | Storage class of volume for main MQ data (under `/var/mqm`) | `""` |
|
|
||||||
| `dataPVC.size` | Size of volume for main MQ data (under `/var/mqm`) | `2Gi` |
|
|
||||||
| `service.name` | Name of the Kubernetes service to create | `qmgr` |
|
|
||||||
| `service.type` | Kubernetes service type exposing ports, e.g. `NodePort` | `ClusterIP` |
|
|
||||||
| `resources.limits.cpu` | Kubernetes CPU limit for the Queue Manager container | `500m` |
|
|
||||||
| `resources.limits.memory` | Kubernetes memory limit for the Queue Manager container | `512Mi` |
|
|
||||||
| `resources.requests.cpu` | Kubernetes CPU request for the Queue Manager container | `500m` |
|
|
||||||
| `resources.requests.memory` | Kubernetes memory request for the Queue Manager container | `512Mi` |
|
|
||||||
| `queueManager.name` | MQ Queue Manager name | Helm release name |
|
|
||||||
| `queueManager.dev.adminPassword` | Developer defaults - administrator password | Random generated string. See the notes that appear when you install for how to retrieve this. |
|
|
||||||
| `queueManager.dev.appPassword` | Developer defaults - app password | `nil` (no password required to connect an MQ client) |
|
|
||||||
| `nameOverride` | Set to partially override the resource names used in this chart | `ibm-mq` |
|
|
||||||
|
|
||||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
|
|
||||||
|
|
||||||
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart.
|
|
||||||
|
|
||||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
|
||||||
|
|
||||||
## Persistence
|
|
||||||
|
|
||||||
The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/).
|
|
||||||
|
|
||||||
# Troubleshooting
|
|
||||||
|
|
||||||
## Cannot create a GlusterFS PersistentVolumeClaim
|
|
||||||
The generated PVC name can be too long when using GlusterFS. See [here](https://www.ibm.com/support/knowledgecenter/SSBS6K_2.1.0/troubleshoot/cannot_create_pvc.html) for more information. The PVC name is generated from three things:
|
|
||||||
|
|
||||||
1. The Helm release name, which is set by you at deployment time
|
|
||||||
2. A short PVC label, which defaults to "data" and can be changed using the `dataPVC.name` parameter.
|
|
||||||
3. The name of the chart you are using, which can be changed using the `nameOverride` parameter.
|
|
||||||
|
|
||||||
# Copyright
|
|
||||||
|
|
||||||
© Copyright IBM Corporation 2017
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
MQ can be accessed via port 1414 on the following DNS name from within your cluster:
|
|
||||||
{{ template "fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
|
|
||||||
|
|
||||||
To get your admin password run:
|
|
||||||
|
|
||||||
MQ_ADMIN_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.adminPassword}" | base64 --decode; echo)
|
|
||||||
|
|
||||||
If you set an app password, you can retrieve it by running the following:
|
|
||||||
|
|
||||||
MQ_APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.appPassword}" | base64 --decode; echo)
|
|
||||||
@@ -1,29 +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.
|
|
||||||
{{/* vim: set filetype=mustache: */}}
|
|
||||||
{{/*
|
|
||||||
Expand the name of the chart.
|
|
||||||
*/}}
|
|
||||||
{{- define "name" -}}
|
|
||||||
{{- default .Chart.Name .Values.nameOverride | trunc 24 | trimSuffix "-" -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{/*
|
|
||||||
Create a default fully qualified app name.
|
|
||||||
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
||||||
*/}}
|
|
||||||
{{- define "fullname" -}}
|
|
||||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
|
||||||
{{- printf "%s-%s" .Release.Name $name | trunc 24 | trimSuffix "-" -}}
|
|
||||||
{{- end -}}
|
|
||||||
@@ -1,34 +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.
|
|
||||||
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: {{ template "fullname" . }}
|
|
||||||
labels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
release: "{{ .Release.Name }}"
|
|
||||||
heritage: "{{ .Release.Service }}"
|
|
||||||
type: Opaque
|
|
||||||
data:
|
|
||||||
{{ if .Values.queueManager.dev.adminPassword }}
|
|
||||||
adminPassword: {{ .Values.queueManager.dev.adminPassword | b64enc | quote }}
|
|
||||||
{{ else }}
|
|
||||||
adminPassword: {{ randAlphaNum 10 | b64enc | quote }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if .Values.queueManager.dev.appPassword }}
|
|
||||||
appPassword: {{ .Values.queueManager.dev.appPassword | b64enc | quote }}
|
|
||||||
{{ end }}
|
|
||||||
@@ -1,126 +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.
|
|
||||||
|
|
||||||
{{- if .Capabilities.APIVersions.Has "apps/v1beta2" }}
|
|
||||||
apiVersion: apps/v1beta2
|
|
||||||
{{- else }}
|
|
||||||
apiVersion: apps/v1beta1
|
|
||||||
{{- end }}
|
|
||||||
kind: StatefulSet
|
|
||||||
metadata:
|
|
||||||
name: {{ template "fullname" . }}
|
|
||||||
labels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
release: "{{ .Release.Name }}"
|
|
||||||
heritage: "{{ .Release.Service }}"
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
serviceName: {{ .Values.service.name }}
|
|
||||||
replicas: 1
|
|
||||||
{{- if and (.Capabilities.KubeVersion.Major | hasPrefix "1") (.Capabilities.KubeVersion.Minor | hasPrefix "7") }}
|
|
||||||
# Set updateStrategy to "RollingUpdate", if we're on Kubernetes 1.7.
|
|
||||||
# It's already the default for apps/v1beta2 (Kubernetes 1.8 onwards)
|
|
||||||
updateStrategy:
|
|
||||||
type: RollingUpdate
|
|
||||||
{{- end }}
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
release: "{{ .Release.Name }}"
|
|
||||||
heritage: "{{ .Release.Service }}"
|
|
||||||
QM_IDENTIFIER: "{{ .Release.Name }}"
|
|
||||||
spec:
|
|
||||||
affinity:
|
|
||||||
nodeAffinity:
|
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
|
||||||
nodeSelectorTerms:
|
|
||||||
- matchExpressions:
|
|
||||||
- key: beta.kubernetes.io/arch
|
|
||||||
operator: In
|
|
||||||
values:
|
|
||||||
- amd64
|
|
||||||
- key: beta.kubernetes.io/os
|
|
||||||
operator: In
|
|
||||||
values:
|
|
||||||
- linux
|
|
||||||
{{- if .Values.image.pullSecret }}
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: {{ .Values.image.pullSecret }}
|
|
||||||
{{- end }}
|
|
||||||
containers:
|
|
||||||
- name: qmgr
|
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
||||||
ports:
|
|
||||||
- containerPort: 1414
|
|
||||||
- containerPort: 9443
|
|
||||||
env:
|
|
||||||
- name: LICENSE
|
|
||||||
value: {{ .Values.license }}
|
|
||||||
- name: MQ_QMGR_NAME
|
|
||||||
value: {{ .Values.queueManager.name | default .Release.Name | replace "-" "" }}
|
|
||||||
#- name: MQ_DISABLE_WEB_CONSOLE
|
|
||||||
# value: "true"
|
|
||||||
- name: MQ_ADMIN_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: {{ template "fullname" . }}
|
|
||||||
key: adminPassword
|
|
||||||
{{- if .Values.queueManager.dev.appPassword }}
|
|
||||||
- name: MQ_APP_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: {{ template "fullname" . }}
|
|
||||||
key: appPassword
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.persistence.enabled }}
|
|
||||||
volumeMounts:
|
|
||||||
- mountPath: "/mnt/mqm"
|
|
||||||
name: "{{ template "fullname" . }}-{{ .Values.dataPVC.name }}"
|
|
||||||
{{- end }}
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
{{ toYaml .Values.resources.limits | indent 14 }}
|
|
||||||
requests:
|
|
||||||
{{ toYaml .Values.resources.requests | indent 14 }}
|
|
||||||
volumeClaimTemplates:
|
|
||||||
{{- if .Values.persistence.enabled }}
|
|
||||||
- metadata:
|
|
||||||
name: "{{ template "fullname" . }}-{{ .Values.dataPVC.name }}"
|
|
||||||
labels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
release: "{{ .Release.Name }}"
|
|
||||||
heritage: "{{ .Release.Service }}"
|
|
||||||
spec:
|
|
||||||
{{- if .Values.persistence.useDynamicProvisioning }}
|
|
||||||
# If present, use the storageClassName from the values.yaml, else use the
|
|
||||||
# default storageClass setup by Kubernetes Administrator
|
|
||||||
#
|
|
||||||
# Setting storageClassName to nil means use the default storage class
|
|
||||||
storageClassName: {{ default nil .Values.dataPVC.storageClassName | quote }}
|
|
||||||
{{- else }}
|
|
||||||
# Disable dynamic provisioning
|
|
||||||
storageClassName: ""
|
|
||||||
{{- end }}
|
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: {{ .Values.dataPVC.size | quote }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,40 +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.
|
|
||||||
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Pod
|
|
||||||
metadata:
|
|
||||||
name: "{{.Release.Name}}-test"
|
|
||||||
labels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
release: "{{ .Release.Name }}"
|
|
||||||
heritage: "{{ .Release.Service }}"
|
|
||||||
annotations:
|
|
||||||
"helm.sh/hook": test-success
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: {{.Release.Name}}-test
|
|
||||||
image: alpine:latest
|
|
||||||
env:
|
|
||||||
# Host name for the service running an MQ queue manager
|
|
||||||
- name: MQ_HOST
|
|
||||||
value: {{ template "fullname" . }}
|
|
||||||
# Time to try before giving up and failing the test (in seconds)
|
|
||||||
- name: TIMEOUT
|
|
||||||
value: "10"
|
|
||||||
command: ["sh"]
|
|
||||||
# Check that port 1414 is listening
|
|
||||||
args: ["-xc", "nc -v -z -w$(TIMEOUT) $(MQ_HOST) 1414"]
|
|
||||||
restartPolicy: Never
|
|
||||||
@@ -1,176 +0,0 @@
|
|||||||
license:
|
|
||||||
__metadata:
|
|
||||||
label: "License"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
options:
|
|
||||||
- label: "Accepted"
|
|
||||||
value: "accept"
|
|
||||||
- label: "Not accepted"
|
|
||||||
value: "not accepted"
|
|
||||||
|
|
||||||
image:
|
|
||||||
__metadata:
|
|
||||||
label: "Image"
|
|
||||||
repository:
|
|
||||||
__metadata:
|
|
||||||
label: "Image repository"
|
|
||||||
description: "Docker image location"
|
|
||||||
type: "string"
|
|
||||||
immutable: false
|
|
||||||
required: true
|
|
||||||
tag:
|
|
||||||
__metadata:
|
|
||||||
label: "Image tag"
|
|
||||||
description: "Docker image tag"
|
|
||||||
type: "string"
|
|
||||||
immutable: false
|
|
||||||
required: true
|
|
||||||
pullPolicy:
|
|
||||||
__metadata:
|
|
||||||
name: "pullPolicy"
|
|
||||||
label: "Image pull policy"
|
|
||||||
description: "Always, Never, or IfNotPresent. Defaults to Always"
|
|
||||||
type: "string"
|
|
||||||
immutable: false
|
|
||||||
required: true
|
|
||||||
options:
|
|
||||||
- label: "Always"
|
|
||||||
value: "Always"
|
|
||||||
- label: "Never"
|
|
||||||
value: "Never"
|
|
||||||
- label: "IfNotPresent"
|
|
||||||
value: "IfNotPresent"
|
|
||||||
pullSecret:
|
|
||||||
__metadata:
|
|
||||||
label: "Image pull secret"
|
|
||||||
description: "Secret to use when pulling the image. Set this when using an image from a private registry"
|
|
||||||
type: "string"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
## global persistence parameters
|
|
||||||
persistence:
|
|
||||||
__metadata:
|
|
||||||
label: "Persistence"
|
|
||||||
enabled:
|
|
||||||
__metadata:
|
|
||||||
label: "Enable persistence"
|
|
||||||
description: "Whether or not to store MQ messages and configuration on a Persistent Volume"
|
|
||||||
type: "boolean"
|
|
||||||
required: true
|
|
||||||
useDynamicProvisioning:
|
|
||||||
__metadata:
|
|
||||||
label: "Use dynamic provisioning"
|
|
||||||
description: "Whether or not to use Storage Classes to provision a Persisent Volume automatically"
|
|
||||||
type: "boolean"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
dataPVC:
|
|
||||||
__metadata:
|
|
||||||
label: "Data PVC"
|
|
||||||
name:
|
|
||||||
__metadata:
|
|
||||||
label: "Name"
|
|
||||||
description: "Name of Persistent Volume Claim, used for MQ objects and messages"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
storageClassName:
|
|
||||||
__metadata:
|
|
||||||
label: "Storage Class name"
|
|
||||||
description: "Storage class of Persistent Volume Claim, used for MQ objects and messages"
|
|
||||||
type: "string"
|
|
||||||
required: false
|
|
||||||
size:
|
|
||||||
__metadata:
|
|
||||||
label: "Size"
|
|
||||||
description: "Size of Persistent Volume Claim, used for MQ objects and messages"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
service:
|
|
||||||
__metadata:
|
|
||||||
label: "Service"
|
|
||||||
name:
|
|
||||||
__metadata:
|
|
||||||
label: "Service name"
|
|
||||||
description: "Service name"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
type:
|
|
||||||
__metadata:
|
|
||||||
label: "Service type"
|
|
||||||
description: "Type of service"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
options:
|
|
||||||
- label: "ClusterIP"
|
|
||||||
value: "ClusterIP"
|
|
||||||
- label: "NodePort"
|
|
||||||
value: "NodePort"
|
|
||||||
- label: "LoadBalancer"
|
|
||||||
value: "LoadBalancer"
|
|
||||||
- label: "ExternalName"
|
|
||||||
value: "ExternalName"
|
|
||||||
|
|
||||||
resources:
|
|
||||||
__metadata:
|
|
||||||
label: "Resources"
|
|
||||||
requests:
|
|
||||||
cpu:
|
|
||||||
__metadata:
|
|
||||||
label: "CPU request"
|
|
||||||
description: "The requested CPU"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
memory:
|
|
||||||
__metadata:
|
|
||||||
label: "Memory request"
|
|
||||||
description: "The requested memory"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
limits:
|
|
||||||
cpu:
|
|
||||||
__metadata:
|
|
||||||
label: "CPU limit"
|
|
||||||
description: "The CPU limit"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
memory:
|
|
||||||
__metadata:
|
|
||||||
label: "Memory limit"
|
|
||||||
description: "The memory limit"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
queueManager:
|
|
||||||
__metadata:
|
|
||||||
label: "Queue manager"
|
|
||||||
name:
|
|
||||||
__metadata:
|
|
||||||
label: "Queue manager name"
|
|
||||||
description: "MQ queue manager name, which defaults to the Helm release name"
|
|
||||||
type: "string"
|
|
||||||
required: false
|
|
||||||
dev:
|
|
||||||
__metadata:
|
|
||||||
label: "Default Developer Configuration"
|
|
||||||
description: "Configure some queue manager basics, suitable for developer use"
|
|
||||||
adminPassword:
|
|
||||||
__metadata:
|
|
||||||
label: "Admin password"
|
|
||||||
description: "Password for 'admin' user"
|
|
||||||
type: "password"
|
|
||||||
required: false
|
|
||||||
appPassword:
|
|
||||||
__metadata:
|
|
||||||
label: "App password"
|
|
||||||
description: "Password for 'app' user to use for messaging"
|
|
||||||
type: "password"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
nameOverride:
|
|
||||||
__metadata:
|
|
||||||
label: "Name override"
|
|
||||||
description: "This can be set to partially override the name of the resources created by this chart"
|
|
||||||
type: "string"
|
|
||||||
required: false
|
|
||||||
@@ -1,68 +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.
|
|
||||||
|
|
||||||
# license must be set to "accept" to accept the terms of the IBM license
|
|
||||||
license: "not accepted"
|
|
||||||
|
|
||||||
image:
|
|
||||||
# repository is the container repository to use, which must contain IBM MQ Advanced for Developers
|
|
||||||
repository: ibmcom/mq
|
|
||||||
# tag is the tag to use for the container repository
|
|
||||||
tag: 9
|
|
||||||
# pullSecret is the secret to use when pulling the image from a private registry
|
|
||||||
pullSecret:
|
|
||||||
# pullPolicy is either IfNotPresent or Always (https://kubernetes.io/docs/concepts/containers/images/)
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
|
|
||||||
# persistence section specifies persistence settings which apply to the whole chart
|
|
||||||
persistence:
|
|
||||||
# enabled is whether to use Persistent Volumes or not
|
|
||||||
enabled: true
|
|
||||||
# useDynamicProvisioning is whether or not to use Storage Classes to dynamically create Persistent Volumes
|
|
||||||
useDynamicProvisioning: true
|
|
||||||
|
|
||||||
# dataPVC section specifies settings for the main Persistent Volume Claim, which is used for data in /var/mqm
|
|
||||||
dataPVC:
|
|
||||||
# name sets part of the name for this Persistent Volume Claim
|
|
||||||
name: "data"
|
|
||||||
## storageClassName is the name of the Storage Class to use, or an empty string for no Storage Class
|
|
||||||
storageClassName: ""
|
|
||||||
## size is the minimum size of the Persistent Volume
|
|
||||||
size: 2Gi
|
|
||||||
|
|
||||||
service:
|
|
||||||
name: qmgr
|
|
||||||
type: ClusterIP
|
|
||||||
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpu: 500m
|
|
||||||
memory: 512Mi
|
|
||||||
requests:
|
|
||||||
cpu: 500m
|
|
||||||
memory: 512Mi
|
|
||||||
|
|
||||||
# queueManager section specifies settings for the MQ Queue Manager
|
|
||||||
queueManager:
|
|
||||||
# name allows you to specify the name to use for the queue manager. Defaults to the Helm release name.
|
|
||||||
name:
|
|
||||||
# dev section specifies settings for the MQ developer defaults available in the MQ Advanced for Developers image.
|
|
||||||
dev:
|
|
||||||
# adminPassword sets the password of the admin user
|
|
||||||
adminPassword:
|
|
||||||
# appPassword sets the password of the app user
|
|
||||||
appPassword:
|
|
||||||
|
|
||||||
# nameOverride can be set to partially override the name of the resources created by this chart
|
|
||||||
nameOverride: ibm-mq
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
|||||||
License information for Ubuntu packages may be found inside the image: /usr/share/doc/${package}/copyright
|
|
||||||
@@ -1,196 +0,0 @@
|
|||||||
# IBM MQ
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
# Introduction
|
|
||||||
|
|
||||||
This chart deploys a single IBM MQ Advanced server (queue manager) into an IBM Cloud private or other Kubernetes environment.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- Kubernetes 1.6 or greater, with beta APIs enabled
|
|
||||||
- If persistence is enabled (see [configuration](#configuration)), then you either need to create a PersistentVolume, or specify a Storage Class if classes are defined in your cluster.
|
|
||||||
|
|
||||||
## Installing the Chart
|
|
||||||
|
|
||||||
To install the chart with the release name `foo`:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
helm install --name foo stable/ibm-mqadvanced-server-prod --set license=accept
|
|
||||||
```
|
|
||||||
|
|
||||||
This command accepts the [IBM MQ Advanced license](LICENSE) and deploys an MQ Advanced server on the Kubernetes cluster. The [configuration](#configuration) section lists the parameters that can be configured during installation.
|
|
||||||
|
|
||||||
> **Tip**: See all the resources deployed by the chart using `kubectl get all -l release=foo`
|
|
||||||
|
|
||||||
## Uninstalling the Chart
|
|
||||||
|
|
||||||
To uninstall/delete the `foo` release:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
helm delete foo
|
|
||||||
```
|
|
||||||
|
|
||||||
The command removes all the Kubernetes components associated with the chart, except any Persistent Volume Claims (PVCs). This is the default behavior of Kubernetes, and ensures that valuable data is not deleted. In order to delete the Queue Manager's data, you can delete the PVC using the following command:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
kubectl delete pvc -l release=foo
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
The following table lists the configurable parameters of the `ibm-mqadvanced-server-prod` chart and their default values.
|
|
||||||
|
|
||||||
| Parameter | Description | Default |
|
|
||||||
| ------------------------------- | --------------------------------------------------------------- | ------------------------------------------ |
|
|
||||||
| `license` | Set to `accept` to accept the terms of the IBM license | `"not accepted"` |
|
|
||||||
| `image.repository` | Image full name including repository | `MQ image in your registry` |
|
|
||||||
| `image.tag` | Image tag | `Tag of MQ image in your registry` |
|
|
||||||
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
|
||||||
| `image.pullSecret` | Image pull secret, if you are using a private Docker registry | `nil` |
|
|
||||||
| `persistence.enabled` | Use persistent volumes for all defined volumes | `true` |
|
|
||||||
| `persistence.useDynamicProvisioning` | Use dynamic provisioning (storage classes) for all volumes | `true` |
|
|
||||||
| `dataPVC.name` | Suffix for the PVC name | `"data"` |
|
|
||||||
| `dataPVC.storageClassName` | Storage class of volume for main MQ data (under `/var/mqm`) | `""` |
|
|
||||||
| `dataPVC.size` | Size of volume for main MQ data (under `/var/mqm`) | `2Gi` |
|
|
||||||
| `service.name` | Name of the Kubernetes service to create | `"qmgr"` |
|
|
||||||
| `service.type` | Kubernetes service type exposing ports, e.g. `NodePort` | `ClusterIP` |
|
|
||||||
| `resources.limits.cpu` | Kubernetes CPU limit for the Queue Manager container | `1` |
|
|
||||||
| `resources.limits.memory` | Kubernetes memory limit for the Queue Manager container | `1Gi` |
|
|
||||||
| `resources.requests.cpu` | Kubernetes CPU request for the Queue Manager container | `1` |
|
|
||||||
| `resources.requests.memory` | Kubernetes memory request for the Queue Manager container | `1Gi` |
|
|
||||||
| `queueManager.name` | MQ Queue Manager name | Helm release name |
|
|
||||||
| `nameOverride` | Set to partially override the resource names used in this chart | `ibm-mq` |
|
|
||||||
| `livenessProbe.initialDelaySeconds` | The initial delay before starting the liveness probe. Useful for slower systems that take longer to start the Queue Manager. | 60 |
|
|
||||||
| `livenessProbe.periodSeconds` | How often to run the probe | 10 |
|
|
||||||
| `livenessProbe.timeoutSeconds` | Number of seconds after which the probe times out | 5 |
|
|
||||||
| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded | 1 |
|
|
||||||
| `readinessProbe.initialDelaySeconds` | The initial delay before starting the readiness probe | 10 |
|
|
||||||
| `readinessProbe.periodSeconds` | How often to run the probe | 5 |
|
|
||||||
| `readinessProbe.timeoutSeconds` | Number of seconds after which the probe times out | 3 |
|
|
||||||
| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded | 1 |
|
|
||||||
|
|
||||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
|
|
||||||
|
|
||||||
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart.
|
|
||||||
|
|
||||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
|
||||||
|
|
||||||
## Persistence
|
|
||||||
|
|
||||||
The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/).
|
|
||||||
|
|
||||||
|
|
||||||
# Configuring MQ objects
|
|
||||||
You have two major options for configuring the MQ queue manager itself:
|
|
||||||
|
|
||||||
1. Use existing tools, such as `runmqsc`, MQ Explorer or the MQ Command Server to configure your queue manager directly.
|
|
||||||
2. Create a new image layer with your configuration baked-in
|
|
||||||
|
|
||||||
## Configuring MQ using existing tools
|
|
||||||
You will need to create any administrative entry point to your Queue Manager. This can be completed by either manually running kubectl commands to execute `runmqsc` and configure your entry point or creating a new image which automatically does this. At a minimum you will need to:
|
|
||||||
|
|
||||||
* Create a user with MQ administrative permissions (is a member of the `mqm` group) which you can use to log into your Queue Manager.
|
|
||||||
* Enable `ADOPTCTX` so we use the user for authorization as well as authentication when connecting a MQ Application.
|
|
||||||
* Refresh the security configuration so the new `ADOPTCTX` value becomes active
|
|
||||||
* Create a channel to use as our entrypoint.
|
|
||||||
* Create a channel authentication rule to allow access for administrative users to connect through the channel.
|
|
||||||
|
|
||||||
For the above minimum you, should execute the following commands through a shell prompt on the pod. If you choose to do this then you should replace `mquser` with your own username:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
useradd --gid mqm mquser
|
|
||||||
passwd mquser
|
|
||||||
runmqsc <QM Name>
|
|
||||||
```
|
|
||||||
|
|
||||||
Then in the `runmqsc` program, you could execute the following MQSC commands:
|
|
||||||
|
|
||||||
```
|
|
||||||
DEFINE CHANNEL('EXAMPLE.ENTRYPOINT') CHLTYPE(SVRCONN)
|
|
||||||
ALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) ADOPTCTX(YES)
|
|
||||||
REFRESH SECURITY(*) TYPE(CONNAUTH)
|
|
||||||
SET CHLAUTH('EXAMPLE.ENTRYPOINT') TYPE(BLOCKUSER) USERLIST('nobody')
|
|
||||||
```
|
|
||||||
|
|
||||||
At this point you could now connect a MQ Explorer or other remote MQ administrative client using the channel `EXAMPLE.ENTRYPOINT` and user `mquser`.
|
|
||||||
|
|
||||||
> **Tip**: If you are using a client that has a compatibility mode option for user authentication to connect to your IBM MQ Queue Manager. Make sure you have compatibility mode turned off.
|
|
||||||
|
|
||||||
## Configuring MQ using a new image layer
|
|
||||||
You can create a new container image layer, on top of the IBM MQ Advanced base image. You can add MQSC files to define MQ objects such as queues and topics, and place these files into `/etc/mqm` in your image. When the MQ pod starts, it will run any MQSC files found in this directory (in sorted order).
|
|
||||||
|
|
||||||
### Example Dockerfile and MQSC script for creating a new image
|
|
||||||
In this example you will create a Dockerfile that creates two users:
|
|
||||||
* `admin` - Administrator user which is a member of the `mqm` group
|
|
||||||
* `app` - Client application user which is a member of the `mqclient` group. (You will also create this group)
|
|
||||||
|
|
||||||
You will also create a MQSC Script file called `config.mqsc` that will be run automatically when your container starts. This script will do the following:
|
|
||||||
* Create default local queues for my applications
|
|
||||||
* Create channels for use by the `admin` and `app` users
|
|
||||||
* Configure security to allow use of the channels by remote applications
|
|
||||||
* Create authority records to allow members of the `mqclient` group to access the Queue Manager and the default local queues.
|
|
||||||
|
|
||||||
First create a file called `config.mqsc`. This the MQSC file that will be run when an MQ container starts. It should contain the following:
|
|
||||||
|
|
||||||
```
|
|
||||||
* Create Local Queues that my application(s) can use.
|
|
||||||
DEFINE QLOCAL('EXAMPLE.QUEUE.1') REPLACE
|
|
||||||
DEFINE QLOCAL('EXAMPLE.QUEUE.2') REPLACE
|
|
||||||
|
|
||||||
* Create a Dead Letter Queue for undeliverable messages and set the Queue Manager to use it.
|
|
||||||
DEFINE QLOCAL('EXAMPLE.DEAD.LETTER.QUEUE') REPLACE
|
|
||||||
ALTER QMGR DEADQ('EXAMPLE.DEAD.LETTER.QUEUE')
|
|
||||||
|
|
||||||
* Set ADOPTCTX to YES so we use the same userid passed for authentication as the one for authorization and refresh the security configuration
|
|
||||||
ALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) ADOPTCTX(YES)
|
|
||||||
REFRESH SECURITY(*) TYPE(CONNAUTH)
|
|
||||||
|
|
||||||
* Create a entry channel for the Admin user and Application user
|
|
||||||
DEFINE CHANNEL('EXAMP.ADMIN.SVRCONN') CHLTYPE(SVRCONN) REPLACE
|
|
||||||
DEFINE CHANNEL('EXAMP.APP.SVRCONN') CHLTYPE(SVRCONN) MCAUSER('app') REPLACE
|
|
||||||
|
|
||||||
* Set Channel authentication rules to only allow access through the two channels we created and only allow admin users to connect through EXAMPLE.ADMIN.SVRCONN
|
|
||||||
SET CHLAUTH('*') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(NOACCESS) DESCR('Back-stop rule - Blocks everyone') ACTION(REPLACE)
|
|
||||||
SET CHLAUTH('EXAMP.APP.SVRCONN') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(CHANNEL) DESCR('Allows connection via APP channel') ACTION(REPLACE)
|
|
||||||
SET CHLAUTH('EXAMP.ADMIN.SVRCONN') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(CHANNEL) DESCR('Allows connection via ADMIN channel') ACTION(REPLACE)
|
|
||||||
SET CHLAUTH('EXAMP.ADMIN.SVRCONN') TYPE(BLOCKUSER) USERLIST('nobody') DESCR('Allows admins on ADMIN channel') ACTION(REPLACE)
|
|
||||||
|
|
||||||
* Set Authority records to allow the members of the mqclient group to connect to the Queue Manager and access the Local Queues which start with "EXAMPLE."
|
|
||||||
SET AUTHREC OBJTYPE(QMGR) GROUP('mqclient') AUTHADD(CONNECT,INQ)
|
|
||||||
SET AUTHREC PROFILE('EXAMPLE.**') OBJTYPE(QUEUE) GROUP('mqclient') AUTHADD(INQ,PUT,GET,BROWSE)
|
|
||||||
```
|
|
||||||
|
|
||||||
Next create a `Dockerfile` that expands on the MQ Advanced Server image to create the users and groups. It should contain the following, replacing `<IMAGE NAME>` with the MQ image you want to use as a base:
|
|
||||||
|
|
||||||
```dockerfile
|
|
||||||
FROM <IMAGE NAME>
|
|
||||||
# Add the admin user as a member of the mqm group and set their password
|
|
||||||
RUN useradd admin -G mqm \
|
|
||||||
&& echo admin:passw0rd | chpasswd \
|
|
||||||
# Create the mqclient group
|
|
||||||
&& groupadd mqclient \
|
|
||||||
# Create the app user as a member of the mqclient group and set their password
|
|
||||||
&& useradd app -G mqclient \
|
|
||||||
&& echo app:passw0rd | chpasswd
|
|
||||||
# Copy the configuration script to /etc/mqm where it will be picked up automatically
|
|
||||||
COPY config.mqsc /etc/mqm/
|
|
||||||
```
|
|
||||||
|
|
||||||
Finally, build and push the image to your registry.
|
|
||||||
|
|
||||||
You can then use the new image when you deploy MQ into your cluster. You will find that once you have run the image you will be able to see your new default objects and users.
|
|
||||||
|
|
||||||
# Troubleshooting
|
|
||||||
|
|
||||||
## Cannot create a GlusterFS PersistentVolumeClaim
|
|
||||||
The generated PVC name can be too long when using GlusterFS. See [here](https://www.ibm.com/support/knowledgecenter/SSBS6K_2.1.0/troubleshoot/cannot_create_pvc.html) for more information. The PVC name is
|
|
||||||
generated from three things:
|
|
||||||
|
|
||||||
1. The Helm release name, which is set by you at deployment time
|
|
||||||
2. A short PVC label, which defaults to "data" and can be changed using the `dataPVC.name` parameter.
|
|
||||||
3. The name of the chart you are using, which can be changed using the `nameOverride` parameter.
|
|
||||||
|
|
||||||
|
|
||||||
# Copyright
|
|
||||||
|
|
||||||
© Copyright IBM Corporation 2017
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
MQ can be accessed via port 1414 on the following DNS name from within your cluster:
|
|
||||||
{{ template "fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
|
|
||||||
|
|
||||||
@@ -1,29 +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.
|
|
||||||
{{/* vim: set filetype=mustache: */}}
|
|
||||||
{{/*
|
|
||||||
Expand the name of the chart.
|
|
||||||
*/}}
|
|
||||||
{{- define "name" -}}
|
|
||||||
{{- default .Chart.Name .Values.nameOverride | trunc 24 | trimSuffix "-" -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{/*
|
|
||||||
Create a default fully qualified app name.
|
|
||||||
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
||||||
*/}}
|
|
||||||
{{- define "fullname" -}}
|
|
||||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
|
||||||
{{- printf "%s-%s" .Release.Name $name | trunc 24 | trimSuffix "-" -}}
|
|
||||||
{{- end -}}
|
|
||||||
@@ -1,129 +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.
|
|
||||||
|
|
||||||
{{- if .Capabilities.APIVersions.Has "apps/v1beta2" }}
|
|
||||||
apiVersion: apps/v1beta2
|
|
||||||
{{- else }}
|
|
||||||
apiVersion: apps/v1beta1
|
|
||||||
{{- end }}
|
|
||||||
kind: StatefulSet
|
|
||||||
metadata:
|
|
||||||
name: {{ template "fullname" . }}
|
|
||||||
labels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
release: "{{ .Release.Name }}"
|
|
||||||
heritage: "{{ .Release.Service }}"
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
serviceName: {{ .Values.service.name }}
|
|
||||||
replicas: 1
|
|
||||||
{{- if and (.Capabilities.KubeVersion.Major | hasPrefix "1") (.Capabilities.KubeVersion.Minor | hasPrefix "7") }}
|
|
||||||
# Set updateStrategy to "RollingUpdate", if we're on Kubernetes 1.7.
|
|
||||||
# It's already the default for apps/v1beta2 (Kubernetes 1.8 onwards)
|
|
||||||
updateStrategy:
|
|
||||||
type: RollingUpdate
|
|
||||||
{{- end }}
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
release: "{{ .Release.Name }}"
|
|
||||||
heritage: "{{ .Release.Service }}"
|
|
||||||
QM_IDENTIFIER: "{{ .Release.Name }}"
|
|
||||||
spec:
|
|
||||||
affinity:
|
|
||||||
nodeAffinity:
|
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
|
||||||
nodeSelectorTerms:
|
|
||||||
- matchExpressions:
|
|
||||||
- key: beta.kubernetes.io/arch
|
|
||||||
operator: In
|
|
||||||
values:
|
|
||||||
- amd64
|
|
||||||
- key: beta.kubernetes.io/os
|
|
||||||
operator: In
|
|
||||||
values:
|
|
||||||
- linux
|
|
||||||
{{- if .Values.image.pullSecret }}
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: {{ .Values.image.pullSecret }}
|
|
||||||
{{- end }}
|
|
||||||
containers:
|
|
||||||
- name: qmgr
|
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
||||||
ports:
|
|
||||||
- containerPort: 1414
|
|
||||||
env:
|
|
||||||
- name: LICENSE
|
|
||||||
value: {{ .Values.license }}
|
|
||||||
- name: MQ_QMGR_NAME
|
|
||||||
value: {{ .Values.queueManager.name | default .Release.Name | replace "-" "" }}
|
|
||||||
{{- if .Values.persistence.enabled }}
|
|
||||||
volumeMounts:
|
|
||||||
- mountPath: "/mnt/mqm"
|
|
||||||
name: "{{ template "fullname" . }}-{{ .Values.dataPVC.name }}"
|
|
||||||
{{- end }}
|
|
||||||
# Set liveness probe to determine if the queue manager is running
|
|
||||||
livenessProbe:
|
|
||||||
exec:
|
|
||||||
command:
|
|
||||||
- chkmqhealthy
|
|
||||||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
|
||||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
|
||||||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
|
||||||
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
|
||||||
# Set readiness probe to determine if the MQ listener is running
|
|
||||||
readinessProbe:
|
|
||||||
exec:
|
|
||||||
command:
|
|
||||||
- chkmqready
|
|
||||||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
|
||||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
|
||||||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
|
||||||
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
{{ toYaml .Values.resources.limits | indent 14 }}
|
|
||||||
requests:
|
|
||||||
{{ toYaml .Values.resources.requests | indent 14 }}
|
|
||||||
volumeClaimTemplates:
|
|
||||||
{{- if .Values.persistence.enabled }}
|
|
||||||
- metadata:
|
|
||||||
name: "{{ template "fullname" . }}-{{ .Values.dataPVC.name }}"
|
|
||||||
labels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
release: "{{ .Release.Name }}"
|
|
||||||
heritage: "{{ .Release.Service }}"
|
|
||||||
spec:
|
|
||||||
{{- if .Values.persistence.useDynamicProvisioning }}
|
|
||||||
## If present, use the storageClassName from the values.yaml, else use the
|
|
||||||
## default storageClass setup by Kubernetes Administrator
|
|
||||||
##
|
|
||||||
## Setting storageClassName to nil means use the default storage class
|
|
||||||
storageClassName: {{ default nil .Values.dataPVC.storageClassName | quote }}
|
|
||||||
{{- else }}
|
|
||||||
## Disable dynamic provisioning
|
|
||||||
storageClassName: ""
|
|
||||||
{{- end }}
|
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: {{ .Values.dataPVC.size | quote }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,40 +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.
|
|
||||||
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Pod
|
|
||||||
metadata:
|
|
||||||
name: "{{.Release.Name}}-test"
|
|
||||||
labels:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
release: "{{ .Release.Name }}"
|
|
||||||
heritage: "{{ .Release.Service }}"
|
|
||||||
annotations:
|
|
||||||
"helm.sh/hook": test-success
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: {{.Release.Name}}-test
|
|
||||||
image: alpine:latest
|
|
||||||
env:
|
|
||||||
# Host name for the service running an MQ queue manager
|
|
||||||
- name: MQ_HOST
|
|
||||||
value: {{ template "fullname" . }}
|
|
||||||
# Time to try before giving up and failing the test (in seconds)
|
|
||||||
- name: TIMEOUT
|
|
||||||
value: "10"
|
|
||||||
command: ["sh"]
|
|
||||||
# Check that port 1414 is listening
|
|
||||||
args: ["-xc", "nc -v -z -w$(TIMEOUT) $(MQ_HOST) 1414"]
|
|
||||||
restartPolicy: Never
|
|
||||||
@@ -1,219 +0,0 @@
|
|||||||
license:
|
|
||||||
__metadata:
|
|
||||||
label: "License"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
options:
|
|
||||||
- label: "Accepted"
|
|
||||||
value: "accept"
|
|
||||||
- label: "Not accepted"
|
|
||||||
value: "not accepted"
|
|
||||||
|
|
||||||
image:
|
|
||||||
__metadata:
|
|
||||||
label: "Image"
|
|
||||||
repository:
|
|
||||||
__metadata:
|
|
||||||
label: "Image repository"
|
|
||||||
description: "Docker image location"
|
|
||||||
type: "string"
|
|
||||||
immutable: false
|
|
||||||
required: true
|
|
||||||
tag:
|
|
||||||
__metadata:
|
|
||||||
label: "Image tag"
|
|
||||||
description: "Docker image tag"
|
|
||||||
type: "string"
|
|
||||||
immutable: false
|
|
||||||
required: true
|
|
||||||
pullPolicy:
|
|
||||||
__metadata:
|
|
||||||
name: "pullPolicy"
|
|
||||||
label: "Image pull policy"
|
|
||||||
description: "Always, Never, or IfNotPresent. Defaults to Always"
|
|
||||||
type: "string"
|
|
||||||
immutable: false
|
|
||||||
required: true
|
|
||||||
options:
|
|
||||||
- label: "Always"
|
|
||||||
value: "Always"
|
|
||||||
- label: "Never"
|
|
||||||
value: "Never"
|
|
||||||
- label: "IfNotPresent"
|
|
||||||
value: "IfNotPresent"
|
|
||||||
pullSecret:
|
|
||||||
__metadata:
|
|
||||||
label: "Image pull secret"
|
|
||||||
description: "Secret to use when pulling the image. Set this when using an image from a private registry"
|
|
||||||
type: "string"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
## global persistence parameters
|
|
||||||
persistence:
|
|
||||||
__metadata:
|
|
||||||
label: "Persistence"
|
|
||||||
enabled:
|
|
||||||
__metadata:
|
|
||||||
label: "Enable persistence"
|
|
||||||
description: "Whether or not to store MQ messages and configuration on a Persistent Volume"
|
|
||||||
type: "boolean"
|
|
||||||
required: true
|
|
||||||
useDynamicProvisioning:
|
|
||||||
__metadata:
|
|
||||||
label: "Use dynamic provisioning"
|
|
||||||
description: "Whether or not to use Storage Classes to provision a Persisent Volume automatically"
|
|
||||||
type: "boolean"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
dataPVC:
|
|
||||||
__metadata:
|
|
||||||
label: "Data PVC"
|
|
||||||
name:
|
|
||||||
__metadata:
|
|
||||||
label: "Name"
|
|
||||||
description: "Name of Persistent Volume Claim, used for MQ objects and messages"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
storageClassName:
|
|
||||||
__metadata:
|
|
||||||
label: "Storage Class name"
|
|
||||||
description: "Storage class of Persistent Volume Claim, used for MQ objects and messages"
|
|
||||||
type: "string"
|
|
||||||
required: false
|
|
||||||
size:
|
|
||||||
__metadata:
|
|
||||||
label: "Size"
|
|
||||||
description: "Size of Persistent Volume Claim, used for MQ objects and messages"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
service:
|
|
||||||
__metadata:
|
|
||||||
label: "Service"
|
|
||||||
name:
|
|
||||||
__metadata:
|
|
||||||
label: "Service name"
|
|
||||||
description: "Service name"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
type:
|
|
||||||
__metadata:
|
|
||||||
label: "Service type"
|
|
||||||
description: "Type of service"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
options:
|
|
||||||
- label: "ClusterIP"
|
|
||||||
value: "ClusterIP"
|
|
||||||
- label: "NodePort"
|
|
||||||
value: "NodePort"
|
|
||||||
- label: "LoadBalancer"
|
|
||||||
value: "LoadBalancer"
|
|
||||||
- label: "ExternalName"
|
|
||||||
value: "ExternalName"
|
|
||||||
|
|
||||||
resources:
|
|
||||||
__metadata:
|
|
||||||
label: "Resources"
|
|
||||||
requests:
|
|
||||||
cpu:
|
|
||||||
__metadata:
|
|
||||||
label: "CPU request"
|
|
||||||
description: "The requested CPU"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
memory:
|
|
||||||
__metadata:
|
|
||||||
label: "Memory request"
|
|
||||||
description: "The requested memory"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
limits:
|
|
||||||
cpu:
|
|
||||||
__metadata:
|
|
||||||
label: "CPU limit"
|
|
||||||
description: "The CPU limit"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
memory:
|
|
||||||
__metadata:
|
|
||||||
label: "Memory limit"
|
|
||||||
description: "The memory limit"
|
|
||||||
type: "string"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
queueManager:
|
|
||||||
__metadata:
|
|
||||||
label: "Queue manager"
|
|
||||||
name:
|
|
||||||
__metadata:
|
|
||||||
label: "Queue manager name"
|
|
||||||
description: "MQ queue manager name, which defaults to the Helm release name"
|
|
||||||
type: "string"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
nameOverride:
|
|
||||||
__metadata:
|
|
||||||
label: "Name override"
|
|
||||||
description: "This can be set to partially override the name of the resources created by this chart"
|
|
||||||
type: "string"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
# livenessProbe section specifies setting for the MQ liveness probe, which checks for a running Queue Manager
|
|
||||||
livenessProbe:
|
|
||||||
__metadata:
|
|
||||||
label: "Liveness probe"
|
|
||||||
# initialDelaySeconds should be raised if your system cannot start the Queue Manager in 60 seconds
|
|
||||||
initialDelaySeconds:
|
|
||||||
__metadata:
|
|
||||||
label: "Initial delay (seconds)"
|
|
||||||
description: "How long to wait before starting the probe. Raise this delay if your system cannot start the Queue Manager in the default time period"
|
|
||||||
type: "number"
|
|
||||||
required: false
|
|
||||||
periodSeconds:
|
|
||||||
__metadata:
|
|
||||||
label: "Period (seconds)"
|
|
||||||
description: "How often to perform the probe"
|
|
||||||
type: "number"
|
|
||||||
required: false
|
|
||||||
timeoutSeconds:
|
|
||||||
__metadata:
|
|
||||||
label: "Timeout (seconds)"
|
|
||||||
description: "How long before a probe times out"
|
|
||||||
type: "number"
|
|
||||||
required: false
|
|
||||||
failureThreshold:
|
|
||||||
__metadata:
|
|
||||||
label: "Failure threshold"
|
|
||||||
description: "Number of times the probe can fail before taking action"
|
|
||||||
type: "number"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
# readinessProbe section specifies setting for the MQ readiness probe, which checks when the MQ listener is running
|
|
||||||
readinessProbe:
|
|
||||||
__metadata:
|
|
||||||
label: "Readiness probe"
|
|
||||||
initialDelaySeconds:
|
|
||||||
__metadata:
|
|
||||||
label: "Initial delay (seconds)"
|
|
||||||
description: "How long to wait before starting the probe"
|
|
||||||
type: "number"
|
|
||||||
required: false
|
|
||||||
periodSeconds:
|
|
||||||
__metadata:
|
|
||||||
label: "Period (seconds)"
|
|
||||||
description: "How often to perform the probe"
|
|
||||||
type: "number"
|
|
||||||
required: false
|
|
||||||
timeoutSeconds:
|
|
||||||
__metadata:
|
|
||||||
label: "Timeout (seconds)"
|
|
||||||
description: "How long before a probe times out"
|
|
||||||
type: "number"
|
|
||||||
required: false
|
|
||||||
failureThreshold:
|
|
||||||
__metadata:
|
|
||||||
label: "Failure threshold"
|
|
||||||
description: "Number of times the probe can fail before taking action"
|
|
||||||
type: "number"
|
|
||||||
required: false
|
|
||||||
@@ -1,77 +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.
|
|
||||||
|
|
||||||
# license must be set to "accept" to accept the terms of the IBM license
|
|
||||||
license: "not accepted"
|
|
||||||
|
|
||||||
image:
|
|
||||||
# repository is the container repository to use, which must contain IBM MQ Advanced
|
|
||||||
repository: ibm-mqadvanced-server
|
|
||||||
# tag is the tag to use for the container repository
|
|
||||||
tag: 9.0.4.0-x86_64
|
|
||||||
# pullSecret is the secret to use when pulling the image from a private registry
|
|
||||||
pullSecret:
|
|
||||||
# pullPolicy is either IfNotPresent or Always (https://kubernetes.io/docs/concepts/containers/images/)
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
|
|
||||||
# persistence section specifies persistence settings which apply to the whole chart
|
|
||||||
persistence:
|
|
||||||
# enabled is whether to use Persistent Volumes or not
|
|
||||||
enabled: true
|
|
||||||
# useDynamicProvisioning is whether or not to use Storage Classes to dynamically create Persistent Volumes
|
|
||||||
useDynamicProvisioning: true
|
|
||||||
|
|
||||||
# dataPVC section specifies settings for the main Persistent Volume Claim, which is used for data in /var/mqm
|
|
||||||
dataPVC:
|
|
||||||
# name sets part of the name for this Persistent Volume Claim
|
|
||||||
name: "data"
|
|
||||||
# storageClassName is the name of the Storage Class to use, or an empty string for no Storage Class
|
|
||||||
storageClassName: ""
|
|
||||||
# size is the minimum size of the Persistent Volume
|
|
||||||
size: 2Gi
|
|
||||||
|
|
||||||
service:
|
|
||||||
name: qmgr
|
|
||||||
type: ClusterIP
|
|
||||||
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpu: 1
|
|
||||||
memory: 1Gi
|
|
||||||
requests:
|
|
||||||
cpu: 1
|
|
||||||
memory: 1Gi
|
|
||||||
|
|
||||||
# queueManager section specifies settings for the MQ Queue Manager
|
|
||||||
queueManager:
|
|
||||||
# name allows you to specify the name to use for the queue manager. Defaults to the Helm release name.
|
|
||||||
name:
|
|
||||||
|
|
||||||
# nameOverride can be set to partially override the name of the resources created by this chart
|
|
||||||
nameOverride: ibm-mq
|
|
||||||
|
|
||||||
# livenessProbe section specifies setting for the MQ liveness probe, which checks for a running Queue Manager
|
|
||||||
livenessProbe:
|
|
||||||
# initialDelaySeconds should be raised if your system cannot start the Queue Manager in 60 seconds
|
|
||||||
initialDelaySeconds: 60
|
|
||||||
periodSeconds: 10
|
|
||||||
timeoutSeconds: 5
|
|
||||||
failureThreshold: 1
|
|
||||||
|
|
||||||
# readinessProbe section specifies setting for the MQ readiness probe, which checks when the MQ listener is running
|
|
||||||
readinessProbe:
|
|
||||||
initialDelaySeconds: 10
|
|
||||||
periodSeconds: 5
|
|
||||||
timeoutSeconds: 3
|
|
||||||
failureThreshold: 1
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
© Copyright IBM Corporation 2017
|
© Copyright IBM Corporation 2017, 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.
|
||||||
@@ -32,6 +32,7 @@ func queueManagerHealthy() (bool, error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
// Specify the queue manager name, just in case someone's created a second queue manager
|
// Specify the queue manager name, just in case someone's created a second queue manager
|
||||||
|
// #nosec G204
|
||||||
cmd := exec.Command("dspmq", "-n", "-m", name)
|
cmd := exec.Command("dspmq", "-n", "-m", name)
|
||||||
// Run the command and wait for completion
|
// Run the command and wait for completion
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
@@ -39,8 +40,8 @@ func queueManagerHealthy() (bool, error) {
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
fmt.Println(out)
|
fmt.Printf("%s", out)
|
||||||
if !strings.Contains(string(out), "(RUNNING)") {
|
if !strings.Contains(string(out), "(RUNNING)") && !strings.Contains(string(out), "(RUNNING AS STANDBY)") && !strings.Contains(string(out), "(STARTING)") {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
© Copyright IBM Corporation 2017, 2018
|
© Copyright IBM Corporation 2017, 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.
|
||||||
@@ -22,6 +22,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/name"
|
||||||
"github.com/ibm-messaging/mq-container/internal/ready"
|
"github.com/ibm-messaging/mq-container/internal/ready"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,11 +32,25 @@ func main() {
|
|||||||
if !r || err != nil {
|
if !r || err != nil {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
// Check if the queue manager has a running listener
|
name, err := name.GetQueueManagerName()
|
||||||
conn, err := net.Dial("tcp", "127.0.0.1:1414")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
conn.Close()
|
|
||||||
|
// Check if the queue manager has a running listener
|
||||||
|
if standby, _ := ready.IsRunningAsStandbyQM(name); !standby {
|
||||||
|
conn, err := net.Dial("tcp", "127.0.0.1:1414")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
err = conn.Close()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Printf("Detected queue manager running in standby mode")
|
||||||
|
os.Exit(10)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -23,23 +23,30 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/ibm-messaging/mq-container/internal/command"
|
"github.com/ibm-messaging/mq-container/internal/command"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/containerruntimelogger"
|
||||||
"github.com/ibm-messaging/mq-container/internal/logger"
|
"github.com/ibm-messaging/mq-container/internal/logger"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/mqtemplate"
|
||||||
"github.com/ibm-messaging/mq-container/internal/name"
|
"github.com/ibm-messaging/mq-container/internal/name"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log *logger.Logger
|
var log *logger.Logger
|
||||||
|
|
||||||
func setPassword(user string, password string) error {
|
func setPassword(user string, password string) error {
|
||||||
cmd := exec.Command("chpasswd")
|
// #nosec G204
|
||||||
|
cmd := exec.Command("sudo", "chpasswd")
|
||||||
stdin, err := cmd.StdinPipe()
|
stdin, err := cmd.StdinPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(stdin, "%s:%s", user, password)
|
fmt.Fprintf(stdin, "%s:%s", user, password)
|
||||||
stdin.Close()
|
err = stdin.Close()
|
||||||
_, _, err = command.RunCmd(cmd)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
log.Errorf("Error closing password stdin: %v", err)
|
||||||
|
}
|
||||||
|
out, _, err := command.RunCmd(cmd)
|
||||||
|
if err != nil {
|
||||||
|
// Include the command output in the error
|
||||||
|
return fmt.Errorf("%v: %v", err.Error(), out)
|
||||||
}
|
}
|
||||||
log.Printf("Set password for \"%v\" user", user)
|
log.Printf("Set password for \"%v\" user", user)
|
||||||
return nil
|
return nil
|
||||||
@@ -83,17 +90,22 @@ func configureLogger() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func configureWeb(qmName string) error {
|
||||||
|
out := "/etc/mqm/web/installations/Installation1/angular.persistence/admin.json"
|
||||||
|
return mqtemplate.ProcessTemplateFile("/etc/mqm/admin.json.tpl", out, map[string]string{"QueueManagerName": qmName}, log)
|
||||||
|
}
|
||||||
|
|
||||||
func logTerminationf(format string, args ...interface{}) {
|
func logTerminationf(format string, args ...interface{}) {
|
||||||
logTermination(fmt.Sprintf(format, args))
|
logTermination(fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Duplicated code
|
// TODO: Duplicated code
|
||||||
func logTermination(args ...interface{}) {
|
func logTermination(args ...interface{}) {
|
||||||
msg := fmt.Sprint(args)
|
msg := fmt.Sprint(args...)
|
||||||
// Write the message to the termination log. This is the default place
|
// Write the message to the termination log. This is not the default place
|
||||||
// that Kubernetes will look for termination information.
|
// that Kubernetes will look for termination information.
|
||||||
log.Debugf("Writing termination message: %v", msg)
|
log.Debugf("Writing termination message: %v", msg)
|
||||||
err := ioutil.WriteFile("/dev/termination-log", []byte(msg), 0660)
|
err := ioutil.WriteFile("/run/termination-log", []byte(msg), 0660)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug(err)
|
log.Debug(err)
|
||||||
}
|
}
|
||||||
@@ -106,6 +118,13 @@ func doMain() error {
|
|||||||
logTermination(err)
|
logTermination(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = containerruntimelogger.LogContainerDetails(log)
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
adminPassword, set := os.LookupEnv("MQ_ADMIN_PASSWORD")
|
adminPassword, set := os.LookupEnv("MQ_ADMIN_PASSWORD")
|
||||||
if set {
|
if set {
|
||||||
err = setPassword("admin", adminPassword)
|
err = setPassword("admin", adminPassword)
|
||||||
@@ -129,6 +148,18 @@ func doMain() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name, err := name.GetQueueManagerName()
|
||||||
|
if err != nil {
|
||||||
|
logTerminationf("Error getting queue manager name: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = configureWeb(name)
|
||||||
|
if err != nil {
|
||||||
|
logTermination("Error configuring admin.json")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,6 +171,10 @@ func main() {
|
|||||||
osExit(1)
|
osExit(1)
|
||||||
} else {
|
} else {
|
||||||
// Replace this process with runmqserver
|
// Replace this process with runmqserver
|
||||||
syscall.Exec("/usr/local/bin/runmqserver", []string{"runmqserver"}, os.Environ())
|
// #nosec G204
|
||||||
|
err = syscall.Exec("/usr/local/bin/runmqserver", []string{"runmqserver", "-dev"}, os.Environ())
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Error replacing this process with runmqserver: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,8 +16,9 @@ limitations under the License.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"html/template"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/mqtemplate"
|
||||||
)
|
)
|
||||||
|
|
||||||
func updateMQSC(appPasswordRequired bool) error {
|
func updateMQSC(appPasswordRequired bool) error {
|
||||||
@@ -27,31 +28,23 @@ func updateMQSC(appPasswordRequired bool) error {
|
|||||||
} else {
|
} else {
|
||||||
checkClient = "ASQMGR"
|
checkClient = "ASQMGR"
|
||||||
}
|
}
|
||||||
const mqsc string = "/etc/mqm/dev.mqsc"
|
const mqsc string = "/etc/mqm/10-dev.mqsc"
|
||||||
if os.Getenv("MQ_DEV") == "true" {
|
if os.Getenv("MQ_DEV") == "true" {
|
||||||
const mqscTemplate string = mqsc + ".tpl"
|
const mqscTemplate string = mqsc + ".tpl"
|
||||||
// Re-configure channel if app password not set
|
// Re-configure channel if app password not set
|
||||||
t, err := template.ParseFiles(mqscTemplate)
|
err := mqtemplate.ProcessTemplateFile(mqsc+".tpl", mqsc, map[string]string{"ChckClnt": checkClient}, log)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
f, err := os.OpenFile(mqsc, os.O_CREATE|os.O_WRONLY, 0660)
|
|
||||||
defer f.Close()
|
|
||||||
err = t.Execute(f, map[string]string{"ChckClnt": checkClient})
|
|
||||||
if err != nil {
|
|
||||||
log.Error(err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
// TODO: Lookup value for MQM user here?
|
|
||||||
err = os.Chown(mqsc, 999, 999)
|
|
||||||
if err != nil {
|
|
||||||
log.Error(err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
// os.Remove(mqscTemplate)
|
|
||||||
} else {
|
} else {
|
||||||
os.Remove(mqsc)
|
_, err := os.Stat(mqsc)
|
||||||
|
if !os.IsNotExist(err) {
|
||||||
|
err = os.Remove(mqsc)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Error removing file %s: %v", mqsc, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
© Copyright IBM Corporation 2017, 2018
|
© Copyright IBM Corporation 2017, 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.
|
||||||
@@ -17,34 +17,17 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/command"
|
||||||
)
|
)
|
||||||
|
|
||||||
func lookupMQM() (int, int, error) {
|
func createVolume(dataPath string) error {
|
||||||
mqm, err := user.Lookup("mqm")
|
|
||||||
if err != nil {
|
|
||||||
return -1, -1, err
|
|
||||||
}
|
|
||||||
mqmUID, err := strconv.Atoi(mqm.Uid)
|
|
||||||
if err != nil {
|
|
||||||
return -1, -1, err
|
|
||||||
}
|
|
||||||
mqmGID, err := strconv.Atoi(mqm.Gid)
|
|
||||||
if err != nil {
|
|
||||||
return -1, -1, err
|
|
||||||
}
|
|
||||||
return mqmUID, mqmGID, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func createVolume(path string) error {
|
|
||||||
dataPath := filepath.Join(path, "data")
|
|
||||||
fi, err := os.Stat(dataPath)
|
fi, err := os.Stat(dataPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
// #nosec G301
|
||||||
err = os.MkdirAll(dataPath, 0755)
|
err = os.MkdirAll(dataPath, 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -60,7 +43,7 @@ func createVolume(path string) error {
|
|||||||
sys := fi.Sys()
|
sys := fi.Sys()
|
||||||
if sys != nil && runtime.GOOS == "linux" {
|
if sys != nil && runtime.GOOS == "linux" {
|
||||||
stat := sys.(*syscall.Stat_t)
|
stat := sys.(*syscall.Stat_t)
|
||||||
mqmUID, mqmGID, err := lookupMQM()
|
mqmUID, mqmGID, err := command.LookupMQM()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ func checkLicense() (bool, error) {
|
|||||||
return true, nil
|
return true, nil
|
||||||
case ok && lic == "view":
|
case ok && lic == "view":
|
||||||
file := filepath.Join("/opt/mqm/licenses", resolveLicenseFile())
|
file := filepath.Join("/opt/mqm/licenses", resolveLicenseFile())
|
||||||
|
// #nosec G304
|
||||||
buf, err := ioutil.ReadFile(file)
|
buf, err := ioutil.ReadFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
© Copyright IBM Corporation 2017, 2018
|
© Copyright IBM Corporation 2017, 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.
|
||||||
@@ -21,9 +21,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/command"
|
||||||
"github.com/ibm-messaging/mq-container/internal/logger"
|
"github.com/ibm-messaging/mq-container/internal/logger"
|
||||||
"github.com/ibm-messaging/mq-container/internal/mqini"
|
"github.com/ibm-messaging/mq-container/internal/mqini"
|
||||||
)
|
)
|
||||||
@@ -31,28 +34,26 @@ import (
|
|||||||
// var debug = false
|
// var debug = false
|
||||||
var log *logger.Logger
|
var log *logger.Logger
|
||||||
|
|
||||||
func logDebug(args ...interface{}) {
|
var collectDiagOnFail = false
|
||||||
log.Debug(args)
|
|
||||||
}
|
|
||||||
|
|
||||||
func logDebugf(format string, args ...interface{}) {
|
|
||||||
log.Debugf(format, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func logTerminationf(format string, args ...interface{}) {
|
func logTerminationf(format string, args ...interface{}) {
|
||||||
logTermination(fmt.Sprintf(format, args))
|
logTermination(fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func logTermination(args ...interface{}) {
|
func logTermination(args ...interface{}) {
|
||||||
msg := fmt.Sprint(args)
|
msg := fmt.Sprint(args...)
|
||||||
// Write the message to the termination log. This is the default place
|
// Write the message to the termination log. This is not the default place
|
||||||
// that Kubernetes will look for termination information.
|
// that Kubernetes will look for termination information.
|
||||||
log.Debugf("Writing termination message: %v", msg)
|
log.Debugf("Writing termination message: %v", msg)
|
||||||
err := ioutil.WriteFile("/dev/termination-log", []byte(msg), 0660)
|
err := ioutil.WriteFile("/run/termination-log", []byte(msg), 0660)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug(err)
|
log.Debug(err)
|
||||||
}
|
}
|
||||||
log.Error(msg)
|
log.Error(msg)
|
||||||
|
|
||||||
|
if collectDiagOnFail {
|
||||||
|
logDiagnostics()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getLogFormat() string {
|
func getLogFormat() string {
|
||||||
@@ -66,7 +67,7 @@ func formatSimple(datetime string, message string) string {
|
|||||||
// mirrorSystemErrorLogs starts a goroutine to mirror the contents of the MQ system error logs
|
// mirrorSystemErrorLogs starts a goroutine to mirror the contents of the MQ system error logs
|
||||||
func mirrorSystemErrorLogs(ctx context.Context, wg *sync.WaitGroup, mf mirrorFunc) (chan error, error) {
|
func mirrorSystemErrorLogs(ctx context.Context, wg *sync.WaitGroup, mf mirrorFunc) (chan error, error) {
|
||||||
// Always use the JSON log as the source
|
// Always use the JSON log as the source
|
||||||
return mirrorLog(ctx, wg, "/var/mqm/errors/AMQERR01.json", false, mf)
|
return mirrorLog(ctx, wg, "/var/mqm/errors/AMQERR01.json", false, mf, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// mirrorQueueManagerErrorLogs starts a goroutine to mirror the contents of the MQ queue manager error logs
|
// mirrorQueueManagerErrorLogs starts a goroutine to mirror the contents of the MQ queue manager error logs
|
||||||
@@ -74,11 +75,11 @@ func mirrorQueueManagerErrorLogs(ctx context.Context, wg *sync.WaitGroup, name s
|
|||||||
// Always use the JSON log as the source
|
// Always use the JSON log as the source
|
||||||
qm, err := mqini.GetQueueManager(name)
|
qm, err := mqini.GetQueueManager(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logDebug(err)
|
log.Debug(err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
f := filepath.Join(mqini.GetErrorLogDirectory(qm), "AMQERR01.json")
|
f := filepath.Join(mqini.GetErrorLogDirectory(qm), "AMQERR01.json")
|
||||||
return mirrorLog(ctx, wg, f, fromStart, mf)
|
return mirrorLog(ctx, wg, f, fromStart, mf, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDebug() bool {
|
func getDebug() bool {
|
||||||
@@ -99,17 +100,35 @@ func configureLogger(name string) (mirrorFunc, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return log.LogDirect, nil
|
return func(msg string, isQMLog bool) bool {
|
||||||
|
obj, err := processLogMessage(msg)
|
||||||
|
if err == nil && isQMLog && filterQMLogMessage(obj) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed to unmarshall JSON - %v", msg)
|
||||||
|
} else {
|
||||||
|
fmt.Println(msg)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}, nil
|
||||||
case "basic":
|
case "basic":
|
||||||
log, err = logger.NewLogger(os.Stderr, d, false, name)
|
log, err = logger.NewLogger(os.Stderr, d, false, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return func(msg string) {
|
return func(msg string, isQMLog bool) bool {
|
||||||
// Parse the JSON message, and print a simplified version
|
// Parse the JSON message, and print a simplified version
|
||||||
var obj map[string]interface{}
|
obj, err := processLogMessage(msg)
|
||||||
json.Unmarshal([]byte(msg), &obj)
|
if err == nil && isQMLog && filterQMLogMessage(obj) {
|
||||||
fmt.Printf(formatSimple(obj["ibm_datetime"].(string), obj["message"].(string)))
|
return false
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed to unmarshall JSON - %v", err)
|
||||||
|
} else {
|
||||||
|
fmt.Printf(formatSimple(obj["ibm_datetime"].(string), obj["message"].(string)))
|
||||||
|
}
|
||||||
|
return true
|
||||||
}, nil
|
}, nil
|
||||||
default:
|
default:
|
||||||
log, err = logger.NewLogger(os.Stdout, d, false, name)
|
log, err = logger.NewLogger(os.Stdout, d, false, name)
|
||||||
@@ -119,3 +138,57 @@ func configureLogger(name string) (mirrorFunc, error) {
|
|||||||
return nil, fmt.Errorf("invalid value for LOG_FORMAT: %v", f)
|
return nil, fmt.Errorf("invalid value for LOG_FORMAT: %v", f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func processLogMessage(msg string) (map[string]interface{}, error) {
|
||||||
|
var obj map[string]interface{}
|
||||||
|
err := json.Unmarshal([]byte(msg), &obj)
|
||||||
|
return obj, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func filterQMLogMessage(obj map[string]interface{}) bool {
|
||||||
|
hostname, err := os.Hostname()
|
||||||
|
if os.Getenv("MQ_MULTI_INSTANCE") == "true" && err == nil && !strings.Contains(obj["host"].(string), hostname) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func logDiagnostics() {
|
||||||
|
log.Debug("--- Start Diagnostics ---")
|
||||||
|
|
||||||
|
// show the directory ownership/permissions
|
||||||
|
// #nosec G104
|
||||||
|
out, _, _ := command.Run("ls", "-l", "/mnt/")
|
||||||
|
log.Debugf("/mnt/:\n%s", out)
|
||||||
|
// #nosec G104
|
||||||
|
out, _, _ = command.Run("ls", "-l", "/mnt/mqm")
|
||||||
|
log.Debugf("/mnt/mqm:\n%s", out)
|
||||||
|
// #nosec G104
|
||||||
|
out, _, _ = command.Run("ls", "-l", "/mnt/mqm/data")
|
||||||
|
log.Debugf("/mnt/mqm/data:\n%s", out)
|
||||||
|
// #nosec G104
|
||||||
|
out, _, _ = command.Run("ls", "-l", "/mnt/mqm-log/log")
|
||||||
|
log.Debugf("/mnt/mqm-log/log:\n%s", out)
|
||||||
|
// #nosec G104
|
||||||
|
out, _, _ = command.Run("ls", "-l", "/mnt/mqm-data/qmgrs")
|
||||||
|
log.Debugf("/mnt/mqm-data/qmgrs:\n%s", out)
|
||||||
|
// #nosec G104
|
||||||
|
out, _, _ = command.Run("ls", "-l", "/var/mqm")
|
||||||
|
log.Debugf("/var/mqm:\n%s", out)
|
||||||
|
// #nosec G104
|
||||||
|
out, _, _ = command.Run("ls", "-l", "/var/mqm/errors")
|
||||||
|
log.Debugf("/var/mqm/errors:\n%s", out)
|
||||||
|
// #nosec G104
|
||||||
|
out, _, _ = command.Run("ls", "-l", "/etc/mqm")
|
||||||
|
log.Debugf("/etc/mqm:\n%s", out)
|
||||||
|
|
||||||
|
// Print out summary of any FDCs
|
||||||
|
// #nosec G204
|
||||||
|
cmd := exec.Command("/opt/mqm/bin/ffstsummary")
|
||||||
|
cmd.Dir = "/var/mqm/errors"
|
||||||
|
// #nosec G104
|
||||||
|
outB, _ := cmd.CombinedOutput()
|
||||||
|
log.Debugf("ffstsummary:\n%s", string(outB))
|
||||||
|
|
||||||
|
log.Debug("--- End Diagnostics ---")
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
© Copyright IBM Corporation 2017, 2018
|
© Copyright IBM Corporation 2017, 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.
|
||||||
@@ -20,20 +20,47 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"flag"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/containerruntimelogger"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/metrics"
|
||||||
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
func doMain() error {
|
func doMain() error {
|
||||||
|
var initFlag = flag.Bool("i", false, "initialize volume only, then exit")
|
||||||
|
var infoFlag = flag.Bool("info", false, "Display debug info, then exit")
|
||||||
|
var devFlag = flag.Bool("dev", false, "used when running this program from runmqdevserver to control log output")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
name, nameErr := name.GetQueueManagerName()
|
name, nameErr := name.GetQueueManagerName()
|
||||||
mf, err := configureLogger(name)
|
mf, err := configureLogger(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logTermination(err)
|
logTermination(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check whether they only want debug info
|
||||||
|
if *infoFlag {
|
||||||
|
logVersionInfo()
|
||||||
|
err = containerruntimelogger.LogContainerDetails(log)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error displaying container details: %v", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
err = verifySingleProcess()
|
||||||
|
if err != nil {
|
||||||
|
// We don't do the normal termination here as it would create a termination file.
|
||||||
|
log.Error(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if nameErr != nil {
|
if nameErr != nil {
|
||||||
logTermination(err)
|
logTermination(err)
|
||||||
return err
|
return err
|
||||||
@@ -57,20 +84,60 @@ func doMain() error {
|
|||||||
|
|
||||||
// Start signal handler
|
// Start signal handler
|
||||||
signalControl := signalHandler(name)
|
signalControl := signalHandler(name)
|
||||||
|
// Enable diagnostic collecting on failure
|
||||||
|
collectDiagOnFail = true
|
||||||
|
|
||||||
logConfig()
|
if *devFlag == false {
|
||||||
err = createVolume("/mnt/mqm")
|
err = containerruntimelogger.LogContainerDetails(log)
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = createVolume("/mnt/mqm/data")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logTermination(err)
|
logTermination(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
err = createVolume("/mnt/mqm-log/log")
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = createVolume("/mnt/mqm-data/qmgrs")
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
err = createDirStructure()
|
err = createDirStructure()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logTermination(err)
|
logTermination(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = postInit(name)
|
// If init flag is set, exit now
|
||||||
|
if *initFlag {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print out versioning information
|
||||||
|
logVersionInfo()
|
||||||
|
|
||||||
|
keylabel, cmsDB, p12Trust, _, err := tls.ConfigureTLSKeystores(keyDir, trustDir, keyStoreDir)
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = configureTLS(keylabel, cmsDB, *devFlag)
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = postInit(name, keylabel, p12Trust)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logTermination(err)
|
logTermination(err)
|
||||||
return err
|
return err
|
||||||
@@ -107,12 +174,26 @@ func doMain() error {
|
|||||||
logTermination(err)
|
logTermination(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = startQueueManager()
|
err = startQueueManager(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logTermination(err)
|
logTermination(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
configureQueueManager()
|
if standby, _ := ready.IsRunningAsStandbyQM(name); !standby {
|
||||||
|
err = configureQueueManager()
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enableMetrics := os.Getenv("MQ_ENABLE_METRICS")
|
||||||
|
if enableMetrics == "true" || enableMetrics == "1" {
|
||||||
|
go metrics.GatherMetrics(name, log)
|
||||||
|
} else {
|
||||||
|
log.Println("Metrics are disabled")
|
||||||
|
}
|
||||||
|
|
||||||
// Start reaping zombies from now on.
|
// Start reaping zombies from now on.
|
||||||
// Start this here, so that we don't reap any sub-processes created
|
// Start this here, so that we don't reap any sub-processes created
|
||||||
// by this process (e.g. for crtmqm or strmqm)
|
// by this process (e.g. for crtmqm or strmqm)
|
||||||
@@ -120,7 +201,11 @@ func doMain() error {
|
|||||||
// Reap zombies now, just in case we've already got some
|
// Reap zombies now, just in case we've already got some
|
||||||
signalControl <- reapNow
|
signalControl <- reapNow
|
||||||
// Write a file to indicate that chkmqready should now work as normal
|
// Write a file to indicate that chkmqready should now work as normal
|
||||||
ready.Set()
|
err = ready.Set()
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
// Wait for terminate signal
|
// Wait for terminate signal
|
||||||
<-signalControl
|
<-signalControl
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -27,8 +28,6 @@ import (
|
|||||||
|
|
||||||
var test *bool
|
var test *bool
|
||||||
|
|
||||||
const filename = "/var/coverage/exitCode"
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
test = flag.Bool("test", false, "Set to true when running tests for coverage")
|
test = flag.Bool("test", false, "Set to true when running tests for coverage")
|
||||||
log, _ = logger.NewLogger(os.Stdout, true, false, "test")
|
log, _ = logger.NewLogger(os.Stdout, true, false, "test")
|
||||||
@@ -41,6 +40,14 @@ func TestSystem(t *testing.T) {
|
|||||||
defer func() {
|
defer func() {
|
||||||
osExit = oldExit
|
osExit = oldExit
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
filename, ok := os.LookupEnv("EXIT_CODE_FILE")
|
||||||
|
if !ok {
|
||||||
|
filename = "/var/coverage/exitCode"
|
||||||
|
} else {
|
||||||
|
filename = filepath.Join("/var/coverage/", filename)
|
||||||
|
}
|
||||||
|
|
||||||
osExit = func(rc int) {
|
osExit = func(rc int) {
|
||||||
// Write the exit code to a file instead
|
// Write the exit code to a file instead
|
||||||
log.Printf("Writing exit code %v to file %v", strconv.Itoa(rc), filename)
|
log.Printf("Writing exit code %v to file %v", strconv.Itoa(rc), filename)
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -33,7 +33,7 @@ func waitForFile(ctx context.Context, path string) (os.FileInfo, error) {
|
|||||||
select {
|
select {
|
||||||
// Check to see if cancellation has been requested
|
// Check to see if cancellation has been requested
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil, nil
|
return os.Stat(path)
|
||||||
default:
|
default:
|
||||||
fi, err = os.Stat(path)
|
fi, err = os.Stat(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -44,22 +44,22 @@ func waitForFile(ctx context.Context, path string) (os.FileInfo, error) {
|
|||||||
return nil, fmt.Errorf("mirror: unable to get info on file %v", path)
|
return nil, fmt.Errorf("mirror: unable to get info on file %v", path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Debugf("File exists: %v, %v", path, fi.Size())
|
|
||||||
return fi, nil
|
return fi, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type mirrorFunc func(msg string)
|
type mirrorFunc func(msg string, isQMLog bool) bool
|
||||||
|
|
||||||
// mirrorAvailableMessages prints lines from the file, until no more are available
|
// mirrorAvailableMessages prints lines from the file, until no more are available
|
||||||
func mirrorAvailableMessages(f *os.File, mf mirrorFunc) {
|
func mirrorAvailableMessages(f *os.File, mf mirrorFunc, isQMLog bool) {
|
||||||
scanner := bufio.NewScanner(f)
|
scanner := bufio.NewScanner(f)
|
||||||
count := 0
|
count := 0
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
t := scanner.Text()
|
t := scanner.Text()
|
||||||
mf(t)
|
if mf(t, isQMLog) {
|
||||||
count++
|
count++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
log.Debugf("Mirrored %v log entries from %v", count, f.Name())
|
log.Debugf("Mirrored %v log entries from %v", count, f.Name())
|
||||||
@@ -74,7 +74,7 @@ func mirrorAvailableMessages(f *os.File, mf mirrorFunc) {
|
|||||||
// mirrorLog tails the specified file, and logs each line to stdout.
|
// mirrorLog tails the specified file, and logs each line to stdout.
|
||||||
// This is useful for usability, as the container console log can show
|
// This is useful for usability, as the container console log can show
|
||||||
// messages from the MQ error logs.
|
// messages from the MQ error logs.
|
||||||
func mirrorLog(ctx context.Context, wg *sync.WaitGroup, path string, fromStart bool, mf mirrorFunc) (chan error, error) {
|
func mirrorLog(ctx context.Context, wg *sync.WaitGroup, path string, fromStart bool, mf mirrorFunc, isQMLog bool) (chan error, error) {
|
||||||
errorChannel := make(chan error, 1)
|
errorChannel := make(chan error, 1)
|
||||||
var offset int64 = -1
|
var offset int64 = -1
|
||||||
var f *os.File
|
var f *os.File
|
||||||
@@ -121,6 +121,7 @@ func mirrorLog(ctx context.Context, wg *sync.WaitGroup, path string, fromStart b
|
|||||||
if fi == nil {
|
if fi == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log.Debugf("File exists: %v, %v", path, fi.Size())
|
||||||
f, err = os.OpenFile(path, os.O_RDONLY, 0)
|
f, err = os.OpenFile(path, os.O_RDONLY, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
@@ -139,13 +140,17 @@ func mirrorLog(ctx context.Context, wg *sync.WaitGroup, path string, fromStart b
|
|||||||
// Always start at the beginning if we've been told to go from the start
|
// Always start at the beginning if we've been told to go from the start
|
||||||
if offset != 0 && !fromStart {
|
if offset != 0 && !fromStart {
|
||||||
log.Debugf("Seeking offset %v in file %v", offset, path)
|
log.Debugf("Seeking offset %v in file %v", offset, path)
|
||||||
f.Seek(offset, 0)
|
_, err = f.Seek(offset, 0)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Unable to return to offset %v: %v", offset, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
closing := false
|
closing := false
|
||||||
for {
|
for {
|
||||||
// If there's already data there, mirror it now.
|
// If there's already data there, mirror it now.
|
||||||
mirrorAvailableMessages(f, mf)
|
mirrorAvailableMessages(f, mf, isQMLog)
|
||||||
newFI, err := os.Stat(path)
|
// Wait for the new log file (after rotation)
|
||||||
|
newFI, err := waitForFile(ctx, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
errorChannel <- err
|
errorChannel <- err
|
||||||
@@ -157,8 +162,11 @@ func mirrorLog(ctx context.Context, wg *sync.WaitGroup, path string, fromStart b
|
|||||||
// log rotation happens before we can open the new file, then we
|
// log rotation happens before we can open the new file, then we
|
||||||
// could skip all those messages. This could happen with a very small
|
// could skip all those messages. This could happen with a very small
|
||||||
// MQ error log size.
|
// MQ error log size.
|
||||||
mirrorAvailableMessages(f, mf)
|
mirrorAvailableMessages(f, mf, isQMLog)
|
||||||
f.Close()
|
err = f.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Unable to close mirror file handle: %v", err)
|
||||||
|
}
|
||||||
// Re-open file
|
// Re-open file
|
||||||
log.Debugf("Re-opening error log file %v", path)
|
log.Debugf("Re-opening error log file %v", path)
|
||||||
f, err = os.OpenFile(path, os.O_RDONLY, 0)
|
f, err = os.OpenFile(path, os.O_RDONLY, 0)
|
||||||
@@ -169,7 +177,7 @@ func mirrorLog(ctx context.Context, wg *sync.WaitGroup, path string, fromStart b
|
|||||||
}
|
}
|
||||||
fi = newFI
|
fi = newFI
|
||||||
// Don't seek this time, because we know it's a new file
|
// Don't seek this time, because we know it's a new file
|
||||||
mirrorAvailableMessages(f, mf)
|
mirrorAvailableMessages(f, mf, isQMLog)
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -41,9 +41,10 @@ func TestMirrorLogWithoutRotation(t *testing.T) {
|
|||||||
count := 0
|
count := 0
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
_, err = mirrorLog(ctx, &wg, tmp.Name(), true, func(msg string) {
|
_, err = mirrorLog(ctx, &wg, tmp.Name(), true, func(msg string, isQMLog bool) bool {
|
||||||
count++
|
count++
|
||||||
})
|
return true
|
||||||
|
}, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -82,9 +83,10 @@ func TestMirrorLogWithRotation(t *testing.T) {
|
|||||||
count := 0
|
count := 0
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
_, err = mirrorLog(ctx, &wg, tmp.Name(), true, func(msg string) {
|
_, err = mirrorLog(ctx, &wg, tmp.Name(), true, func(msg string, isQMLog bool) bool {
|
||||||
count++
|
count++
|
||||||
})
|
return true
|
||||||
|
}, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -135,9 +137,10 @@ func testMirrorLogExistingFile(t *testing.T, newQM bool) int {
|
|||||||
count := 0
|
count := 0
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
_, err = mirrorLog(ctx, &wg, tmp.Name(), newQM, func(msg string) {
|
_, err = mirrorLog(ctx, &wg, tmp.Name(), newQM, func(msg string, isQMLog bool) bool {
|
||||||
count++
|
count++
|
||||||
})
|
return true
|
||||||
|
}, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -179,8 +182,9 @@ func TestMirrorLogCancelWhileWaiting(t *testing.T) {
|
|||||||
cancel()
|
cancel()
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}()
|
}()
|
||||||
_, err := mirrorLog(ctx, &wg, "fake.log", true, func(msg string) {
|
_, err := mirrorLog(ctx, &wg, "fake.log", true, func(msg string, isQMLog bool) bool {
|
||||||
})
|
return true
|
||||||
|
}, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,121 +0,0 @@
|
|||||||
/*
|
|
||||||
© Copyright IBM Corporation 2017, 2018
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io/ioutil"
|
|
||||||
"os/user"
|
|
||||||
"runtime"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/ibm-messaging/mq-container/internal/capabilities"
|
|
||||||
)
|
|
||||||
|
|
||||||
func logBaseImage() error {
|
|
||||||
buf, err := ioutil.ReadFile("/etc/os-release")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
lines := strings.Split(string(buf), "\n")
|
|
||||||
for _, l := range lines {
|
|
||||||
if strings.HasPrefix(l, "PRETTY_NAME=") {
|
|
||||||
words := strings.Split(l, "\"")
|
|
||||||
if len(words) >= 2 {
|
|
||||||
log.Printf("Base image detected: %v", words[1])
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func logUser() {
|
|
||||||
u, err := user.Current()
|
|
||||||
if err == nil {
|
|
||||||
log.Printf("Running as user ID %v (%v) with primary group %v", u.Uid, u.Name, u.Gid)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func logCapabilities() {
|
|
||||||
status, err := readProc("/proc/1/status")
|
|
||||||
if err != nil {
|
|
||||||
// Ignore
|
|
||||||
return
|
|
||||||
}
|
|
||||||
caps, err := capabilities.DetectCapabilities(status)
|
|
||||||
if err == nil {
|
|
||||||
log.Printf("Detected capabilities: %v", strings.Join(caps, ","))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func readProc(filename string) (value string, err error) {
|
|
||||||
buf, err := ioutil.ReadFile(filename)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return strings.TrimSpace(string(buf)), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func readMounts() error {
|
|
||||||
all, err := readProc("/proc/mounts")
|
|
||||||
if err != nil {
|
|
||||||
log.Print("Error: Couldn't read /proc/mounts")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
lines := strings.Split(all, "\n")
|
|
||||||
detected := false
|
|
||||||
for i := range lines {
|
|
||||||
parts := strings.Split(lines[i], " ")
|
|
||||||
//dev := parts[0]
|
|
||||||
mountPoint := parts[1]
|
|
||||||
fsType := parts[2]
|
|
||||||
if strings.Contains(mountPoint, "/mnt") {
|
|
||||||
log.Printf("Detected '%v' volume mounted to %v", fsType, mountPoint)
|
|
||||||
detected = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !detected {
|
|
||||||
log.Print("No volume detected. Persistent messages may be lost")
|
|
||||||
} else {
|
|
||||||
checkFS("/mnt/mqm")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func logConfig() {
|
|
||||||
log.Printf("CPU architecture: %v", runtime.GOARCH)
|
|
||||||
if runtime.GOOS == "linux" {
|
|
||||||
var err error
|
|
||||||
osr, err := readProc("/proc/sys/kernel/osrelease")
|
|
||||||
if err != nil {
|
|
||||||
log.Print(err)
|
|
||||||
} else {
|
|
||||||
log.Printf("Linux kernel version: %v", osr)
|
|
||||||
}
|
|
||||||
logBaseImage()
|
|
||||||
fileMax, err := readProc("/proc/sys/fs/file-max")
|
|
||||||
if err != nil {
|
|
||||||
log.Print(err)
|
|
||||||
} else {
|
|
||||||
log.Printf("Maximum file handles: %v", fileMax)
|
|
||||||
}
|
|
||||||
logUser()
|
|
||||||
logCapabilities()
|
|
||||||
readMounts()
|
|
||||||
} else {
|
|
||||||
log.Fatalf("Unsupported platform: %v", runtime.GOOS)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
// +build linux
|
|
||||||
|
|
||||||
/*
|
|
||||||
© Copyright IBM Corporation 2017, 2018
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"golang.org/x/sys/unix"
|
|
||||||
)
|
|
||||||
|
|
||||||
// fsTypes contains file system identifier codes.
|
|
||||||
// This code will not compile on some operating systems - Linux only.
|
|
||||||
var fsTypes = map[int64]string{
|
|
||||||
0x61756673: "aufs",
|
|
||||||
0xef53: "ext",
|
|
||||||
0x6969: "nfs",
|
|
||||||
0x65735546: "fuse",
|
|
||||||
0x9123683e: "btrfs",
|
|
||||||
0x01021994: "tmpfs",
|
|
||||||
0x794c7630: "overlayfs",
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkFS(path string) {
|
|
||||||
statfs := &unix.Statfs_t{}
|
|
||||||
err := unix.Statfs(path, statfs)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
t := fsTypes[statfs.Type]
|
|
||||||
switch t {
|
|
||||||
case "aufs", "overlayfs", "tmpfs":
|
|
||||||
log.Fatalf("Error: %v uses unsupported filesystem type %v", path, t)
|
|
||||||
default:
|
|
||||||
log.Printf("Detected %v has filesystem type '%v'", path, t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
// +build mqdev
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
© 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.
|
||||||
@@ -17,19 +15,28 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "os"
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/tls"
|
||||||
|
)
|
||||||
|
|
||||||
// postInit is run after /var/mqm is set up
|
// postInit is run after /var/mqm is set up
|
||||||
// This version of postInit is only included as part of the MQ Advanced for Developers build
|
func postInit(name, keylabel string, p12Trust tls.KeyStoreData) error {
|
||||||
func postInit(name string) error {
|
enableWebServer := os.Getenv("MQ_ENABLE_EMBEDDED_WEB_SERVER")
|
||||||
disable := os.Getenv("MQ_DISABLE_WEB_CONSOLE")
|
if enableWebServer == "true" || enableWebServer == "1" {
|
||||||
if disable != "true" && disable != "1" {
|
// Configure the web server (if enabled)
|
||||||
// Configure and start the web server, in the background (if installed)
|
keystore, err := configureWebServer(keylabel, p12Trust)
|
||||||
// WARNING: No error handling or health checking available for the web server,
|
if err != nil {
|
||||||
// which is why it's limited to use with MQ Advanced for Developers only
|
return err
|
||||||
|
}
|
||||||
|
// Start the web server, in the background (if installed)
|
||||||
|
// WARNING: No error handling or health checking available for the web server
|
||||||
go func() {
|
go func() {
|
||||||
configureWebServer()
|
err = startWebServer(keystore, p12Trust.Password)
|
||||||
startWebServer()
|
if err != nil {
|
||||||
|
log.Printf("Error starting web server: %v", err)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
64
cmd/runmqserver/process.go
Normal file
64
cmd/runmqserver/process.go
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
© Copyright IBM Corporation 2018
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/command"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Verifies that we are the main or only instance of this program
|
||||||
|
func verifySingleProcess() error {
|
||||||
|
programName, err := determineExecutable()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Failed to determine name of this program - %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify that there is only one runmqserver
|
||||||
|
_, err = verifyOnlyOne(programName)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("You cannot run more than one instance of this program")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifies that there is only one instance running of the given program name.
|
||||||
|
func verifyOnlyOne(programName string) (int, error) {
|
||||||
|
// #nosec G104
|
||||||
|
out, _, _ := command.Run("ps", "-e", "--format", "cmd")
|
||||||
|
//if this goes wrong then assume we are the only one
|
||||||
|
numOfProg := strings.Count(out, programName)
|
||||||
|
if numOfProg != 1 {
|
||||||
|
return numOfProg, fmt.Errorf("Expected there to be only 1 instance of %s but found %d", programName, numOfProg)
|
||||||
|
}
|
||||||
|
return numOfProg, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determines the name of the currently running executable.
|
||||||
|
func determineExecutable() (string, error) {
|
||||||
|
file, err := os.Executable()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, exec := filepath.Split(file)
|
||||||
|
return exec, nil
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
© Copyright IBM Corporation 2017, 2018
|
© Copyright IBM Corporation 2017, 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,8 @@ limitations under the License.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@@ -24,11 +25,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"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"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/mqscredact"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/ready"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 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
|
||||||
@@ -38,20 +42,48 @@ func createDirStructure() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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 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) {
|
||||||
log.Printf("Creating queue manager %v", name)
|
log.Printf("Creating queue manager %v", name)
|
||||||
out, rc, err := command.Run("crtmqm", "-q", "-p", "1414", name)
|
|
||||||
|
// Run 'dspmqinf' to check if 'mqs.ini' configuration file exists
|
||||||
|
// If command succeeds, the queue manager (or standby queue manager) has already been created
|
||||||
|
_, _, err := command.Run("dspmqinf", name)
|
||||||
|
if err == nil {
|
||||||
|
log.Printf("Detected existing queue manager %v", name)
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
mounts, err := containerruntime.GetMounts()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// 8=Queue manager exists, which is fine
|
log.Printf("Error getting mounts for queue manager")
|
||||||
if rc == 8 {
|
|
||||||
log.Printf("Detected existing queue manager %v", name)
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
log.Printf("crtmqm returned %v", rc)
|
|
||||||
log.Println(string(out))
|
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if 'qm.ini' configuration file exists for the queue manager
|
||||||
|
// TODO : handle possible race condition - use a file lock?
|
||||||
|
dataDir := getQueueManagerDataDir(mounts, name)
|
||||||
|
_, err = os.Stat(filepath.Join(dataDir, "qm.ini"))
|
||||||
|
if err != nil {
|
||||||
|
// If 'qm.ini' is not found - run 'crtmqm' to create a new queue manager
|
||||||
|
args := getCreateQueueManagerArgs(mounts, name)
|
||||||
|
out, rc, err := command.Run("crtmqm", args...)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error %v creating queue manager: %v", rc, string(out))
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If 'qm.ini' is found - run 'addmqinf' to create a standby queue manager with existing configuration
|
||||||
|
args := getCreateStandbyQueueManagerArgs(name)
|
||||||
|
out, rc, err := command.Run("addmqinf", args...)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error %v creating standby queue manager: %v", rc, string(out))
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
log.Println("Created standby queue manager")
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
log.Println("Created queue manager")
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,10 +100,15 @@ func updateCommandLevel() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func startQueueManager() error {
|
func startQueueManager(name string) error {
|
||||||
log.Println("Starting queue manager")
|
log.Println("Starting queue manager")
|
||||||
out, rc, err := command.Run("strmqm")
|
out, rc, err := command.Run("strmqm", "-x", name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// 30=standby queue manager started, which is fine
|
||||||
|
if rc == 30 {
|
||||||
|
log.Printf("Started standby queue manager")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
log.Printf("Error %v starting queue manager: %v", rc, string(out))
|
log.Printf("Error %v starting queue manager: %v", rc, string(out))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -86,35 +123,49 @@ func configureQueueManager() error {
|
|||||||
log.Println(err)
|
log.Println(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if strings.HasSuffix(file.Name(), ".mqsc") {
|
if strings.HasSuffix(file.Name(), ".mqsc") {
|
||||||
abs := filepath.Join(configDir, file.Name())
|
abs := filepath.Join(configDir, file.Name())
|
||||||
|
// #nosec G204
|
||||||
|
verify := exec.Command("runmqsc", "-v", "-e")
|
||||||
|
// #nosec G204 - command is fixed, no injection vector
|
||||||
cmd := exec.Command("runmqsc")
|
cmd := exec.Command("runmqsc")
|
||||||
stdin, err := cmd.StdinPipe()
|
// Read mqsc file into variable
|
||||||
|
// #nosec G304 - filename variable is derived from contents of 'configDir' which is a defined constant
|
||||||
|
mqsc, err := ioutil.ReadFile(abs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Printf("Error reading file %v: %v", abs, err)
|
||||||
return err
|
continue
|
||||||
}
|
}
|
||||||
// Open the MQSC file for reading
|
// Write mqsc to buffer
|
||||||
f, err := os.Open(abs)
|
var buffer bytes.Buffer
|
||||||
|
_, err = buffer.Write(mqsc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error opening %v: %v", abs, err)
|
log.Printf("Error writing MQSC file %v to buffer: %v", abs, err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
// Copy the contents to stdin of the runmqsc process
|
verifyBuffer := buffer
|
||||||
_, err = io.Copy(stdin, f)
|
|
||||||
|
// Buffer mqsc to stdin of runmqsc
|
||||||
|
cmd.Stdin = &buffer
|
||||||
|
verify.Stdin = &verifyBuffer
|
||||||
|
|
||||||
|
// Verify the MQSC commands
|
||||||
|
out, err := verify.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error reading %v: %v", abs, err)
|
log.Errorf("Error verifying MQSC file %v (%v):\n\t%v", file.Name(), err, formatMQSCOutput(string(out)))
|
||||||
|
return fmt.Errorf("Error verifying MQSC file %v (%v):\n\t%v", file.Name(), err, formatMQSCOutput(string(out)))
|
||||||
}
|
}
|
||||||
f.Close()
|
|
||||||
stdin.Close()
|
// Run runmqsc command
|
||||||
// Run the command and wait for completion
|
out, err = cmd.CombinedOutput()
|
||||||
out, err := cmd.CombinedOutput()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Errorf("Error running MQSC file %v (%v):\n\t%v", file.Name(), err, formatMQSCOutput(string(out)))
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
// Print the runmqsc output, adding tab characters to make it more readable as part of the log
|
||||||
|
log.Printf("Output for \"runmqsc\" with %v:\n\t%v", abs, formatMQSCOutput(string(out)))
|
||||||
}
|
}
|
||||||
// Print the runmqsc output, adding tab characters to make it more readable as part of the log
|
|
||||||
log.Printf("Output for \"runmqsc\" with %v:\n\t%v", abs, strings.Replace(string(out), "\n", "\n\t", -1))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -122,11 +173,77 @@ func configureQueueManager() error {
|
|||||||
|
|
||||||
func stopQueueManager(name string) error {
|
func stopQueueManager(name string) error {
|
||||||
log.Println("Stopping queue manager")
|
log.Println("Stopping queue manager")
|
||||||
out, _, err := command.Run("endmqm", "-w", name)
|
isStandby, err := ready.IsRunningAsStandbyQM(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error stopping queue manager: %v", string(out))
|
log.Printf("Error getting status for queue manager %v: ", name, err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Println("Stopped queue manager")
|
args := []string{"-w", "-r", name}
|
||||||
|
if os.Getenv("MQ_MULTI_INSTANCE") == "true" {
|
||||||
|
if isStandby {
|
||||||
|
args = []string{"-x", name}
|
||||||
|
} else {
|
||||||
|
args = []string{"-s", "-w", "-r", name}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out, rc, err := command.Run("endmqm", args...)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error %v stopping queue manager: %v", rc, string(out))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if isStandby {
|
||||||
|
log.Printf("Stopped standby queue manager")
|
||||||
|
} else {
|
||||||
|
log.Println("Stopped queue manager")
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func formatMQSCOutput(out string) string {
|
||||||
|
// redact sensitive information
|
||||||
|
out, _ = mqscredact.Redact(out)
|
||||||
|
|
||||||
|
// add tab characters to make it more readable as part of the log
|
||||||
|
return strings.Replace(string(out), "\n", "\n\t", -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func isStandbyQueueManager(name string) (bool, error) {
|
||||||
|
out, rc, err := command.Run("dspmq", "-n", "-m", name)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error %v getting status for queue manager %v: %v", rc, name, string(out))
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if strings.Contains(string(out), "(RUNNING AS STANDBY)") {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getQueueManagerDataDir(mounts map[string]string, name string) string {
|
||||||
|
dataDir := filepath.Join("/var/mqm/qmgrs", name)
|
||||||
|
if _, ok := mounts["/mnt/mqm-data"]; ok {
|
||||||
|
dataDir = filepath.Join("/mnt/mqm-data/qmgrs", name)
|
||||||
|
}
|
||||||
|
return dataDir
|
||||||
|
}
|
||||||
|
|
||||||
|
func getCreateQueueManagerArgs(mounts map[string]string, name string) []string {
|
||||||
|
args := []string{"-q", "-p", "1414"}
|
||||||
|
if _, ok := mounts["/mnt/mqm-log"]; ok {
|
||||||
|
args = append(args, "-ld", "/mnt/mqm-log/log")
|
||||||
|
}
|
||||||
|
if _, ok := mounts["/mnt/mqm-data"]; ok {
|
||||||
|
args = append(args, "-md", "/mnt/mqm-data/qmgrs")
|
||||||
|
}
|
||||||
|
args = append(args, name)
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|
||||||
|
func getCreateStandbyQueueManagerArgs(name string) []string {
|
||||||
|
args := []string{"-s", "QueueManager"}
|
||||||
|
args = append(args, "-v", fmt.Sprintf("Name=%v", name))
|
||||||
|
args = append(args, "-v", fmt.Sprintf("Directory=%v", name))
|
||||||
|
args = append(args, "-v", "Prefix=/var/mqm")
|
||||||
|
args = append(args, "-v", fmt.Sprintf("DataPath=/mnt/mqm-data/qmgrs/%v", name))
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/metrics"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -42,6 +43,8 @@ func signalHandler(qmgr string) chan int {
|
|||||||
log.Printf("Signal received: %v", sig)
|
log.Printf("Signal received: %v", sig)
|
||||||
signal.Stop(reapSignals)
|
signal.Stop(reapSignals)
|
||||||
signal.Stop(stopSignals)
|
signal.Stop(stopSignals)
|
||||||
|
metrics.StopMetricsGathering(log)
|
||||||
|
// #nosec G104
|
||||||
stopQueueManager(qmgr)
|
stopQueueManager(qmgr)
|
||||||
// One final reap
|
// One final reap
|
||||||
reapZombies()
|
reapZombies()
|
||||||
@@ -49,13 +52,13 @@ func signalHandler(qmgr string) chan int {
|
|||||||
// End the goroutine
|
// End the goroutine
|
||||||
return
|
return
|
||||||
case <-reapSignals:
|
case <-reapSignals:
|
||||||
logDebug("Received SIGCHLD signal")
|
log.Debug("Received SIGCHLD signal")
|
||||||
reapZombies()
|
reapZombies()
|
||||||
case job := <-control:
|
case job := <-control:
|
||||||
switch {
|
switch {
|
||||||
case job == startReaping:
|
case job == startReaping:
|
||||||
// Add SIGCHLD to the list of signals we're listening to
|
// Add SIGCHLD to the list of signals we're listening to
|
||||||
logDebug("Listening for SIGCHLD signals")
|
log.Debug("Listening for SIGCHLD signals")
|
||||||
signal.Notify(reapSignals, syscall.SIGCHLD)
|
signal.Notify(reapSignals, syscall.SIGCHLD)
|
||||||
case job == reapNow:
|
case job == reapNow:
|
||||||
reapZombies()
|
reapZombies()
|
||||||
@@ -76,6 +79,6 @@ func reapZombies() {
|
|||||||
if pid == 0 || err == unix.ECHILD {
|
if pid == 0 || err == unix.ECHILD {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
logDebugf("Reaped PID %v", pid)
|
log.Debugf("Reaped PID %v", pid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
166
cmd/runmqserver/tls.go
Normal file
166
cmd/runmqserver/tls.go
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
/*
|
||||||
|
© 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.
|
||||||
|
*/
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"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/tls"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Location to store the keystores
|
||||||
|
const keyStoreDir = "/run/runmqserver/tls/"
|
||||||
|
|
||||||
|
// KeyDir is the location of the certificate keys to import
|
||||||
|
const keyDir = "/etc/mqm/pki/keys"
|
||||||
|
|
||||||
|
// TrustDir is the location of the Certifates to add
|
||||||
|
const trustDir = "/etc/mqm/pki/trust"
|
||||||
|
|
||||||
|
// configureWebTLS configures TLS for Web Console
|
||||||
|
func configureWebTLS(label string) error {
|
||||||
|
// Return immediately if we have no certificate to use as identity
|
||||||
|
if label == "" && os.Getenv("MQ_GENERATE_CERTIFICATE_HOSTNAME") == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
webConfigDir := "/etc/mqm/web/installations/Installation1/servers/mqweb"
|
||||||
|
tls := "tls.xml"
|
||||||
|
|
||||||
|
tlsConfig := filepath.Join(webConfigDir, tls)
|
||||||
|
newTLSConfig := filepath.Join(webConfigDir, tls+".tpl")
|
||||||
|
err := os.Remove(tlsConfig)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Could not delete file %s: %v", tlsConfig, err)
|
||||||
|
}
|
||||||
|
// we symlink here to prevent issues on restart
|
||||||
|
err = os.Symlink(newTLSConfig, tlsConfig)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Could not create symlink %s->%s: %v", newTLSConfig, tlsConfig, err)
|
||||||
|
}
|
||||||
|
mqmUID, mqmGID, err := command.LookupMQM()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Could not find mqm user or group: %v", err)
|
||||||
|
}
|
||||||
|
err = os.Chown(tlsConfig, mqmUID, mqmGID)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Could change ownership of %s to mqm: %v", tlsConfig, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// configureTLSDev configures TLS for developer defaults
|
||||||
|
func configureTLSDev() error {
|
||||||
|
const mqsc string = "/etc/mqm/20-dev-tls.mqsc"
|
||||||
|
const mqscTemplate string = mqsc + ".tpl"
|
||||||
|
const sslCipherSpec string = "TLS_RSA_WITH_AES_128_CBC_SHA256"
|
||||||
|
|
||||||
|
if os.Getenv("MQ_DEV") == "true" {
|
||||||
|
err := mqtemplate.ProcessTemplateFile(mqscTemplate, mqsc, map[string]string{
|
||||||
|
"SSLCipherSpec": sslCipherSpec,
|
||||||
|
}, log)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_, err := os.Stat(mqsc)
|
||||||
|
if !os.IsNotExist(err) {
|
||||||
|
err = os.Remove(mqsc)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Error removing file %s: %v", mqsc, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// configureTLS configures TLS for queue manager
|
||||||
|
func configureTLS(certLabel string, cmsKeystore tls.KeyStoreData, devmode bool) error {
|
||||||
|
log.Debug("Configuring TLS")
|
||||||
|
|
||||||
|
const mqsc string = "/etc/mqm/15-tls.mqsc"
|
||||||
|
const mqscTemplate string = mqsc + ".tpl"
|
||||||
|
|
||||||
|
err := mqtemplate.ProcessTemplateFile(mqscTemplate, mqsc, map[string]string{
|
||||||
|
"SSLKeyR": strings.TrimSuffix(cmsKeystore.Keystore.Filename, ".kdb"),
|
||||||
|
"CertificateLabel": certLabel,
|
||||||
|
}, log)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if devmode && certLabel != "" {
|
||||||
|
err = configureTLSDev()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// configureSSOTLS configures MQ Console TLS for Single Sign-On
|
||||||
|
func configureSSOTLS(p12TrustStore tls.KeyStoreData) (string, error) {
|
||||||
|
// TODO find way to supply this
|
||||||
|
// Override the webstore variables to hard coded defaults
|
||||||
|
webKeyStoreName := tls.IntegrationDefaultLabel + ".p12"
|
||||||
|
|
||||||
|
// Check keystore exists
|
||||||
|
ks := filepath.Join(keyStoreDir, webKeyStoreName)
|
||||||
|
_, err := os.Stat(ks)
|
||||||
|
// Now we know if the file exists let's check whether we should have it or not.
|
||||||
|
// 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
|
||||||
|
_, err = os.Stat(p12TrustStore.Keystore.Filename)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Failed to find existing truststore %s: %v", p12TrustStore.Keystore.Filename, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return webKeyStoreName, nil
|
||||||
|
}
|
||||||
78
cmd/runmqserver/version.go
Normal file
78
cmd/runmqserver/version.go
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
© Copyright IBM Corporation 2018
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/command"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ImageCreated is the date the image was built
|
||||||
|
ImageCreated = "Not specified"
|
||||||
|
// ImageRevision is the source control revision identifier
|
||||||
|
ImageRevision = "Not specified"
|
||||||
|
// ImageSource is the URL to get source code for building the image
|
||||||
|
ImageSource = "Not specified"
|
||||||
|
// ImageTag is the tag of the image
|
||||||
|
ImageTag = "Not specified"
|
||||||
|
)
|
||||||
|
|
||||||
|
func logDateStamp() {
|
||||||
|
log.Printf("Image created: %v", ImageCreated)
|
||||||
|
}
|
||||||
|
|
||||||
|
func logGitRepo() {
|
||||||
|
// log.Printf("Image revision: %v", ImageRevision)
|
||||||
|
}
|
||||||
|
|
||||||
|
func logGitCommit() {
|
||||||
|
// log.Printf("Image source: %v", ImageSource)
|
||||||
|
}
|
||||||
|
|
||||||
|
func logImageTag() {
|
||||||
|
log.Printf("Image tag: %v", ImageTag)
|
||||||
|
}
|
||||||
|
|
||||||
|
func logMQVersion() {
|
||||||
|
mqVersion, _, err := command.Run("dspmqver", "-b", "-f", "2")
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error Getting MQ version: %v", strings.TrimSuffix(string(mqVersion), "\n"))
|
||||||
|
}
|
||||||
|
|
||||||
|
mqBuild, _, err := command.Run("dspmqver", "-b", "-f", "4")
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error Getting MQ build: %v", strings.TrimSuffix(string(mqBuild), "\n"))
|
||||||
|
}
|
||||||
|
mqLicense, _, err := command.Run("dspmqver", "-b", "-f", "8192")
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error Getting MQ license: %v", strings.TrimSuffix(string(mqLicense), "\n"))
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("MQ version: %v", strings.TrimSuffix(mqVersion, "\n"))
|
||||||
|
log.Printf("MQ level: %v", strings.TrimSuffix(mqBuild, "\n"))
|
||||||
|
log.Printf("MQ license: %v", strings.TrimSuffix(mqLicense, "\n"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func logVersionInfo() {
|
||||||
|
logDateStamp()
|
||||||
|
logGitRepo()
|
||||||
|
logGitCommit()
|
||||||
|
logImageTag()
|
||||||
|
logMQVersion()
|
||||||
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
// +build mqdev
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
© 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.
|
||||||
@@ -20,19 +18,61 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"github.com/ibm-messaging/mq-container/internal/command"
|
"github.com/ibm-messaging/mq-container/internal/command"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/copy"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/mqtemplate"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/tls"
|
||||||
)
|
)
|
||||||
|
|
||||||
func startWebServer() error {
|
func startWebServer(keystore, keystorepw string) error {
|
||||||
_, err := os.Stat("/opt/mqm/bin/strmqweb")
|
_, err := os.Stat("/opt/mqm/bin/strmqweb")
|
||||||
if err != nil && os.IsNotExist(err) {
|
if err != nil && os.IsNotExist(err) {
|
||||||
log.Debug("Skipping web server, because it's not installed")
|
log.Debug("Skipping web server, because it's not installed")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
log.Println("Starting web server")
|
log.Println("Starting web server")
|
||||||
out, rc, err := command.RunAsMQM("strmqweb")
|
// #nosec G204 - command is fixed, no injection vector
|
||||||
|
cmd := exec.Command("strmqweb")
|
||||||
|
// Set a default app password for the web server, if one isn't already set
|
||||||
|
_, set := os.LookupEnv("MQ_APP_PASSWORD")
|
||||||
|
if !set {
|
||||||
|
// Take all current environment variables, and add the app password
|
||||||
|
cmd.Env = append(os.Environ(), "MQ_APP_PASSWORD=passw0rd")
|
||||||
|
} else {
|
||||||
|
cmd.Env = os.Environ()
|
||||||
|
}
|
||||||
|
|
||||||
|
// TLS enabled
|
||||||
|
if keystore != "" {
|
||||||
|
cmd.Env = append(cmd.Env, "AMQ_WEBKEYSTORE="+keystore)
|
||||||
|
cmd.Env = append(cmd.Env, "AMQ_WEBKEYSTOREPW="+keystorepw)
|
||||||
|
}
|
||||||
|
|
||||||
|
uid, gid, err := command.LookupMQM()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
u, err := user.Current()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
currentUID, err := strconv.Atoi(u.Uid)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error converting UID to string: %v", err)
|
||||||
|
}
|
||||||
|
// Add credentials to run as 'mqm', only if we aren't already 'mqm'
|
||||||
|
if currentUID != uid {
|
||||||
|
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
||||||
|
cmd.SysProcAttr.Credential = &syscall.Credential{Uid: uint32(uid), Gid: uint32(gid)}
|
||||||
|
}
|
||||||
|
out, rc, err := command.RunCmd(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error %v starting web server: %v", rc, string(out))
|
log.Printf("Error %v starting web server: %v", rc, string(out))
|
||||||
return err
|
return err
|
||||||
@@ -41,25 +81,82 @@ func startWebServer() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func configureWebServer() error {
|
func configureSSO(p12TrustStore tls.KeyStoreData) (string, error) {
|
||||||
_, err := os.Stat("/opt/mqm/bin/strmqweb")
|
// Ensure all required environment variables are set for SSO
|
||||||
|
requiredEnvVars := []string{
|
||||||
|
"MQ_WEB_ADMIN_USERS",
|
||||||
|
"MQ_OIDC_CLIENT_ID",
|
||||||
|
"MQ_OIDC_CLIENT_SECRET",
|
||||||
|
"MQ_OIDC_UNIQUE_USER_IDENTIFIER",
|
||||||
|
"MQ_OIDC_AUTHORIZATION_ENDPOINT",
|
||||||
|
"MQ_OIDC_TOKEN_ENDPOINT",
|
||||||
|
"MQ_OIDC_JWK_ENDPOINT",
|
||||||
|
"MQ_OIDC_ISSUER_IDENTIFIER",
|
||||||
|
}
|
||||||
|
for _, envVar := range requiredEnvVars {
|
||||||
|
if len(os.Getenv(envVar)) == 0 {
|
||||||
|
return "", fmt.Errorf("%v must be set when MQ_BETA_ENABLE_SSO=true", envVar)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check mqweb directory exists
|
||||||
|
const mqwebDir string = "/etc/mqm/web/installations/Installation1/servers/mqweb"
|
||||||
|
_, err := os.Stat(mqwebDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return nil
|
return "", nil
|
||||||
}
|
}
|
||||||
return err
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process SSO template for generating file mqwebuser.xml
|
||||||
|
adminUsers := strings.Split(os.Getenv("MQ_WEB_ADMIN_USERS"), "\n")
|
||||||
|
err = mqtemplate.ProcessTemplateFile(mqwebDir+"/mqwebuser.xml.tpl", mqwebDir+"/mqwebuser.xml", map[string][]string{"AdminUser": adminUsers}, log)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure SSO TLS
|
||||||
|
return configureSSOTLS(p12TrustStore)
|
||||||
|
}
|
||||||
|
|
||||||
|
func configureWebServer(keyLabel string, p12Trust tls.KeyStoreData) (string, error) {
|
||||||
|
var keystore string
|
||||||
|
// Configure TLS for Web Console first if we have a certificate to use
|
||||||
|
err := configureWebTLS(keyLabel)
|
||||||
|
if err != nil {
|
||||||
|
return keystore, err
|
||||||
|
}
|
||||||
|
if keyLabel != "" {
|
||||||
|
keystore = keyLabel + ".p12"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure Single-Sign-On for the web server (if enabled)
|
||||||
|
enableSSO := os.Getenv("MQ_BETA_ENABLE_SSO")
|
||||||
|
if enableSSO == "true" || enableSSO == "1" {
|
||||||
|
keystore, err = configureSSO(p12Trust)
|
||||||
|
if err != nil {
|
||||||
|
return keystore, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_, err = os.Stat("/opt/mqm/bin/strmqweb")
|
||||||
|
if err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return keystore, nil
|
||||||
|
}
|
||||||
|
return keystore, err
|
||||||
}
|
}
|
||||||
const webConfigDir string = "/etc/mqm/web"
|
const webConfigDir string = "/etc/mqm/web"
|
||||||
_, err = os.Stat(webConfigDir)
|
_, err = os.Stat(webConfigDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return nil
|
return keystore, nil
|
||||||
}
|
}
|
||||||
return err
|
return keystore, err
|
||||||
}
|
}
|
||||||
uid, gid, err := lookupMQM()
|
uid, gid, err := command.LookupMQM()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return keystore, err
|
||||||
}
|
}
|
||||||
const prefix string = "/etc/mqm/web"
|
const prefix string = "/etc/mqm/web"
|
||||||
err = filepath.Walk(prefix, func(from string, info os.FileInfo, err error) error {
|
err = filepath.Walk(prefix, func(from string, info os.FileInfo, err error) error {
|
||||||
@@ -76,15 +173,14 @@ func configureWebServer() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
if !exists {
|
if !exists {
|
||||||
|
// #nosec G301 - write group permissions are required
|
||||||
err := os.MkdirAll(to, 0770)
|
err := os.MkdirAll(to, 0770)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Printf("Directory: %v --> %v", from, to)
|
|
||||||
} else {
|
} else {
|
||||||
if exists {
|
if exists {
|
||||||
err := os.Remove(to)
|
err := os.Remove(to)
|
||||||
@@ -92,13 +188,11 @@ func configureWebServer() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Permissions. Can't rely on them being set in Dockerfile
|
err := copy.CopyFile(from, to)
|
||||||
err := os.Link(from, to)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug(err)
|
log.Error(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Printf("File: %v", from)
|
|
||||||
}
|
}
|
||||||
err = os.Chown(to, uid, gid)
|
err = os.Chown(to, uid, gid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -106,5 +200,5 @@ func configureWebServer() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
return err
|
return keystore, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,28 @@
|
|||||||
# Building a Docker image
|
# Building a container image
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
You need to ensure you 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
|
||||||
* [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.
|
||||||
|
|
||||||
## Building a production image
|
## Building a production image
|
||||||
This procedure works for building the MQ Continuous Delivery release, on `x86_64`, `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, and place the downloaded file (for example, `IBM_MQ_9.0.4.0_UBUNTU_X86-64.tar.gz` for MQ V9.0.4 for Ubuntu on x86_64 architecture) 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
|
||||||
2. 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 other package is called "MQ for Ubuntu", and contains DEB files for installing on Ubuntu.
|
> **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.
|
||||||
|
|
||||||
You can build a different version of MQ by setting the `MQ_VERSION` environment variable, for example:
|
You can build a different version of MQ by setting the `MQ_VERSION` environment variable, for example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
MQ_VERSION=9.0.4.0 make build-advancedserver
|
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:
|
||||||
@@ -27,17 +32,15 @@ MQ_ARCHIVE=mq-1.2.3.4.tar.gz MQ_VERSION=1.2.3.4 make build-advancedserver
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Building a developer image
|
## Building a developer image
|
||||||
Run `make build-devserver`, which will download the latest version of MQ Advanced for Developers from IBM developerWorks. This is currently only available on the `x86_64` architecture.
|
Run `make build-devserver`, which will download the latest version of MQ Advanced for Developers from IBM developerWorks. This is currently only available on the `amd64` architecture.
|
||||||
|
|
||||||
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 on a different base image
|
## Building from a Red Hat Enterprise Linux host
|
||||||
By default, the MQ images use Ubuntu as the base layer. You can build using a Red Hat Enterprise Linux compatible base layer by setting the `BASE_IMAGE` environment variable. For example:
|
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.
|
||||||
BASE_IMAGE=centos:7 make build-advancedserver
|
|
||||||
```
|
|
||||||
|
|
||||||
The `make` tool will try and locate the right archive file under the `downloads` directory, based on your platform architecture and your `MQ_VERSION` environment variable, for example `IBM_MQ_9.0.4.0_LINUX_X86_64.tar.gz` for MQ V9.0.4.0 on x86_64. You can also set the `MQ_ARCHIVE` environment variable to set the specific file name.
|
## Installed components
|
||||||
|
|
||||||
Note that if you are using Red Hat Enterprise Linux, you will need to create your own base image layer, with your subscription enabled, as described [here](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html/getting_started_with_containers/get_started_with_docker_formatted_container_images). The MQ image build needs to install some additional packages, and a subscription is required to access the Red Hat repositories.
|
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`.
|
||||||
|
|||||||
55
docs/developer-config.md
Normal file
55
docs/developer-config.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# Default developer configuration
|
||||||
|
|
||||||
|
If you build this image with MQ Advanced for Developers, then an optional set of configuration can be applied automatically. This configures your Queue Manager with a set of default objects that you can use to quickly get started developing with IBM MQ. If you do not want the default objects to be created you can set the `MQ_DEV` environment variable to `false`.
|
||||||
|
|
||||||
|
## Environment variables
|
||||||
|
|
||||||
|
The MQ Developer Defaults supports some customization options, these are all controlled using environment variables:
|
||||||
|
|
||||||
|
* **MQ_DEV** - Set this to `false` to stop the default objects being created.
|
||||||
|
* **MQ_ADMIN_PASSWORD** - Changes the password of the `admin` user. Must be at least 8 characters long.
|
||||||
|
* **MQ_APP_PASSWORD** - Changes the password of the app user. If set, this will cause the `DEV.APP.SVRCONN` channel to become secured and only allow connections that supply a valid userid and password. Must be at least 8 characters long.
|
||||||
|
* **MQ_TLS_KEYSTORE** - **DEPRECATED**. See section `Supplying TLS certificates` in [usage document](usage.md). Allows you to supply the location of a PKCS#12 keystore containing a single certificate which you want to use in both the web console and the queue manager. Requires `MQ_TLS_PASSPHRASE`. When enabled the channels created will be secured using the `TLS_RSA_WITH_AES_128_CBC_SHA256` CipherSpec. *Note*: you will need to make the keystore available inside your container, this can be done by mounting a volume to your container.
|
||||||
|
* **MQ_TLS_PASSPHRASE** - **DEPRECATED**. See section `Supplying TLS certificates` in [usage document](usage.md). Passphrase for the keystore referenced in `MQ_TLS_KEYSTORE`.
|
||||||
|
|
||||||
|
## Details of the default configuration
|
||||||
|
|
||||||
|
The following users are created:
|
||||||
|
|
||||||
|
* User **admin** for administration (in the `mqm` group). Default password is **passw0rd**.
|
||||||
|
* User **app** for messaging (in a group called `mqclient`). No password by default.
|
||||||
|
|
||||||
|
Users in `mqclient` group have been given access connect to all queues and topics starting with `DEV.**` and have `put`, `get`, `pub`, `sub`, `browse` and `inq` permissions.
|
||||||
|
|
||||||
|
The following queues and topics are created:
|
||||||
|
|
||||||
|
* DEV.QUEUE.1
|
||||||
|
* DEV.QUEUE.2
|
||||||
|
* DEV.QUEUE.3
|
||||||
|
* DEV.DEAD.LETTER.QUEUE - configured as the Queue Manager's Dead Letter Queue.
|
||||||
|
* DEV.BASE.TOPIC - uses a topic string of `dev/`.
|
||||||
|
|
||||||
|
Two channels are created, one for administration, the other for normal messaging:
|
||||||
|
|
||||||
|
* DEV.ADMIN.SVRCONN - configured to only allow the `admin` user to connect into it. A user and password must be supplied.
|
||||||
|
* DEV.APP.SVRCONN - does not allow administrative users to connect. Password is optional unless you choose a password for app users.
|
||||||
|
|
||||||
|
A new listener is created (the SYSTEM listener is fine, but system objects are not shown by default in the web console):
|
||||||
|
|
||||||
|
* DEV.LISTENER.TCP - listens on port 1414.
|
||||||
|
|
||||||
|
|
||||||
|
## Web Console
|
||||||
|
|
||||||
|
By default the MQ Advanced for Developers image will start the IBM MQ Web Console that allows you to administer your Queue Manager running on your container. When the web console has been started, you can access it by opening a web browser and navigating to https://<Container IP>:9443/ibmmq/console. Where <Container IP> is replaced by the IP address of your running container.
|
||||||
|
|
||||||
|
When you navigate to this page you may be presented with a security exception warning. This happens because, by default, the web console creates a self-signed certificate to use for the HTTPS operations. This certificate is not trusted by your browser and has an incorrect distinguished name.
|
||||||
|
|
||||||
|
If you choose to accept the security warning, you will be presented with the login menu for the IBM MQ Web Console. The default login for the console is:
|
||||||
|
|
||||||
|
* **User:** admin
|
||||||
|
* **Password:** passw0rd
|
||||||
|
|
||||||
|
If you wish to change the password for the admin user, this can be done using the `MQ_ADMIN_PASSWORD` environment variable. If you supply a PKCS#12 keystore using the `MQ_TLS_KEYSTORE` environment variable, then the web console will be configured to use the certificate inside the keystore for HTTPS operations.
|
||||||
|
|
||||||
|
If you do not wish the web console to run, you can disable it by setting the environment variable `MQ_ENABLE_EMBEDDED_WEB_SERVER` to `false`.
|
||||||
@@ -8,6 +8,7 @@ The resulting Docker image contains the following:
|
|||||||
* MQ installation (under `/opt/mqm`)
|
* MQ installation (under `/opt/mqm`)
|
||||||
* Three additional programs, to enable running in a containerized environment:
|
* Three additional programs, to enable running in a containerized environment:
|
||||||
- `runmqserver` - The main process, which creates and runs a queue manager
|
- `runmqserver` - The main process, which creates and runs a queue manager
|
||||||
|
- `runmqdevserver` - The main process for MQ Advanced for Developers
|
||||||
- `chkmqhealthy` - Checks the health of the queue manager. This can be used by (say) a Kubernetes liveness probe.
|
- `chkmqhealthy` - Checks the health of the queue manager. This can be used by (say) a Kubernetes liveness probe.
|
||||||
- `chkmqready` - Checks if the queue manager is ready for work. This can be used by (say) a Kubernetes readiness probe.
|
- `chkmqready` - Checks if the queue manager is ready for work. This can be used by (say) a Kubernetes readiness probe.
|
||||||
|
|
||||||
@@ -23,3 +24,28 @@ The `runmqserver` command has the following responsibilities:
|
|||||||
- Works as PID 1, so is responsible for [reaping zombie processes](https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/)
|
- Works as PID 1, so is responsible for [reaping zombie processes](https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/)
|
||||||
* Creating and starting a queue manager
|
* Creating and starting a queue manager
|
||||||
* Configuring the queue manager, by running any MQSC scripts found under `/etc/mqm`
|
* Configuring the queue manager, by running any MQSC scripts found under `/etc/mqm`
|
||||||
|
* Starts the MQ web server (if enabled)
|
||||||
|
* Starting Prometheus metrics generation for the queue manager (if enabled)
|
||||||
|
* Indicates to the `chkmqready` command that configuration is complete, and that normal readiness checking can happen. This is done by writing a file into `/run/runmqserver`
|
||||||
|
|
||||||
|
In addition, for MQ Advanced for Developers only, the web server is started.
|
||||||
|
|
||||||
|
## runmqdevserver
|
||||||
|
The `runmqdevserver` command is added to the MQ Advanced for Developers image only. It does the following, before invoking `runmqserver`:
|
||||||
|
|
||||||
|
1. Sets passwords based on supplied environment variables
|
||||||
|
2. Generates MQSC files to put in `/etc/mqm`, based on a template, which is updated with values based on supplied environment variables.
|
||||||
|
3. If requested, it creates TLS key stores under `/run/runmqdevserver`, and configures MQ and the web server to use them
|
||||||
|
|
||||||
|
## Prometheus metrics
|
||||||
|
[Prometheus](https://prometheus.io) metrics are generated for the queue manager as follows:
|
||||||
|
|
||||||
|
1. A connection is established with the queue manager
|
||||||
|
2. Metrics are discovered by subscribing to topics that provide meta-data on metric classes, types and elements
|
||||||
|
3. Subscriptions are then created for each topic that provides this metric data
|
||||||
|
4. Metrics are initialised using Prometheus names mapped from their element descriptions
|
||||||
|
5. The metrics are then registered with the Prometheus registry as Prometheus Gauges
|
||||||
|
6. Publications are processed on a periodic basis to retrieve the metric data
|
||||||
|
7. An HTTP server is setup to listen for requests from Prometheus on `/metrics` port `9157`
|
||||||
|
8. Prometheus requests are handled by updating the Prometheus Gauges with the latest metric data
|
||||||
|
9. These updated Prometheus Gauges are then collected by the Prometheus registry
|
||||||
|
|||||||
39
docs/security.md
Normal file
39
docs/security.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Security
|
||||||
|
|
||||||
|
## Container runtime
|
||||||
|
|
||||||
|
### User
|
||||||
|
|
||||||
|
The MQ server image is run using the "mqm" user, with a fixed UID and GID of 888.
|
||||||
|
|
||||||
|
### Capabilities
|
||||||
|
|
||||||
|
The MQ Advanced image requires no Linux capabilities, so you can drop any capabilities which are added by default. For example, in Docker you could do the following:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run \
|
||||||
|
--cap-drop=ALL \
|
||||||
|
--env LICENSE=accept \
|
||||||
|
--env MQ_QMGR_NAME=QM1 \
|
||||||
|
--detach \
|
||||||
|
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:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run \
|
||||||
|
--cap-drop=ALL \
|
||||||
|
--cap-add=CHOWN \
|
||||||
|
--cap-add=SETUID \
|
||||||
|
--cap-add=SETGID \
|
||||||
|
--cap-add=AUDIT_WRITE \
|
||||||
|
--env LICENSE=accept \
|
||||||
|
--env MQ_QMGR_NAME=QM1 \
|
||||||
|
--detach \
|
||||||
|
mqadvanced-server-dev:9.1.3.0-amd64
|
||||||
|
```
|
||||||
|
|
||||||
|
### SELinux
|
||||||
|
|
||||||
|
The SELinux label "spc_t" (super-privileged container) is needed to run the MQ container on a host with SELinux enabled. This is due to a current limitation in how MQ data is stored on volumes, which violates the usual policy applied when using the standard "container_t" label.
|
||||||
@@ -6,23 +6,12 @@ You need to ensure you have the following tools installed:
|
|||||||
* [GNU make](https://www.gnu.org/software/make/)
|
* [GNU make](https://www.gnu.org/software/make/)
|
||||||
* [Go](https://golang.org/) - only needed for running the tests
|
* [Go](https://golang.org/) - only needed for running the tests
|
||||||
* [dep](https://github.com/golang/dep) (official Go dependency management tool) - needed to prepare for running the tests
|
* [dep](https://github.com/golang/dep) (official Go dependency management tool) - needed to prepare for running the tests
|
||||||
* [Helm](https://helm.sh) - only needed for running the Kubernetes tests
|
|
||||||
|
|
||||||
For running the Kubernetes tests, a Kubernetes environment is needed, for example [Minikube](https://github.com/kubernetes/minikube) or [IBM Cloud Private](https://www.ibm.com/cloud-computing/products/ibm-cloud-private/).
|
|
||||||
|
|
||||||
## Preparing to run the tests
|
|
||||||
The test dependencies are not included with the source code, so you need to download them before you can run them. This can be done with the following command, which uses the `dep` tool:
|
|
||||||
|
|
||||||
```
|
|
||||||
make deps
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running the tests
|
## Running the tests
|
||||||
There are three main sets of tests:
|
There are two main sets of tests:
|
||||||
|
|
||||||
1. Unit tests, which are run during a build
|
1. Unit tests, which are run during a build
|
||||||
2. Docker tests, which test a complete Docker image, using the Docker API
|
2. Docker tests, which test a complete Docker image, using the Docker API
|
||||||
3. Kubernetes tests, which test the Helm charts (and the Docker image) via [Helm](https://helm.sh)
|
|
||||||
|
|
||||||
### Running the Docker tests
|
### Running the Docker tests
|
||||||
The Docker tests can be run locally on a machine with Docker. For example:
|
The Docker tests can be run locally on a machine with Docker. For example:
|
||||||
@@ -35,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-server9.0.4.0-x86_64-ubuntu-16.04 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::
|
||||||
@@ -44,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-server9.0.3.0-x86_64-ubuntu-16.04`:
|
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.0.3.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
|
||||||
|
|||||||
17
docs/troubleshooting.md
Normal file
17
docs/troubleshooting.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Troubleshooting
|
||||||
|
|
||||||
|
## AMQ7017: Log not available
|
||||||
|
If you see this message in the container logs, it means that the directory being used for the container's volume doesn't use a filesystem supported by IBM MQ. To solve this, you need to make sure the container's `/mnt/mqm` volume is put on a supported filesystem. The best way to do this is to use [Docker volumes](https://docs.docker.com/storage/volumes/), instead of bind-mounted directories.
|
||||||
|
|
||||||
|
## Container command not found or does not exist
|
||||||
|
This message also appears as "System error: no such file or directory" in some versions of Docker. This can happen using a Docker client on Windows, and is related to line-ending characters. When you clone the Git repository on Windows, Git is often configured to convert any UNIX-style LF line-endings to Windows-style CRLF line-endings. Files with these line-endings end up in the built Docker image, and cause the container to fail at start-up. One solution to this problem is to stop Git from converting the line-ending characters, with the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
git config --global core.autocrlf input
|
||||||
|
```
|
||||||
|
|
||||||
|
## Old Linux kernel versions
|
||||||
|
MQ works best if you have a Linux kernel version of V3.16 or higher (run `uname -r` to check).
|
||||||
|
|
||||||
|
If you have an older version, you might need to add the [`--ipc host`](https://docs.docker.com/engine/reference/run/#ipc-settings-ipc) option when you run an MQ container. The reason for this is that IBM MQ uses shared memory, and on Linux kernels prior to V3.16, containers are usually limited to 32 MB of shared memory. In a [change](https://git.kernel.org/cgit/linux/kernel/git/mhocko/mm.git/commit/include/uapi/linux/shm.h?id=060028bac94bf60a65415d1d55a359c3a17d5c31
|
||||||
|
) to Linux kernel V3.16, the hard-coded limit is greatly increased. This kernel version is available in Ubuntu 14.04.2 onwards, Fedora V20 onwards, and boot2docker V1.2 onwards. Some Linux distributions, like Red Hat Enterprise Linux, patch older kernel versions, so you might find that the patch has been applied already, even if you see a lower kernel version number. If you are using a host with an older kernel version, then you can still run MQ, but you have to give it access to the host's IPC namespace using the [`--ipc host`](https://docs.docker.com/engine/reference/run/#ipc-settings-ipc) option on `docker run`. Note that this reduces the security isolation of your container.
|
||||||
117
docs/usage.md
Normal file
117
docs/usage.md
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
# Usage
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## 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:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run \
|
||||||
|
--env LICENSE=accept \
|
||||||
|
--env MQ_QMGR_NAME=QM1 \
|
||||||
|
--publish 1414:1414 \
|
||||||
|
--publish 9443:9443 \
|
||||||
|
--detach \
|
||||||
|
ibmcom/mq
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running with the default configuration and a volume
|
||||||
|
The above example will not persist any configuration data or messages across container runs. In order to do this, you need to use a [volume](https://docs.docker.com/storage/volumes/). For example, you can create a volume with the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker volume create qm1data
|
||||||
|
```
|
||||||
|
|
||||||
|
You can then run a queue manager using this volume as follows:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run \
|
||||||
|
--env LICENSE=accept \
|
||||||
|
--env MQ_QMGR_NAME=QM1 \
|
||||||
|
--publish 1414:1414 \
|
||||||
|
--publish 9443:9443 \
|
||||||
|
--detach \
|
||||||
|
--volume qm1data:/mnt/mqm \
|
||||||
|
ibmcom/mq
|
||||||
|
```
|
||||||
|
|
||||||
|
The Docker image always uses `/mnt/mqm` for MQ data, which is correctly linked for you under `/var/mqm` at runtime. This is to handle problems with file permissions on some platforms.
|
||||||
|
|
||||||
|
## Running with the default configuration and Prometheus metrics enabled
|
||||||
|
You can run a queue manager with [Prometheus](https://prometheus.io) metrics enabled. The following command will generate Prometheus metrics for your queue manager on `/metrics` port `9157`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run \
|
||||||
|
--env LICENSE=accept \
|
||||||
|
--env MQ_QMGR_NAME=QM1 \
|
||||||
|
--env MQ_ENABLE_METRICS=true \
|
||||||
|
--publish 1414:1414 \
|
||||||
|
--publish 9443:9443 \
|
||||||
|
--publish 9157:9157 \
|
||||||
|
--detach \
|
||||||
|
ibmcom/mq
|
||||||
|
```
|
||||||
|
|
||||||
|
## Customizing the queue manager configuration
|
||||||
|
|
||||||
|
You can customize the configuration in several ways:
|
||||||
|
|
||||||
|
1. For getting started, you can use the [default developer configuration](developer-config.md), which is available out-of-the-box for the MQ Advanced for Developers image
|
||||||
|
2. By creating your own image and adding your own MQSC file into the `/etc/mqm` directory on the image. This file will be run when your queue manager is created.
|
||||||
|
3. By using [remote MQ administration](https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.adm.doc/q021090_.htm), via an MQ command server, the MQ HTTP APIs, or using a tool such as the MQ web console or MQ Explorer.
|
||||||
|
|
||||||
|
Note that a listener is always created on port 1414 inside the container. This port can be mapped to any port on the Docker host.
|
||||||
|
|
||||||
|
The following is an *example* `Dockerfile` for creating your own pre-configured image, which adds a custom MQ configuration file, and an administrative user `alice`. Note that it is not normally recommended to include passwords in this way:
|
||||||
|
|
||||||
|
```dockerfile
|
||||||
|
FROM ibmcom/mq
|
||||||
|
USER root
|
||||||
|
RUN useradd alice -G mqm && \
|
||||||
|
echo alice:passw0rd | chpasswd
|
||||||
|
USER mqm
|
||||||
|
COPY 20-config.mqsc /etc/mqm/
|
||||||
|
```
|
||||||
|
|
||||||
|
The `USER` instructions are necessary to ensure that the `useradd` and `chpasswd` commands are run as the root user.
|
||||||
|
|
||||||
|
Here is an example corresponding `20-config.mqsc` script, which creates two local queues:
|
||||||
|
|
||||||
|
```mqsc
|
||||||
|
DEFINE QLOCAL(MY.QUEUE.1) REPLACE
|
||||||
|
DEFINE QLOCAL(MY.QUEUE.2) REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
The file `20-config.mqsc` should be saved into the same directory as the `Dockerfile`.
|
||||||
|
|
||||||
|
## Running MQ commands
|
||||||
|
It is recommended that you configure MQ in your own custom image. However, you may need to run MQ commands directly inside the process space of the container. To run a command against a running queue manager, you can use `docker exec`, for example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker exec \
|
||||||
|
--tty \
|
||||||
|
--interactive \
|
||||||
|
${CONTAINER_ID} \
|
||||||
|
dspmq
|
||||||
|
```
|
||||||
|
|
||||||
|
Using this technique, you can have full control over all aspects of the MQ installation. Note that if you use this technique to make changes to the filesystem, then those changes would be lost if you re-created your container unless you make those changes in volumes.
|
||||||
|
|
||||||
|
## Supplying TLS certificates
|
||||||
|
|
||||||
|
If you wish to supply TLS Certificates that the queue manager and MQ Console should use for TLS operations then you must supply a PKCS#1 or unencrypted PKCS#8 PEM files for both the certificates and private keys in the following directories:
|
||||||
|
|
||||||
|
* `/etc/mqm/pki/keys/<Label>` - for certificates with public and private keys
|
||||||
|
* `/etc/mqm/pki/trust/<index>` - for certificates with only the public key
|
||||||
|
|
||||||
|
For example, if you have an identity certificate you wish to add with the label `mykey` and 2 certificates you wish to add as trusted then you would need to add the files into the following locations where files ending in `.key` contain private keys and `.crt` contain certificates:
|
||||||
|
|
||||||
|
- `/etc/mqm/pki/keys/mykey/tls.key`
|
||||||
|
- `/etc/mqm/pki/keys/mykey/tls.crt`
|
||||||
|
- `/etc/mqm/pki/keys/mykey/ca.crt`
|
||||||
|
- `/etc/mqm/pki/trust/0/tls.crt`
|
||||||
|
- `/etc/mqm/pki/trust/1/tls.crt`
|
||||||
|
|
||||||
|
This can be achieved by either mounting the directories or files into the container when you run it or by baking the files into the correct location in the image.
|
||||||
|
|
||||||
|
If you supply multiple identity certificates then the first label alphabetically will be chosen as the certificate to be used by the MQ Console and the default certificate for the queue manager. If you wish to use a different certificate on the queue manager then you can change the certificate to use at runtime by executing the MQSC command `ALTER QMGR CERTLABL('<newlabel>')`
|
||||||
19
etc/mqm/15-tls.mqsc.tpl
Normal file
19
etc/mqm/15-tls.mqsc.tpl
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
* © 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.
|
||||||
|
|
||||||
|
* Set the keystore location for the queue manager
|
||||||
|
ALTER QMGR SSLKEYR('{{ .SSLKeyR }}')
|
||||||
|
ALTER QMGR CERTLABL('{{ .CertificateLabel }}')
|
||||||
|
|
||||||
92
glide.lock
generated
92
glide.lock
generated
@@ -1,47 +1,57 @@
|
|||||||
hash: 4905ad6acf8e593e3c4432f31dd61275b16d0b5b95f438471749ae1943af785d
|
hash: 6ebd5fb1c39729378c7256da6f312e9699bff1ddff9941d3c8c1ba785e22acfd
|
||||||
updated: 2018-02-22T17:26:13.366677Z
|
updated: 2019-05-21T10:38:01.227081+01:00
|
||||||
imports:
|
imports:
|
||||||
- name: golang.org/x/crypto
|
- name: github.com/beorn7/perks
|
||||||
version: 81e90905daefcd6fd217b62423c0908922eadb30
|
version: 3a771d992973f24aa725d07868b467d1ddfceafb
|
||||||
subpackages:
|
subpackages:
|
||||||
- acme
|
- quantile
|
||||||
- acme/autocert
|
- name: github.com/genuinetools/amicontained
|
||||||
- blowfish
|
version: fcae88544f0212fbb1e20699c41566655b68679b
|
||||||
- cast5
|
subpackages:
|
||||||
- chacha20poly1305/internal/chacha20
|
- container
|
||||||
- cryptobyte
|
- name: github.com/golang/protobuf
|
||||||
- curve25519
|
version: 70b3af33377e7aa25ae42977bed93cc6b90f0373
|
||||||
- ed25519
|
subpackages:
|
||||||
- ed25519/internal/edwards25519
|
- proto
|
||||||
- hkdf
|
- name: github.com/ibm-messaging/mq-golang
|
||||||
- md4
|
version: 1b2a2ad95ba3c555944be28097d392c27bda4071
|
||||||
- nacl/auth
|
subpackages:
|
||||||
- nacl/box
|
- ibmmq
|
||||||
- nacl/secretbox
|
- mqmetric
|
||||||
- openpgp
|
- name: github.com/matttproud/golang_protobuf_extensions
|
||||||
- openpgp/armor
|
version: c12348ce28de40eed0136aa2b644d0ee0650e56c
|
||||||
- openpgp/elgamal
|
subpackages:
|
||||||
- openpgp/errors
|
- pbutil
|
||||||
- openpgp/packet
|
- name: github.com/prometheus/client_golang
|
||||||
- openpgp/s2k
|
version: c5b7fccd204277076155f10851dad72b76a49317
|
||||||
- pbkdf2
|
subpackages:
|
||||||
- pkcs12/internal/rc2
|
- prometheus
|
||||||
- poly1305
|
- name: github.com/prometheus/client_model
|
||||||
- ripemd160
|
version: 5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f
|
||||||
- salsa20/salsa
|
subpackages:
|
||||||
- ssh
|
- go
|
||||||
- ssh/agent
|
- name: github.com/prometheus/common
|
||||||
- ssh/terminal
|
version: 7600349dcfe1abd18d72d3a1770870d9800a7801
|
||||||
- ssh/testdata
|
subpackages:
|
||||||
|
- expfmt
|
||||||
|
- internal/bitbucket.org/ww/goautoneg
|
||||||
|
- model
|
||||||
|
- name: github.com/prometheus/procfs
|
||||||
|
version: ae68e2d4c00fed4943b5f6698d504a5fe083da8a
|
||||||
|
subpackages:
|
||||||
|
- internal/util
|
||||||
|
- nfs
|
||||||
|
- xfs
|
||||||
|
- name: github.com/syndtr/gocapability
|
||||||
|
version: 33e07d32887e1e06b7c025f27ce52f62c7990bc0
|
||||||
|
subpackages:
|
||||||
|
- capability
|
||||||
- name: golang.org/x/sys
|
- name: golang.org/x/sys
|
||||||
version: 7a4fde3fda8ef580a89dbae8138c26041be14299
|
version: 1b2967e3c290b7c545b3db0deeda16e9be4f98a2
|
||||||
subpackages:
|
subpackages:
|
||||||
- plan9
|
|
||||||
- unix
|
- unix
|
||||||
- windows
|
- name: software.sslmate.com/src/go-pkcs12
|
||||||
- windows/registry
|
version: 6e380ad96778cc63c6ea17649a9b74224bceafe9
|
||||||
- windows/svc
|
subpackages:
|
||||||
- windows/svc/debug
|
- internal/rc2
|
||||||
- windows/svc/eventlog
|
|
||||||
- windows/svc/mgr
|
|
||||||
testImports: []
|
testImports: []
|
||||||
|
|||||||
10
glide.yaml
10
glide.yaml
@@ -1,4 +1,4 @@
|
|||||||
# © Copyright IBM Corporation 2017
|
# © Copyright IBM Corporation 2017, 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.
|
||||||
@@ -20,3 +20,11 @@ excludeDirs:
|
|||||||
- test
|
- test
|
||||||
import:
|
import:
|
||||||
- package: golang.org/x/sys/unix
|
- package: golang.org/x/sys/unix
|
||||||
|
- package: github.com/prometheus/client_golang
|
||||||
|
version: 0.8.0
|
||||||
|
- package: github.com/ibm-messaging/mq-golang
|
||||||
|
version: 2.0.0
|
||||||
|
- package: github.com/genuinetools/amicontained
|
||||||
|
version: 0.4.0
|
||||||
|
- package: software.sslmate.com/src/go-pkcs12
|
||||||
|
commit: 6e380ad96778cc63c6ea17649a9b74224bceafe9
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# © Copyright IBM Corporation 2015, 2017
|
# © Copyright IBM Corporation 2015, 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.
|
||||||
@@ -15,14 +15,16 @@
|
|||||||
FROM ubuntu:16.04
|
FROM ubuntu:16.04
|
||||||
|
|
||||||
# The URL to download the MQ installer from in tar.gz format
|
# The URL to download the MQ installer from in tar.gz format
|
||||||
ARG MQ_URL=https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev903_ubuntu_x86-64.tar.gz
|
ARG MQ_URL=https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev911_ubuntu_x86-64.tar.gz
|
||||||
|
|
||||||
# The MQ packages to install
|
# The MQ packages to install
|
||||||
ARG MQ_PACKAGES="ibmmq-sfbridge"
|
ARG MQ_PACKAGES="ibmmq-sfbridge"
|
||||||
|
|
||||||
|
ARG MQM_UID=999
|
||||||
|
|
||||||
ADD install-mq.sh /usr/local/bin/
|
ADD install-mq.sh /usr/local/bin/
|
||||||
RUN chmod u+x /usr/local/bin/install-mq.sh \
|
RUN chmod u+x /usr/local/bin/install-mq.sh \
|
||||||
&& install-mq.sh
|
&& install-mq.sh $MQM_UID
|
||||||
|
|
||||||
ENV LANG=en_US.UTF-8
|
ENV LANG=en_US.UTF-8
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# © Copyright IBM Corporation 2015, 2017
|
# © Copyright IBM Corporation 2015, 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,27 +12,33 @@
|
|||||||
# 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 ubuntu:16.04
|
FROM registry.access.redhat.com/ubi7/ubi-minimal AS mq-explorer
|
||||||
|
|
||||||
# The URL to download the MQ installer from in tar.gz format
|
# The URL to download the MQ installer from in tar.gz format
|
||||||
ARG MQ_URL=https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev903_ubuntu_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"
|
||||||
|
|
||||||
# The MQ packages to install
|
# The MQ packages to install
|
||||||
ARG MQ_PACKAGES="ibmmq-explorer"
|
ENV MQ_PACKAGES="MQSeriesRuntime*.rpm MQSeriesJRE*.rpm MQSeriesExplorer*.rpm"
|
||||||
|
|
||||||
RUN export DEBIAN_FRONTEND=noninteractive \
|
ARG MQM_UID=888
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install -y \
|
RUN microdnf install -y --nodocs gtk2 libXtst \
|
||||||
libgtk2.0-0 \
|
&& microdnf clean all
|
||||||
libxtst6
|
|
||||||
|
|
||||||
ADD install-mq.sh /usr/local/bin/
|
ADD install-mq.sh /usr/local/bin/
|
||||||
|
|
||||||
|
# Install MQ Explorer. To avoid a "text file busy" error here, we sleep before installing.
|
||||||
|
# Need to re-instate the `/var/mqm` directory after installation, to avoid MQ
|
||||||
|
# errors with some commands (e.g. `dspmqver`)
|
||||||
RUN chmod u+x /usr/local/bin/install-mq.sh \
|
RUN chmod u+x /usr/local/bin/install-mq.sh \
|
||||||
&& install-mq.sh
|
&& sleep 1 \
|
||||||
|
&& install-mq.sh $MQM_UID \
|
||||||
|
&& rm -rf /var/mqm \
|
||||||
|
&& /opt/mqm/bin/crtmqdir -f -s
|
||||||
|
|
||||||
ENV LANG=en_US.UTF-8
|
ENV LANG=en_US.UTF-8
|
||||||
|
|
||||||
# Run as mqm (999)
|
# Run as mqm
|
||||||
USER 999
|
USER $MQM_UID
|
||||||
|
|
||||||
ENTRYPOINT ["MQExplorer"]
|
ENTRYPOINT ["MQExplorer"]
|
||||||
38
incubating/mq-sdk/Dockerfile
Normal file
38
incubating/mq-sdk/Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# © 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.
|
||||||
|
|
||||||
|
FROM registry.access.redhat.com/rhscl/devtoolset-7-toolchain-rhel7 AS mq-sdk
|
||||||
|
#FROM docker.io/centos/devtoolset-7-toolchain-centos7 AS mq-sdk
|
||||||
|
|
||||||
|
# The URL to download the MQ installer from in tar.gz format
|
||||||
|
# This assumes an archive containing the MQ Debian (.deb) install packages
|
||||||
|
ARG MQ_URL
|
||||||
|
|
||||||
|
# The packages to install in install-mq.sh
|
||||||
|
ENV MQ_PACKAGES="MQSeriesRuntime-*.rpm MQSeriesSDK-*.rpm MQSeriesSamples*.rpm"
|
||||||
|
|
||||||
|
ENV MQM_UID=888
|
||||||
|
|
||||||
|
USER 0
|
||||||
|
COPY install-mq.sh /usr/local/bin/
|
||||||
|
|
||||||
|
# Install MQ. To avoid a "text file busy" error here, we sleep before installing.
|
||||||
|
# Need to re-instate the `/var/mqm` directory after installation, to avoid MQ
|
||||||
|
# errors with some commands (e.g. `dspmqver`)
|
||||||
|
RUN chmod u+x /usr/local/bin/install-mq.sh \
|
||||||
|
&& sleep 1 \
|
||||||
|
&& install-mq.sh $MQM_UID \
|
||||||
|
&& rm -rf /var/mqm \
|
||||||
|
&& /opt/mqm/bin/crtmqdir -f -s
|
||||||
|
USER 1001
|
||||||
13
incubating/mq-sdk/README.md
Normal file
13
incubating/mq-sdk/README.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# IBM MQ Software Developer Kit (SDK)
|
||||||
|
|
||||||
|
This image contains the MQ SDK and the `build-essential` package, which includes GNU C and C++ compilers plus other essential tools.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
For example, you could compile the `amqsput0.c` sample program by running the following command in an SDK container:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
gcc -o /tmp/amqsput0 /opt/mqm/samp/amqsput0.c -I /opt/mqm/inc -L /opt/mqm/lib64 -lmqm
|
||||||
|
```
|
||||||
|
|
||||||
|
Compiler and linker output is placed on the container's filesystem, so using multi-stage Docker builds is useful to build a final container.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
* © Copyright IBM Corporation 2017, 2018
|
* © Copyright IBM Corporation 2017, 2019
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@@ -13,7 +13,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.
|
||||||
|
|
||||||
STOP LISTENER('SYSTEM.DEFAULT.LISTENER.TCP')
|
STOP LISTENER('SYSTEM.LISTENER.TCP.1') IGNSTATE(YES)
|
||||||
|
ALTER LISTENER('SYSTEM.LISTENER.TCP.1') TRPTYPE(TCP) CONTROL(MANUAL)
|
||||||
|
|
||||||
* Developer queues
|
* Developer queues
|
||||||
DEFINE QLOCAL('DEV.QUEUE.1') REPLACE
|
DEFINE QLOCAL('DEV.QUEUE.1') REPLACE
|
||||||
@@ -32,9 +33,10 @@ DEFINE AUTHINFO('DEV.AUTHINFO') AUTHTYPE(IDPWOS) CHCKCLNT(REQDADM) CHCKLOCL(OPTI
|
|||||||
ALTER QMGR CONNAUTH('DEV.AUTHINFO')
|
ALTER QMGR CONNAUTH('DEV.AUTHINFO')
|
||||||
REFRESH SECURITY(*) TYPE(CONNAUTH)
|
REFRESH SECURITY(*) TYPE(CONNAUTH)
|
||||||
|
|
||||||
|
* Developer channels (Application + Admin)
|
||||||
* Developer channels (Application + Admin)
|
* Developer channels (Application + Admin)
|
||||||
DEFINE CHANNEL('DEV.ADMIN.SVRCONN') CHLTYPE(SVRCONN) REPLACE
|
DEFINE CHANNEL('DEV.ADMIN.SVRCONN') CHLTYPE(SVRCONN) REPLACE
|
||||||
DEFINE CHANNEL('DEV.APP.SVRCONN') CHLTYPE(SVRCONN) REPLACE
|
DEFINE CHANNEL('DEV.APP.SVRCONN') CHLTYPE(SVRCONN) MCAUSER('app') REPLACE
|
||||||
|
|
||||||
* Developer channel authentication rules
|
* Developer channel authentication rules
|
||||||
SET CHLAUTH('*') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(NOACCESS) DESCR('Back-stop rule - Blocks everyone') ACTION(REPLACE)
|
SET CHLAUTH('*') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(NOACCESS) DESCR('Back-stop rule - Blocks everyone') ACTION(REPLACE)
|
||||||
@@ -43,11 +45,10 @@ SET CHLAUTH('DEV.ADMIN.SVRCONN') TYPE(BLOCKUSER) USERLIST('nobody') DESCR('Allow
|
|||||||
SET CHLAUTH('DEV.ADMIN.SVRCONN') TYPE(USERMAP) CLNTUSER('admin') USERSRC(CHANNEL) DESCR('Allows admin user to connect via ADMIN channel') ACTION(REPLACE)
|
SET CHLAUTH('DEV.ADMIN.SVRCONN') TYPE(USERMAP) CLNTUSER('admin') USERSRC(CHANNEL) DESCR('Allows admin user to connect via ADMIN channel') ACTION(REPLACE)
|
||||||
|
|
||||||
* Developer authority records
|
* Developer authority records
|
||||||
SET AUTHREC PROFILE('DEV.AUTHINFO') GROUP('root') OBJTYPE(AUTHINFO) AUTHADD(CHG,DLT,DSP,INQ)
|
SET AUTHREC GROUP('mqclient') OBJTYPE(QMGR) AUTHADD(CONNECT,INQ)
|
||||||
SET AUTHREC PROFILE('DEV.AUTHINFO') GROUP('mqm') OBJTYPE(AUTHINFO) AUTHADD(CHG,DLT,DSP,INQ)
|
|
||||||
SET AUTHREC PROFILE('DEV.**') GROUP('mqclient') OBJTYPE(QUEUE) AUTHADD(BROWSE,GET,INQ,PUT)
|
SET AUTHREC PROFILE('DEV.**') GROUP('mqclient') OBJTYPE(QUEUE) AUTHADD(BROWSE,GET,INQ,PUT)
|
||||||
SET AUTHREC PROFILE('DEV.**') GROUP('mqclient') OBJTYPE(TOPIC) AUTHADD(PUB,SUB)
|
SET AUTHREC PROFILE('DEV.**') GROUP('mqclient') OBJTYPE(TOPIC) AUTHADD(PUB,SUB)
|
||||||
|
|
||||||
* Developer listener
|
* Developer listener
|
||||||
DEFINE LISTENER('DEV.LISTENER.TCP') TRPTYPE(TCP) PORT(1414) CONTROL(QMGR) REPLACE
|
DEFINE LISTENER('DEV.LISTENER.TCP') TRPTYPE(TCP) PORT(1414) CONTROL(QMGR) REPLACE
|
||||||
START LISTENER('DEV.LISTENER.TCP')
|
START LISTENER('DEV.LISTENER.TCP') IGNSTATE(YES)
|
||||||
18
incubating/mqadvanced-server-dev/20-dev-tls.mqsc.tpl
Normal file
18
incubating/mqadvanced-server-dev/20-dev-tls.mqsc.tpl
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
* © 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.
|
||||||
|
|
||||||
|
* Set the cipherspec for dev channels
|
||||||
|
ALTER CHANNEL('DEV.APP.SVRCONN') CHLTYPE(SVRCONN) SSLCIPH({{ .SSLCipherSpec }}) SSLCAUTH(OPTIONAL)
|
||||||
|
ALTER CHANNEL('DEV.ADMIN.SVRCONN') CHLTYPE(SVRCONN) SSLCIPH({{ .SSLCipherSpec }}) SSLCAUTH(OPTIONAL)
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
# © Copyright IBM Corporation 2015, 2018
|
|
||||||
#
|
|
||||||
# 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 stage to build Go code
|
|
||||||
###############################################################################
|
|
||||||
FROM golang:1.9 as builder
|
|
||||||
WORKDIR /go/src/github.com/ibm-messaging/mq-container/
|
|
||||||
COPY cmd/ ./cmd
|
|
||||||
COPY internal/ ./internal
|
|
||||||
COPY vendor/ ./vendor
|
|
||||||
# Re-build runmqserver, with code tagged with 'mqdev' enabled
|
|
||||||
RUN go build --tags 'mqdev' ./cmd/runmqserver
|
|
||||||
RUN go build ./cmd/runmqdevserver/
|
|
||||||
# Run all unit tests
|
|
||||||
RUN go test -v ./cmd/runmqdevserver/...
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Main build stage
|
|
||||||
###############################################################################
|
|
||||||
FROM mqadvanced-server-dev-base:9.0.4.0-x86_64-ubuntu-16.04
|
|
||||||
|
|
||||||
# Enable MQ developer default configuration
|
|
||||||
ENV MQ_DEV=true
|
|
||||||
|
|
||||||
# Default administrator password
|
|
||||||
ENV MQ_ADMIN_PASSWORD=passw0rd
|
|
||||||
|
|
||||||
## Add admin and app users, and set a default password for admin
|
|
||||||
RUN useradd admin -G mqm \
|
|
||||||
&& groupadd mqclient \
|
|
||||||
&& useradd app -G mqclient,mqm \
|
|
||||||
&& echo admin:$MQ_ADMIN_PASSWORD | chpasswd
|
|
||||||
|
|
||||||
COPY --from=builder /go/src/github.com/ibm-messaging/mq-container/runmqserver /usr/local/bin/
|
|
||||||
COPY --from=builder /go/src/github.com/ibm-messaging/mq-container/runmqdevserver /usr/local/bin/
|
|
||||||
# Copy template MQSC for default developer configuration
|
|
||||||
COPY incubating/mqadvanced-server-dev/dev.mqsc.tpl /etc/mqm/
|
|
||||||
# Copy web XML files for default developer configuration
|
|
||||||
COPY incubating/mqadvanced-server-dev/web /etc/mqm/web
|
|
||||||
RUN chmod +x /usr/local/bin/runmq*
|
|
||||||
|
|
||||||
EXPOSE 9443
|
|
||||||
|
|
||||||
ENTRYPOINT ["runmqdevserver"]
|
|
||||||
78
incubating/mqadvanced-server-dev/admin.json.tpl
Normal file
78
incubating/mqadvanced-server-dev/admin.json.tpl
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
"version": 0.1,
|
||||||
|
"tabs": [
|
||||||
|
{
|
||||||
|
"title": "IBM MQ Container",
|
||||||
|
"numColumns": 2,
|
||||||
|
"model": {
|
||||||
|
"title": "",
|
||||||
|
"rows": [
|
||||||
|
{
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"widgets": [
|
||||||
|
{
|
||||||
|
"type": "channel",
|
||||||
|
"config": {
|
||||||
|
"selectedQM": "{{ .QueueManagerName }}",
|
||||||
|
"showSysObjs": false,
|
||||||
|
"sizex": 1,
|
||||||
|
"sizey": 1,
|
||||||
|
"subType": "all"
|
||||||
|
},
|
||||||
|
"title": "Channels on {{ .QueueManagerName }}",
|
||||||
|
"titleTemplateUrl": "adf/templates/widget-title.html",
|
||||||
|
"gridsterrow": 0,
|
||||||
|
"gridstercol": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "topic",
|
||||||
|
"config": {
|
||||||
|
"selectedQM": "{{ .QueueManagerName }}",
|
||||||
|
"showSysObjs": false,
|
||||||
|
"sizex": 1,
|
||||||
|
"sizey": 1
|
||||||
|
},
|
||||||
|
"title": "Topics on {{ .QueueManagerName }}",
|
||||||
|
"titleTemplateUrl": "adf/templates/widget-title.html",
|
||||||
|
"gridsterrow": 1,
|
||||||
|
"gridstercol": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "queue",
|
||||||
|
"config": {
|
||||||
|
"selectedQM": "{{ .QueueManagerName }}",
|
||||||
|
"showSysObjs": false,
|
||||||
|
"sizex": 1,
|
||||||
|
"sizey": 1,
|
||||||
|
"subType": "all"
|
||||||
|
},
|
||||||
|
"title": "Queues on {{ .QueueManagerName }}",
|
||||||
|
"titleTemplateUrl": "adf/templates/widget-title.html",
|
||||||
|
"gridsterrow": 1,
|
||||||
|
"gridstercol": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "queuemanager",
|
||||||
|
"gridstercol": 0,
|
||||||
|
"gridsterrow": 0,
|
||||||
|
"config": {
|
||||||
|
"type": "local",
|
||||||
|
"sizex": 1,
|
||||||
|
"sizey": 1,
|
||||||
|
"customTitle": "Queue Manager"
|
||||||
|
},
|
||||||
|
"title": "Queue Manager",
|
||||||
|
"titleTemplateUrl": "adf/templates/widget-title.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"titleTemplateUrl": "adf/templates/dashboard-title.html"
|
||||||
|
},
|
||||||
|
"isMobile": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Change admin password
|
|
||||||
if [ -n "${MQ_ADMIN_PASSWORD}" ]; then
|
|
||||||
echo admin:${MQ_ADMIN_PASSWORD} | chpasswd
|
|
||||||
fi
|
|
||||||
# Change app password
|
|
||||||
if [ -n "${MQ_APP_PASSWORD}" ]; then
|
|
||||||
echo app:${MQ_APP_PASSWORD} | chpasswd
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Delete the MQSC with developer defaults, if requested
|
|
||||||
if [ "${MQ_DEV}" != "true" ]; then
|
|
||||||
rm -f /etc/mqm/dev.mqsc
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec runmqserver
|
|
||||||
38
incubating/mqadvanced-server-dev/install-extra-packages.sh
Normal file
38
incubating/mqadvanced-server-dev/install-extra-packages.sh
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/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.
|
||||||
|
|
||||||
|
test -f /usr/bin/yum && YUM=true || YUM=false
|
||||||
|
test -f /usr/bin/microdnf && MICRODNF=true || MICRODNF=false
|
||||||
|
test -f /usr/bin/apt-get && UBUNTU=true || UBUNTU=false
|
||||||
|
|
||||||
|
if ($UBUNTU); then
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y --no-install-recommends sudo
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ($YUM); then
|
||||||
|
yum -y install sudo
|
||||||
|
yum -y clean all
|
||||||
|
rm -rf /var/cache/yum/*
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ($MICRODNF); then
|
||||||
|
microdnf install --nodocs sudo
|
||||||
|
microdnf clean all
|
||||||
|
fi
|
||||||
@@ -16,15 +16,25 @@
|
|||||||
<security-role name="MQWebAdmin">
|
<security-role name="MQWebAdmin">
|
||||||
<group name="MQWebUI" realm="defaultRealm"/>
|
<group name="MQWebUI" realm="defaultRealm"/>
|
||||||
</security-role>
|
</security-role>
|
||||||
|
<security-role name="MQWebUser">
|
||||||
|
<group name="MQWebMessaging" realm="defaultRealm"/>
|
||||||
|
</security-role>
|
||||||
</application-bnd>
|
</application-bnd>
|
||||||
</enterpriseApplication>
|
</enterpriseApplication>
|
||||||
<basicRegistry id="basic" realm="defaultRealm">
|
<basicRegistry id="basic" realm="defaultRealm">
|
||||||
<user name="admin" password="${env.MQ_ADMIN_PASSWORD}"/>
|
<user name="admin" password="${env.MQ_ADMIN_PASSWORD}"/>
|
||||||
|
<!-- The app user will always get a default password of "passw0rd",
|
||||||
|
even if you don't set the environment variable.
|
||||||
|
See `webserver.go` -->
|
||||||
|
<user name="app" password="${env.MQ_APP_PASSWORD}"/>
|
||||||
<group name="MQWebUI">
|
<group name="MQWebUI">
|
||||||
<member name="admin"/>
|
<member name="admin"/>
|
||||||
</group>
|
</group>
|
||||||
|
<group name="MQWebMessaging">
|
||||||
|
<member name="app"/>
|
||||||
|
</group>
|
||||||
</basicRegistry>
|
</basicRegistry>
|
||||||
<variable name="httpHost" value="*"/>
|
<variable name="httpHost" value="*"/>
|
||||||
<httpDispatcher enableWelcomePage="false" appOrContextRootMissingMessage='Redirecting to console.<script>document.location.href="/ibmmq/console";</script>' />
|
<variable name="managementMode" value="externallyprovisioned"/>
|
||||||
<include location="tls.xml"/>
|
<include location="tls.xml"/>
|
||||||
</server>
|
</server>
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
<keyStore id="MQWebKeyStore" location="/var/mqm/web/installations/Installation1/servers/mqweb/key.jks" type="JKS" password="${env.MQ_TLS_PASSPHRASE}"/>
|
|
||||||
<keyStore id="MQWebTrustStore" location="/var/mqm/web/installations/Installation1/servers/mqweb/trust.jks" type="JKS" password="${env.MQ_TLS_PASSPHRASE}"/>
|
|
||||||
<ssl id="thisSSLConfig" clientAuthenticationSupported="true" keyStoreRef="MQWebKeyStore" trustStoreRef="MQWebTrustStore" sslProtocol="TLSv1.2" serverKeyAlias="webcert"/>
|
|
||||||
<sslDefault sslRef="thisSSLConfig"/>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
<sslDefault sslRef="mqDefaultSSLConfig"/>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# © Copyright IBM Corporation 2017
|
# © Copyright IBM Corporation 2018
|
||||||
#
|
#
|
||||||
# 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,9 +12,21 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
apiVersion: v1
|
FROM ibmcom/ibmjava:jre
|
||||||
description: IBM MQ queue manager
|
|
||||||
name: ibm-mqadvanced-server-prod
|
ARG IPTFILE=ms81_2.1.0.4_amd64_linux_2.tar
|
||||||
version: 1.1.0
|
|
||||||
icon: https://developer.ibm.com/messaging/wp-content/uploads/sites/18/2017/12/ibm_mq_200.png
|
COPY $IPTFILE /opt/
|
||||||
tillerVersion: ">=2.4.0"
|
|
||||||
|
RUN rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& cd /opt/ \
|
||||||
|
&& tar xvf ./$IPTFILE \
|
||||||
|
&& chmod -R a-w /opt/mqipt
|
||||||
|
|
||||||
|
ENV MQIPT_PATH=/opt/mqipt
|
||||||
|
|
||||||
|
COPY startMQIPT.sh /usr/local/bin
|
||||||
|
|
||||||
|
VOLUME /var/mqipt
|
||||||
|
|
||||||
|
ENTRYPOINT ["startMQIPT.sh"]
|
||||||
44
incubating/mqipt/README.md
Normal file
44
incubating/mqipt/README.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# IBM MQ Internet Pass-Thru (SupportPac MS81) on Docker
|
||||||
|
|
||||||
|
IBM® MQ Internet Pass-Thru (MQIPT) is an extension to the base IBM MQ product. MQIPT runs as a stand-alone service that can receive and forward IBM MQ message flows, either between two IBM MQ queue managers or between an IBM MQ client and an IBM MQ queue manager.
|
||||||
|
MQIPT enables this connection when the client and server are not on the same physical network.
|
||||||
|
|
||||||
|
This repository contains all of the resources you will need to create a Docker image containing MQIPT for use in your infrastructure.
|
||||||
|
|
||||||
|
## How to build this image
|
||||||
|
|
||||||
|
1. First download MQIPT from the [IBM MQ SupportPacs website](http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg27007198#3). MQIPT is a `Category 3 - Product Extensions SupportPacs` with the identifier `MS81`.
|
||||||
|
2. Ensure the MQIPT downloaded tar file is available in this directory.
|
||||||
|
3. If the tar file is not called `ms81_2.1.0.4_amd64_linux_2.tar` you will need to either:
|
||||||
|
* Rename the file.
|
||||||
|
* Supply the new name as a `--build-arg IPTFILE=<new name>` when executing the docker build command in the next step.
|
||||||
|
* Alter the Dockerfile `IPTFILE` ARG to specify the new file name.
|
||||||
|
4. Run the following command in this directory to build the Docker image. `docker build -t mqipt .`
|
||||||
|
|
||||||
|
Once the Docker build has completed you will have a new Docker image called `mqipt:latest` available which contains MQIPT.
|
||||||
|
|
||||||
|
## How to run this image
|
||||||
|
|
||||||
|
Before you run the MQIPT docker image you should understand how MQIPT operates, please ensure you have read the [MQIPT knowledgecenter](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ipt.doc/ipt0000_.htm) and any documentation supplied with the MQIPT installation tar.
|
||||||
|
|
||||||
|
First you need to create your [MQIPT configuration file](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ipt.doc/ipt2540_.htm) and place this file in a directory that can be [mounted to a docker container](https://docs.docker.com/storage/). This file **must** be called `mqipt.conf`; there is a sample file available in the MQIPT installation tar.
|
||||||
|
|
||||||
|
Run the following command to start a container with your built MQIPT image:
|
||||||
|
|
||||||
|
`docker run -d --volume <path to config>:/var/mqipt -p 1414:1414 mqipt`
|
||||||
|
|
||||||
|
If you want the container ports to be accessible outside of the host you must expose the required ports, this will map the container port to a port on the host, meaning you can connect to that port on the host and access MQIPT. You will need to provide multiple `-p` parameters to expose all of the ports required by your MQIPT configuration. **Note:** these must be available otherwise the docker container will fail to start.
|
||||||
|
|
||||||
|
See [Docker Run reference](https://docs.docker.com/engine/reference/run/#expose-incoming-ports) for more information on how to expose container ports.
|
||||||
|
|
||||||
|
## Further information
|
||||||
|
|
||||||
|
For further information on MQIPT please view the [MQIPT knowledgecenter](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ipt.doc/ipt0000_.htm)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
The Dockerfiles and associated code and scripts are provided as-is and licensed under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
|
||||||
|
|
||||||
|
## Copyright
|
||||||
|
|
||||||
|
© Copyright IBM Corporation 2018
|
||||||
22
charts/ibm-mqadvanced-server-dev/Chart.yaml → incubating/mqipt/startMQIPT.sh
Normal file → Executable file
22
charts/ibm-mqadvanced-server-dev/Chart.yaml → incubating/mqipt/startMQIPT.sh
Normal file → Executable file
@@ -1,4 +1,6 @@
|
|||||||
# © Copyright IBM Corporation 2017
|
#!/bin/bash
|
||||||
|
# -*- mode: sh -*-
|
||||||
|
# © Copyright IBM Corporation 2018
|
||||||
#
|
#
|
||||||
# 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,9 +14,15 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
apiVersion: v1
|
stop()
|
||||||
description: IBM MQ queue manager
|
{
|
||||||
name: ibm-mqadvanced-server-dev
|
/opt/mqipt/bin/mqiptAdmin -stop
|
||||||
version: 1.1.0
|
}
|
||||||
icon: https://developer.ibm.com/messaging/wp-content/uploads/sites/18/2017/12/ibm_mq_200.png
|
|
||||||
tillerVersion: ">=2.4.0"
|
trap stop SIGTERM SIGINT
|
||||||
|
|
||||||
|
# Run MQIPT and then wait on the process to end.
|
||||||
|
/opt/mqipt/bin/mqipt /var/mqipt &
|
||||||
|
MQIPTPROCESS=$!
|
||||||
|
|
||||||
|
wait "$MQIPTPROCESS"
|
||||||
32
charts/ibm-mqadvanced-server-dev/templates/service.yaml → install-build-deps-ubuntu.sh
Normal file → Executable file
32
charts/ibm-mqadvanced-server-dev/templates/service.yaml → install-build-deps-ubuntu.sh
Normal file → Executable file
@@ -1,4 +1,7 @@
|
|||||||
# © Copyright IBM Corporation 2017
|
#!/bin/bash
|
||||||
|
# -*- mode: sh -*-
|
||||||
|
# © Copyright IBM Corporation 2015, 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,21 +15,12 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
apiVersion: v1
|
# Install Docker and dep, required by build (assumes Ubuntu host, as used by Travis build)
|
||||||
kind: Service
|
|
||||||
metadata:
|
set -ex
|
||||||
name: {{ template "fullname" . }}
|
|
||||||
labels:
|
curl https://glide.sh/get | sh
|
||||||
app: {{ template "fullname" . }}
|
sudo curl -Lo /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
sudo chmod +x /usr/local/bin/dep
|
||||||
release: "{{ .Release.Name }}"
|
|
||||||
heritage: "{{ .Release.Service }}"
|
go get -u golang.org/x/lint/golint
|
||||||
spec:
|
|
||||||
type: {{ .Values.service.type }}
|
|
||||||
ports:
|
|
||||||
- port: 1414
|
|
||||||
name: {{ .Values.service.name }}-server
|
|
||||||
- port: 9443
|
|
||||||
name: {{ .Values.service.name }}-web
|
|
||||||
selector:
|
|
||||||
app: {{ template "fullname" . }}
|
|
||||||
81
install-mq-server-prereqs.sh
Normal file
81
install-mq-server-prereqs.sh
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# -*- mode: sh -*-
|
||||||
|
# © Copyright IBM Corporation 2015, 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.
|
||||||
|
|
||||||
|
# Fail on any non-zero return code
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
test -f /usr/bin/yum && YUM=true || YUM=false
|
||||||
|
test -f /usr/bin/microdnf && MICRODNF=true || MICRODNF=false
|
||||||
|
test -f /usr/bin/rpm && RPM=true || RPM=false
|
||||||
|
test -f /usr/bin/apt-get && UBUNTU=true || UBUNTU=false
|
||||||
|
|
||||||
|
if ($UBUNTU); then
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
# Use a reduced set of apt repositories.
|
||||||
|
# This ensures no unsupported code gets installed, and makes the build faster
|
||||||
|
source /etc/os-release
|
||||||
|
# Figure out the correct apt URL based on the CPU architecture
|
||||||
|
CPU_ARCH=$(uname -p)
|
||||||
|
if [ ${CPU_ARCH} == "x86_64" ]; then
|
||||||
|
APT_URL="http://archive.ubuntu.com/ubuntu/"
|
||||||
|
else
|
||||||
|
APT_URL="http://ports.ubuntu.com/ubuntu-ports/"
|
||||||
|
fi
|
||||||
|
# Use a reduced set of apt repositories.
|
||||||
|
# This ensures no unsupported code gets installed, and makes the build faster
|
||||||
|
echo "deb ${APT_URL} ${UBUNTU_CODENAME} main restricted" > /etc/apt/sources.list
|
||||||
|
echo "deb ${APT_URL} ${UBUNTU_CODENAME}-updates main restricted" >> /etc/apt/sources.list
|
||||||
|
echo "deb ${APT_URL} ${UBUNTU_CODENAME}-security main restricted" >> /etc/apt/sources.list
|
||||||
|
# Install additional packages required by MQ, this install process and the runtime scripts
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
bash \
|
||||||
|
bc \
|
||||||
|
ca-certificates \
|
||||||
|
coreutils \
|
||||||
|
curl \
|
||||||
|
debianutils \
|
||||||
|
file \
|
||||||
|
findutils \
|
||||||
|
gawk \
|
||||||
|
grep \
|
||||||
|
libc-bin \
|
||||||
|
mount \
|
||||||
|
passwd \
|
||||||
|
procps \
|
||||||
|
sed \
|
||||||
|
tar \
|
||||||
|
util-linux
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ($RPM); then
|
||||||
|
EXTRA_RPMS="bash bc ca-certificates coreutils file findutils gawk glibc-common grep passwd procps-ng sed shadow-utils tar util-linux which"
|
||||||
|
# Install additional packages required by MQ, this install process and the runtime scripts
|
||||||
|
$YUM && yum -y install --setopt install_weak_deps=false ${EXTRA_RPMS}
|
||||||
|
$MICRODNF && microdnf install --nodocs ${EXTRA_RPMS}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Apply any bug fixes not included in base Ubuntu or MQ image.
|
||||||
|
# Don't upgrade everything based on Docker best practices https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run
|
||||||
|
$UBUNTU && apt-get install -y libapparmor1 libsystemd0 systemd systemd-sysv libudev1 perl-base --only-upgrade
|
||||||
|
# End of bug fixes
|
||||||
|
|
||||||
|
# Clean up cached files
|
||||||
|
$UBUNTU && rm -rf /var/lib/apt/lists/*
|
||||||
|
$YUM && yum -y clean all
|
||||||
|
$YUM && rm -rf /var/cache/yum/*
|
||||||
|
$MICRODNF && microdnf clean all
|
||||||
127
install-mq.sh
127
install-mq.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- mode: sh -*-
|
# -*- mode: sh -*-
|
||||||
# © Copyright IBM Corporation 2015, 2018
|
# © Copyright IBM Corporation 2015, 2019
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@@ -18,90 +18,27 @@
|
|||||||
# Fail on any non-zero return code
|
# Fail on any non-zero return code
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
test -f /usr/bin/yum && RHEL=true || RHEL=false
|
mqm_uid=${1:-888}
|
||||||
|
|
||||||
|
test -f /usr/bin/yum && YUM=true || YUM=false
|
||||||
|
test -f /usr/bin/microdnf && MICRODNF=true || MICRODNF=false
|
||||||
|
test -f /usr/bin/rpm && RPM=true || RPM=false
|
||||||
test -f /usr/bin/apt-get && UBUNTU=true || UBUNTU=false
|
test -f /usr/bin/apt-get && UBUNTU=true || UBUNTU=false
|
||||||
|
|
||||||
# If MQ_PACKAGES isn't specifically set, then choose a valid set of defaults
|
|
||||||
if [ -z "$MQ_PACKAGES" ]; then
|
|
||||||
$UBUNTU && MQ_PACKAGES="ibmmq-server ibmmq-java ibmmq-jre ibmmq-gskit ibmmq-msg-.* ibmmq-samples ibmmq-ams"
|
|
||||||
$RHEL && MQ_PACKAGES="MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm MQSeriesJava*.rpm MQSeriesJRE*.rpm MQSeriesGSKit*.rpm MQSeriesMsg*.rpm MQSeriesSamples*.rpm MQSeriesAMS-*.rpm"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ($UBUNTU); then
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
|
||||||
# Use a reduced set of apt repositories.
|
|
||||||
# This ensures no unsupported code gets installed, and makes the build faster
|
|
||||||
source /etc/os-release
|
|
||||||
echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME} main restricted" > /etc/apt/sources.list
|
|
||||||
echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME}-updates main restricted" >> /etc/apt/sources.list
|
|
||||||
echo "deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME}-security main restricted" >> /etc/apt/sources.list
|
|
||||||
# Install additional packages required by MQ, this install process and the runtime scripts
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
bash \
|
|
||||||
bc \
|
|
||||||
ca-certificates \
|
|
||||||
coreutils \
|
|
||||||
curl \
|
|
||||||
debianutils \
|
|
||||||
file \
|
|
||||||
findutils \
|
|
||||||
gawk \
|
|
||||||
grep \
|
|
||||||
libc-bin \
|
|
||||||
mount \
|
|
||||||
passwd \
|
|
||||||
procps \
|
|
||||||
sed \
|
|
||||||
tar \
|
|
||||||
util-linux
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install additional packages required by MQ, this install process and the runtime scripts
|
|
||||||
$RHEL && yum -y install \
|
|
||||||
bash \
|
|
||||||
bc \
|
|
||||||
ca-certificates \
|
|
||||||
coreutils \
|
|
||||||
curl \
|
|
||||||
file \
|
|
||||||
findutils \
|
|
||||||
gawk \
|
|
||||||
glibc-common \
|
|
||||||
grep \
|
|
||||||
passwd \
|
|
||||||
procps-ng \
|
|
||||||
sed \
|
|
||||||
tar \
|
|
||||||
util-linux
|
|
||||||
|
|
||||||
# Download and extract the MQ installation files
|
# Download and extract the MQ installation files
|
||||||
DIR_EXTRACT=/tmp/mq
|
DIR_EXTRACT=/tmp/mq
|
||||||
mkdir -p ${DIR_EXTRACT}
|
mkdir -p ${DIR_EXTRACT}
|
||||||
cd ${DIR_EXTRACT}
|
cd ${DIR_EXTRACT}
|
||||||
curl -LO $MQ_URL
|
curl -LO $MQ_URL
|
||||||
tar -zxvf ./*.tar.gz
|
tar -zxf ./*.tar.gz
|
||||||
|
|
||||||
# Remove packages only needed by this script
|
|
||||||
$UBUNTU && apt-get purge -y \
|
|
||||||
ca-certificates \
|
|
||||||
curl
|
|
||||||
|
|
||||||
# Note: ca-certificates and curl are installed by default in RHEL
|
|
||||||
|
|
||||||
# Remove any orphaned packages
|
|
||||||
$UBUNTU && apt-get autoremove -y
|
|
||||||
|
|
||||||
# Recommended: Create the mqm user ID with a fixed UID and group, so that the file permissions work between different images
|
# Recommended: Create the mqm user ID with a fixed UID and group, so that the file permissions work between different images
|
||||||
$UBUNTU && groupadd --system --gid 999 mqm
|
groupadd --system --gid ${mqm_uid} mqm
|
||||||
$UBUNTU && useradd --system --uid 999 --gid mqm mqm
|
useradd --system --uid ${mqm_uid} --gid mqm --groups 0 mqm
|
||||||
$RHEL && groupadd --system --gid 888 mqm
|
|
||||||
$RHEL && useradd --system --uid 888 --gid mqm mqm
|
|
||||||
usermod -G mqm root
|
|
||||||
|
|
||||||
# Find directory containing .deb files
|
# Find directory containing .deb files
|
||||||
$UBUNTU && DIR_DEB=$(find ${DIR_EXTRACT} -name "*.deb" -printf "%h\n" | sort -u | head -1)
|
$UBUNTU && DIR_DEB=$(find ${DIR_EXTRACT} -name "*.deb" -printf "%h\n" | sort -u | head -1)
|
||||||
$RHEL && DIR_RPM=$(find ${DIR_EXTRACT} -name "*.rpm" -printf "%h\n" | sort -u | head -1)
|
$RPM && DIR_RPM=$(find ${DIR_EXTRACT} -name "*.rpm" -printf "%h\n" | sort -u | head -1)
|
||||||
# Find location of mqlicense.sh
|
# Find location of mqlicense.sh
|
||||||
MQLICENSE=$(find ${DIR_EXTRACT} -name "mqlicense.sh")
|
MQLICENSE=$(find ${DIR_EXTRACT} -name "mqlicense.sh")
|
||||||
|
|
||||||
@@ -113,10 +50,11 @@ $UBUNTU && echo "deb [trusted=yes] file:${DIR_DEB} ./" > /etc/apt/sources.list.d
|
|||||||
$UBUNTU && apt-get update
|
$UBUNTU && apt-get update
|
||||||
$UBUNTU && apt-get install -y $MQ_PACKAGES
|
$UBUNTU && apt-get install -y $MQ_PACKAGES
|
||||||
|
|
||||||
$RHEL && cd $DIR_RPM && rpm -ivh $MQ_PACKAGES
|
$RPM && cd $DIR_RPM && rpm -ivh $MQ_PACKAGES
|
||||||
|
|
||||||
# Remove 32-bit libraries from 64-bit container
|
# Remove 32-bit libraries from 64-bit container
|
||||||
find /opt/mqm /var/mqm -type f -exec file {} \; | awk -F: '/ELF 32-bit/{print $1}' | xargs --no-run-if-empty rm -f
|
# The "file" utility isn't installed by default in UBI, so only try this if it's installed
|
||||||
|
which file && find /opt/mqm /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
|
# Remove tar.gz files unpacked by RPM postinst scripts
|
||||||
find /opt/mqm -name '*.tar.gz' -delete
|
find /opt/mqm -name '*.tar.gz' -delete
|
||||||
@@ -128,35 +66,44 @@ find /opt/mqm -name '*.tar.gz' -delete
|
|||||||
$UBUNTU && rm -f /etc/apt/sources.list.d/IBM_MQ.list
|
$UBUNTU && rm -f /etc/apt/sources.list.d/IBM_MQ.list
|
||||||
rm -rf ${DIR_EXTRACT}
|
rm -rf ${DIR_EXTRACT}
|
||||||
|
|
||||||
# Apply any bug fixes not included in base Ubuntu or MQ image.
|
|
||||||
# Don't upgrade everything based on Docker best practices https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run
|
|
||||||
$UBUNTU && apt-get upgrade -y sensible-utils
|
|
||||||
# End of bug fixes
|
|
||||||
|
|
||||||
# Clean up cached files
|
|
||||||
$UBUNTU && rm -rf /var/lib/apt/lists/*
|
|
||||||
$RHEL && yum -y clean all
|
|
||||||
$RHEL && rm -rf /var/cache/yum/*
|
|
||||||
|
|
||||||
# Optional: Update the command prompt with the MQ version
|
# Optional: Update the command prompt with the MQ version
|
||||||
$UBUNTU && echo "mq:$(dspmqver -b -f 2)" > /etc/debian_chroot
|
$UBUNTU && echo "mq:$(dspmqver -b -f 2)" > /etc/debian_chroot
|
||||||
|
|
||||||
# Remove the directory structure under /var/mqm which was created by the installer
|
# Remove the directory structure under /var/mqm which was created by the installer
|
||||||
rm -rf /var/mqm
|
rm -rf /var/mqm
|
||||||
|
|
||||||
# Create the mount point for volumes
|
# Create the mount point for volumes, ensuring MQ has permissions to all directories
|
||||||
mkdir -p /mnt/mqm
|
install --directory --mode 0775 --owner mqm --group root /mnt
|
||||||
|
install --directory --mode 0775 --owner mqm --group root /mnt/mqm
|
||||||
|
install --directory --mode 0775 --owner mqm --group root /mnt/mqm/data
|
||||||
|
install --directory --mode 0775 --owner mqm --group root /mnt/mqm-log
|
||||||
|
install --directory --mode 0775 --owner mqm --group root /mnt/mqm-log/log
|
||||||
|
install --directory --mode 0775 --owner mqm --group root /mnt/mqm-data
|
||||||
|
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
|
||||||
mkdir -p /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
|
||||||
|
|
||||||
# Optional: Set these values for the Bluemix Vulnerability Report
|
# Optional: Ensure any passwords expire in a timely manner
|
||||||
sed -i 's/PASS_MAX_DAYS\t99999/PASS_MAX_DAYS\t90/' /etc/login.defs
|
sed -i 's/PASS_MAX_DAYS\t99999/PASS_MAX_DAYS\t90/' /etc/login.defs
|
||||||
sed -i 's/PASS_MIN_DAYS\t0/PASS_MIN_DAYS\t1/' /etc/login.defs
|
sed -i 's/PASS_MIN_DAYS\t0/PASS_MIN_DAYS\t1/' /etc/login.defs
|
||||||
|
sed -i 's/PASS_MIN_LEN\t5/PASS_MIN_LEN\t8/' /etc/login.defs
|
||||||
|
sed -i 's/# minlen = 9/minlen = 8/' /etc/security/pwquality.conf
|
||||||
|
|
||||||
$UBUNTU && PAM_FILE=/etc/pam.d/common-password
|
$UBUNTU && PAM_FILE=/etc/pam.d/common-password
|
||||||
$RHEL && PAM_FILE=/etc/pam.d/password-auth
|
$RPM && PAM_FILE=/etc/pam.d/password-auth
|
||||||
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/' $PAM_FILE
|
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/' $PAM_FILE
|
||||||
|
|
||||||
|
# List all the installed packages, for the build log
|
||||||
|
$RPM && rpm -q --all || true
|
||||||
|
$UBUNTU && dpkg --list || true
|
||||||
|
|
||||||
|
# Copy MQ Licenses into the correct location
|
||||||
|
mkdir -p /licenses
|
||||||
|
cp /opt/mqm/licenses/*.txt /licenses/
|
||||||
|
|||||||
@@ -1,158 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// capabilities allows querying of information on Linux capabilities
|
|
||||||
package capabilities
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DetectCapabilities determines Linux capabilities, based on the contents of a Linux "status" file.
|
|
||||||
// For example, the contents of file `/proc/1/status`
|
|
||||||
func DetectCapabilities(status string) ([]string, error) {
|
|
||||||
lines := strings.Split(status, "\n")
|
|
||||||
for _, line := range lines {
|
|
||||||
if strings.HasPrefix(strings.TrimSpace(line), "CapPrm:") {
|
|
||||||
words := strings.Fields(line)
|
|
||||||
cap, err := strconv.ParseUint(words[1], 16, 64)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return getCapabilities(cap), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil, errors.New("Unable to detect capabilities")
|
|
||||||
}
|
|
||||||
|
|
||||||
// getCapabilities converts an encoded uint64 into a slice of string names of Linux capabilities
|
|
||||||
func getCapabilities(cap uint64) []string {
|
|
||||||
caps := make([]string, 0, 37)
|
|
||||||
if cap&0x0000000040000000 == 0x0000000040000000 {
|
|
||||||
caps = append(caps, "AUDIT_CONTROL")
|
|
||||||
}
|
|
||||||
if cap&0x0000000020000000 == 0x0000000020000000 {
|
|
||||||
caps = append(caps, "AUDIT_WRITE")
|
|
||||||
}
|
|
||||||
if cap&0x0000001000000000 == 0x0000001000000000 {
|
|
||||||
caps = append(caps, "BLOCK_SUSPEND")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000001 == 0x0000000000000001 {
|
|
||||||
caps = append(caps, "CHOWN")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000002 == 0x0000000000000002 {
|
|
||||||
caps = append(caps, "DAC_OVERRIDE")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000004 == 0x0000000000000004 {
|
|
||||||
caps = append(caps, "DAC_READ_SEARCH")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000008 == 0x0000000000000008 {
|
|
||||||
caps = append(caps, "FOWNER")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000010 == 0x0000000000000010 {
|
|
||||||
caps = append(caps, "FSETID")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000004000 == 0x0000000000004000 {
|
|
||||||
caps = append(caps, "IPC_LOCK")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000008000 == 0x0000000000008000 {
|
|
||||||
caps = append(caps, "IPC_OWNER")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000020 == 0x0000000000000020 {
|
|
||||||
caps = append(caps, "KILL")
|
|
||||||
}
|
|
||||||
if cap&0x0000000010000000 == 0x0000000010000000 {
|
|
||||||
caps = append(caps, "LEASE")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000200 == 0x0000000000000200 {
|
|
||||||
caps = append(caps, "LINUX_IMMUTABLE")
|
|
||||||
}
|
|
||||||
if cap&0x0000000200000000 == 0x0000000200000000 {
|
|
||||||
caps = append(caps, "MAC_ADMIN")
|
|
||||||
}
|
|
||||||
if cap&0x0000000100000000 == 0x0000000100000000 {
|
|
||||||
caps = append(caps, "MAC_OVERRIDE")
|
|
||||||
}
|
|
||||||
if cap&0x0000000008000000 == 0x0000000008000000 {
|
|
||||||
caps = append(caps, "MKNOD")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000001000 == 0x0000000000001000 {
|
|
||||||
caps = append(caps, "NET_ADMIN")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000400 == 0x0000000000000400 {
|
|
||||||
caps = append(caps, "NET_BIND_SERVICE")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000800 == 0x0000000000000800 {
|
|
||||||
caps = append(caps, "NET_BROADCAST")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000002000 == 0x0000000000002000 {
|
|
||||||
caps = append(caps, "NET_RAW")
|
|
||||||
}
|
|
||||||
if cap&0x0000000080000000 == 0x0000000080000000 {
|
|
||||||
caps = append(caps, "SETFCAP")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000040 == 0x0000000000000040 {
|
|
||||||
caps = append(caps, "SETGID")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000100 == 0x0000000000000100 {
|
|
||||||
caps = append(caps, "SETPCAP")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000000080 == 0x0000000000000080 {
|
|
||||||
caps = append(caps, "SETUID")
|
|
||||||
}
|
|
||||||
if cap&0x0000000400000000 == 0x0000000400000000 {
|
|
||||||
caps = append(caps, "SYSLOG")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000200000 == 0x0000000000200000 {
|
|
||||||
caps = append(caps, "SYS_ADMIN")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000400000 == 0x0000000000400000 {
|
|
||||||
caps = append(caps, "SYS_BOOT")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000040000 == 0x0000000000040000 {
|
|
||||||
caps = append(caps, "SYS_CHROOT")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000010000 == 0x0000000000010000 {
|
|
||||||
caps = append(caps, "SYS_MODULE")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000800000 == 0x0000000000800000 {
|
|
||||||
caps = append(caps, "SYS_NICE")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000100000 == 0x0000000000100000 {
|
|
||||||
caps = append(caps, "SYS_PACCT")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000080000 == 0x0000000000080000 {
|
|
||||||
caps = append(caps, "SYS_PTRACE")
|
|
||||||
}
|
|
||||||
if cap&0x0000000000020000 == 0x0000000000020000 {
|
|
||||||
caps = append(caps, "SYS_RAWIO")
|
|
||||||
}
|
|
||||||
if cap&0x0000000001000000 == 0x0000000001000000 {
|
|
||||||
caps = append(caps, "SYS_RESOURCE")
|
|
||||||
}
|
|
||||||
if cap&0x0000000002000000 == 0x0000000002000000 {
|
|
||||||
caps = append(caps, "SYS_TIME")
|
|
||||||
}
|
|
||||||
if cap&0x0000000004000000 == 0x0000000004000000 {
|
|
||||||
caps = append(caps, "SYS_TTY_CONFIG")
|
|
||||||
}
|
|
||||||
if cap&0x0000000800000000 == 0x0000000800000000 {
|
|
||||||
caps = append(caps, "WAKE_ALARM")
|
|
||||||
}
|
|
||||||
return caps
|
|
||||||
}
|
|
||||||
@@ -1,39 +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.
|
|
||||||
*/
|
|
||||||
package capabilities
|
|
||||||
|
|
||||||
import (
|
|
||||||
"reflect"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
var capTests = []struct {
|
|
||||||
in uint64
|
|
||||||
out []string
|
|
||||||
}{
|
|
||||||
{0x0000000040000000, []string{"AUDIT_CONTROL"}},
|
|
||||||
// Default values when you run a Docker container without changing capabilities:
|
|
||||||
{0x00000000a80425fb, []string{"AUDIT_WRITE", "CHOWN", "DAC_OVERRIDE", "FOWNER", "FSETID", "KILL", "MKNOD", "NET_BIND_SERVICE", "NET_RAW", "SETFCAP", "SETGID", "SETPCAP", "SETUID", "SYS_CHROOT"}},
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetCapabilities(t *testing.T) {
|
|
||||||
for _, table := range capTests {
|
|
||||||
caps := getCapabilities(table.in)
|
|
||||||
if !reflect.DeepEqual(caps, table.out) {
|
|
||||||
t.Errorf("getCapabilities(%v) - expected %v, got %v", table.in, table.out, caps)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -53,14 +53,16 @@ func RunCmd(cmd *exec.Cmd) (string, int, error) {
|
|||||||
// Do not use this function to run shell built-ins (like "cd"), because
|
// Do not use this function to run shell built-ins (like "cd"), because
|
||||||
// the error handling works differently
|
// the error handling works differently
|
||||||
func Run(name string, arg ...string) (string, int, error) {
|
func Run(name string, arg ...string) (string, int, error) {
|
||||||
|
// #nosec G204
|
||||||
return RunCmd(exec.Command(name, arg...))
|
return RunCmd(exec.Command(name, arg...))
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunAsMQM runs the specified command as the mqm user
|
// RunAsMQM runs the specified command as the mqm user
|
||||||
func RunAsMQM(name string, arg ...string) (string, int, error) {
|
func RunAsMQM(name string, arg ...string) (string, int, error) {
|
||||||
|
// #nosec G204
|
||||||
cmd := exec.Command(name, arg...)
|
cmd := exec.Command(name, arg...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
||||||
uid, gid, err := lookupMQM()
|
uid, gid, err := LookupMQM()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", 0, err
|
return "", 0, err
|
||||||
}
|
}
|
||||||
@@ -68,8 +70,8 @@ func RunAsMQM(name string, arg ...string) (string, int, error) {
|
|||||||
return RunCmd(cmd)
|
return RunCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Duplicated code
|
// LookupMQM looks up the UID & GID of the mqm user
|
||||||
func lookupMQM() (int, int, error) {
|
func LookupMQM() (int, int, error) {
|
||||||
mqm, err := user.Lookup("mqm")
|
mqm, err := user.Lookup("mqm")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, -1, err
|
return -1, -1, err
|
||||||
|
|||||||
128
internal/containerruntime/runtime.go
Normal file
128
internal/containerruntime/runtime.go
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
© 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.
|
||||||
|
*/
|
||||||
|
package containerruntime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/genuinetools/amicontained/container"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetContainerRuntime() (string, error) {
|
||||||
|
return container.DetectRuntime()
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetBaseImage() (string, error) {
|
||||||
|
buf, err := ioutil.ReadFile("/etc/os-release")
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Failed to read /etc/os-release: %v", err)
|
||||||
|
}
|
||||||
|
lines := strings.Split(string(buf), "\n")
|
||||||
|
for _, l := range lines {
|
||||||
|
if strings.HasPrefix(l, "PRETTY_NAME=") {
|
||||||
|
words := strings.Split(l, "\"")
|
||||||
|
if len(words) >= 2 {
|
||||||
|
return words[1], nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "unknown", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCapabilities gets the Linux capabilities (e.g. setuid, setgid). See https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities
|
||||||
|
func GetCapabilities() (map[string][]string, error) {
|
||||||
|
return container.Capabilities()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSeccomp gets the seccomp enforcing mode, which affects which kernel calls can be made
|
||||||
|
func GetSeccomp() (string, error) {
|
||||||
|
s, err := container.SeccompEnforcingMode()
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Failed to get container SeccompEnforcingMode: %v", err)
|
||||||
|
}
|
||||||
|
return s, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSecurityAttributes gets the security attributes of the current process.
|
||||||
|
// The security attributes indicate whether AppArmor or SELinux are being used,
|
||||||
|
// and what the level of confinement is.
|
||||||
|
func GetSecurityAttributes() string {
|
||||||
|
a, err := readProc("/proc/self/attr/current")
|
||||||
|
// On some systems, if AppArmor or SELinux are not installed, you get an
|
||||||
|
// error when you try and read `/proc/self/attr/current`, even though the
|
||||||
|
// file exists.
|
||||||
|
if err != nil || a == "" {
|
||||||
|
a = "none"
|
||||||
|
}
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
|
||||||
|
func readProc(filename string) (value string, err error) {
|
||||||
|
// #nosec G304
|
||||||
|
buf, err := ioutil.ReadFile(filename)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return strings.TrimSpace(string(buf)), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMounts() (map[string]string, error) {
|
||||||
|
all, err := readProc("/proc/mounts")
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Couldn't read /proc/mounts")
|
||||||
|
}
|
||||||
|
result := make(map[string]string)
|
||||||
|
lines := strings.Split(all, "\n")
|
||||||
|
for i := range lines {
|
||||||
|
parts := strings.Split(lines[i], " ")
|
||||||
|
//dev := parts[0]
|
||||||
|
mountPoint := parts[1]
|
||||||
|
fsType := parts[2]
|
||||||
|
if strings.Contains(mountPoint, "/mnt/mqm") {
|
||||||
|
result[mountPoint] = fsType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetKernelVersion() (string, error) {
|
||||||
|
return readProc("/proc/sys/kernel/osrelease")
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMaxFileHandles() (string, error) {
|
||||||
|
return readProc("/proc/sys/fs/file-max")
|
||||||
|
}
|
||||||
|
|
||||||
|
// SupportedFilesystem returns true if the supplied filesystem type is supported for MQ data
|
||||||
|
func SupportedFilesystem(fsType string) bool {
|
||||||
|
switch fsType {
|
||||||
|
case "aufs", "overlayfs", "tmpfs":
|
||||||
|
return false
|
||||||
|
default:
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidMultiInstanceFilesystem returns true if the supplied filesystem type is valid for a multi-instance queue manager
|
||||||
|
func ValidMultiInstanceFilesystem(fsType string) bool {
|
||||||
|
if !SupportedFilesystem(fsType) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// TODO : check for non-shared filesystems & shared filesystems which are known not to work
|
||||||
|
return true
|
||||||
|
}
|
||||||
115
internal/containerruntime/runtime_linux.go
Normal file
115
internal/containerruntime/runtime_linux.go
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
// +build linux
|
||||||
|
|
||||||
|
/*
|
||||||
|
© Copyright IBM Corporation 2017, 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.
|
||||||
|
*/
|
||||||
|
package containerruntime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
|
)
|
||||||
|
|
||||||
|
// fsTypes contains file system identifier codes.
|
||||||
|
// This code will not compile on some operating systems - Linux only.
|
||||||
|
var fsTypes = map[int64]string{
|
||||||
|
0x61756673: "aufs",
|
||||||
|
0xef53: "ext",
|
||||||
|
0x6969: "nfs",
|
||||||
|
0x65735546: "fuse",
|
||||||
|
0x9123683e: "btrfs",
|
||||||
|
0x01021994: "tmpfs",
|
||||||
|
0x794c7630: "overlayfs",
|
||||||
|
0x58465342: "xfs",
|
||||||
|
// less popular codes
|
||||||
|
0xadf5: "adfs",
|
||||||
|
0xadff: "affs",
|
||||||
|
0x5346414F: "afs",
|
||||||
|
0x0187: "autofs",
|
||||||
|
0x73757245: "coda",
|
||||||
|
0x28cd3d45: "cramfs",
|
||||||
|
0x453dcd28: "cramfs",
|
||||||
|
0x64626720: "debugfs",
|
||||||
|
0x73636673: "securityfs",
|
||||||
|
0xf97cff8c: "selinux",
|
||||||
|
0x43415d53: "smack",
|
||||||
|
0x858458f6: "ramfs",
|
||||||
|
0x958458f6: "hugetlbfs",
|
||||||
|
0x73717368: "squashfs",
|
||||||
|
0xf15f: "ecryptfs",
|
||||||
|
0x414A53: "efs",
|
||||||
|
0xabba1974: "xenfs",
|
||||||
|
0x3434: "nilfs",
|
||||||
|
0xF2F52010: "f2fs",
|
||||||
|
0xf995e849: "hpfs",
|
||||||
|
0x9660: "isofs",
|
||||||
|
0x72b6: "jffs2",
|
||||||
|
0x6165676C: "pstorefs",
|
||||||
|
0xde5e81e4: "efivarfs",
|
||||||
|
0x00c0ffee: "hostfs",
|
||||||
|
0x137F: "minix_14", // minix v1 fs, 14 char names
|
||||||
|
0x138F: "minix_30", // minix v1 fs, 30 char names
|
||||||
|
0x2468: "minix2_14", // minix v2 fs, 14 char names
|
||||||
|
0x2478: "minix2_30", // minix v2 fs, 30 char names
|
||||||
|
0x4d5a: "minix3_60", // minix v3 fs, 60 char names
|
||||||
|
0x4d44: "msdos",
|
||||||
|
0x564c: "ncp",
|
||||||
|
0x7461636f: "ocfs2",
|
||||||
|
0x9fa1: "openprom",
|
||||||
|
0x002f: "qnx4",
|
||||||
|
0x68191122: "qnx6",
|
||||||
|
0x6B414653: "afs_fs",
|
||||||
|
0x52654973: "reiserfs",
|
||||||
|
0x517B: "smb",
|
||||||
|
0x27e0eb: "cgroup",
|
||||||
|
0x63677270: "cgroup2",
|
||||||
|
0x7655821: "rdtgroup",
|
||||||
|
0x57AC6E9D: "stack_end",
|
||||||
|
0x74726163: "tracefs",
|
||||||
|
0x01021997: "v9fs",
|
||||||
|
0x62646576: "bdevfs",
|
||||||
|
0x64646178: "daxfs",
|
||||||
|
0x42494e4d: "binfmtfs",
|
||||||
|
0x1cd1: "devpts",
|
||||||
|
0xBAD1DEA: "futexfs",
|
||||||
|
0x50495045: "pipefs",
|
||||||
|
0x9fa0: "proc",
|
||||||
|
0x534F434B: "sockfs",
|
||||||
|
0x62656572: "sysfs",
|
||||||
|
0x9fa2: "usbdevice",
|
||||||
|
0x11307854: "mtd_inode",
|
||||||
|
0x09041934: "anon_inode",
|
||||||
|
0x73727279: "btrfs",
|
||||||
|
0x6e736673: "nsfs",
|
||||||
|
0xcafe4a11: "bpf",
|
||||||
|
0x5a3c69f0: "aafs",
|
||||||
|
0x15013346: "udf",
|
||||||
|
0x13661366: "balloon_kvm",
|
||||||
|
0x58295829: "zsmalloc",
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFilesystem returns the filesystem type for the specified path
|
||||||
|
func GetFilesystem(path string) (string, error) {
|
||||||
|
statfs := &unix.Statfs_t{}
|
||||||
|
err := unix.Statfs(path, statfs)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
// Use a type conversion to make type an int64. On s390x it's a uint32.
|
||||||
|
t, ok := fsTypes[int64(statfs.Type)]
|
||||||
|
if !ok {
|
||||||
|
return "unknown", nil
|
||||||
|
}
|
||||||
|
return t, nil
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// +build !linux
|
// +build !linux
|
||||||
|
|
||||||
/*
|
/*
|
||||||
© 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.
|
||||||
@@ -15,10 +15,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
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.
|
||||||
*/
|
*/
|
||||||
package main
|
package containerruntime
|
||||||
|
|
||||||
// Dummy version of this function, only for non-Linux systems.
|
// Dummy version of this function, only for non-Linux systems.
|
||||||
// Having this allows unit tests to be run on other platforms (e.g. macOS)
|
// Having this allows unit tests to be run on other platforms (e.g. macOS)
|
||||||
func checkFS(path string) {
|
func checkFS(path string) error {
|
||||||
return
|
return nil
|
||||||
}
|
}
|
||||||
103
internal/containerruntimelogger/logruntime.go
Normal file
103
internal/containerruntimelogger/logruntime.go
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
© Copyright IBM Corporation 2017, 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.
|
||||||
|
*/
|
||||||
|
package containerruntimelogger
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/containerruntime"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/logger"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// LogContainerDetails logs details about the container runtime
|
||||||
|
func LogContainerDetails(log *logger.Logger) error {
|
||||||
|
if runtime.GOOS != "linux" {
|
||||||
|
return fmt.Errorf("Unsupported platform: %v", runtime.GOOS)
|
||||||
|
}
|
||||||
|
log.Printf("CPU architecture: %v", runtime.GOARCH)
|
||||||
|
kv, err := containerruntime.GetKernelVersion()
|
||||||
|
if err == nil {
|
||||||
|
log.Printf("Linux kernel version: %v", kv)
|
||||||
|
}
|
||||||
|
cr, err := containerruntime.GetContainerRuntime()
|
||||||
|
if err == nil {
|
||||||
|
log.Printf("Container runtime: %v", cr)
|
||||||
|
}
|
||||||
|
bi, err := containerruntime.GetBaseImage()
|
||||||
|
if err == nil {
|
||||||
|
log.Printf("Base image: %v", bi)
|
||||||
|
}
|
||||||
|
u, err := user.GetUser()
|
||||||
|
if err == nil {
|
||||||
|
if len(u.SupplementalGID) == 0 {
|
||||||
|
log.Printf("Running as user ID %v (%v) with primary group %v", u.UID, u.Name, u.PrimaryGID)
|
||||||
|
} else {
|
||||||
|
log.Printf("Running as user ID %v (%v) with primary group %v, and supplementary groups %v", u.UID, u.Name, u.PrimaryGID, strings.Join(u.SupplementalGID, ","))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
caps, err := containerruntime.GetCapabilities()
|
||||||
|
capLogged := false
|
||||||
|
if err == nil {
|
||||||
|
for k, v := range caps {
|
||||||
|
if len(v) > 0 {
|
||||||
|
log.Printf("Capabilities (%s set): %v", strings.ToLower(k), strings.Join(v, ","))
|
||||||
|
capLogged = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !capLogged {
|
||||||
|
log.Print("Capabilities: none")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Errorf("Error getting capabilities: %v", err)
|
||||||
|
}
|
||||||
|
sc, err := containerruntime.GetSeccomp()
|
||||||
|
if err == nil {
|
||||||
|
log.Printf("seccomp enforcing mode: %v", sc)
|
||||||
|
}
|
||||||
|
log.Printf("Process security attributes: %v", containerruntime.GetSecurityAttributes())
|
||||||
|
m, err := containerruntime.GetMounts()
|
||||||
|
if err == nil {
|
||||||
|
if len(m) == 0 {
|
||||||
|
log.Print("No volume detected. Persistent messages may be lost")
|
||||||
|
} else {
|
||||||
|
for mountPoint, fsType := range m {
|
||||||
|
log.Printf("Detected '%v' volume mounted to %v", fsType, mountPoint)
|
||||||
|
if !containerruntime.SupportedFilesystem(fsType) {
|
||||||
|
return fmt.Errorf("%v uses unsupported filesystem type: %v", mountPoint, fsType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// For a multi-instance queue manager - check all required mounts exist & validate filesystem type
|
||||||
|
if os.Getenv("MQ_MULTI_INSTANCE") == "true" {
|
||||||
|
log.Println("Multi-instance queue manager: enabled")
|
||||||
|
reqMounts := []string{"/mnt/mqm", "/mnt/mqm-log", "/mnt/mqm-data"}
|
||||||
|
for _, mountPoint := range reqMounts {
|
||||||
|
if fsType, ok := m[mountPoint]; ok {
|
||||||
|
if !containerruntime.ValidMultiInstanceFilesystem(fsType) {
|
||||||
|
return fmt.Errorf("%v uses filesystem type '%v' which is invalid for a multi-instance queue manager", mountPoint, fsType)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("Missing required mount '%v' for a multi-instance queue manager", mountPoint)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
58
internal/copy/copy.go
Normal file
58
internal/copy/copy.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
© 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package copy
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/filecheck"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CopyFileMode(src, dest string, perm os.FileMode) error {
|
||||||
|
|
||||||
|
err := filecheck.CheckFileSource(src)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to open %s for copy: %v", src, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// #nosec G304 - filename variable 'src' is checked above to ensure it is valid
|
||||||
|
in, err := os.Open(src)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to open %s for copy: %v", src, err)
|
||||||
|
}
|
||||||
|
defer in.Close()
|
||||||
|
|
||||||
|
out, err := os.OpenFile(dest, os.O_CREATE|os.O_WRONLY, perm)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to open %s for copy: %v", dest, err)
|
||||||
|
}
|
||||||
|
defer out.Close()
|
||||||
|
|
||||||
|
_, err = io.Copy(out, in)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = out.Close()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// CopyFile copies the specified file
|
||||||
|
func CopyFile(src, dest string) error {
|
||||||
|
return CopyFileMode(src, dest, 0770)
|
||||||
|
}
|
||||||
37
internal/filecheck/filecheck.go
Normal file
37
internal/filecheck/filecheck.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
© 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package filecheck
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CheckFileSource checks the filename is valid
|
||||||
|
func CheckFileSource(fileName string) error {
|
||||||
|
|
||||||
|
absFile, _ := filepath.Abs(fileName)
|
||||||
|
|
||||||
|
prefixes := []string{"bin", "boot", "dev", "lib", "lib64", "proc", "sbin", "sys"}
|
||||||
|
for _, prefix := range prefixes {
|
||||||
|
if strings.HasPrefix(absFile, filepath.Join("/", prefix)) {
|
||||||
|
return fmt.Errorf("Filename resolves to invalid path '%v'", absFile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
40
internal/filecheck/filecheck_test.go
Normal file
40
internal/filecheck/filecheck_test.go
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
© 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package filecheck
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCheckFileSource(t *testing.T) {
|
||||||
|
|
||||||
|
invalidFilenames := []string{"/bin", "/boot", "/dev", "/lib", "/lib64", "/proc", "/sbin", "/sys", "/bin/myfile", "/boot/mydir/myfile", "/var/../dev", "/var/../lib/myfile"}
|
||||||
|
for _, invalidFilename := range invalidFilenames {
|
||||||
|
err := CheckFileSource(invalidFilename)
|
||||||
|
if err == nil {
|
||||||
|
t.Errorf("Expected to receive an error for filename '%v'", invalidFilename)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
validFilenames := []string{"/var", "/mydir/dev", "/mydir/dev/myfile"}
|
||||||
|
for _, validFilename := range validFilenames {
|
||||||
|
err := CheckFileSource(validFilename)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Unexpected error received: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
244
internal/keystore/keystore.go
Normal file
244
internal/keystore/keystore.go
Normal file
@@ -0,0 +1,244 @@
|
|||||||
|
/*
|
||||||
|
© 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Package keystore contains code to create and update keystores
|
||||||
|
package keystore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/command"
|
||||||
|
)
|
||||||
|
|
||||||
|
// KeyStore describes information about a keystore file
|
||||||
|
type KeyStore struct {
|
||||||
|
Filename string
|
||||||
|
Password string
|
||||||
|
keyStoreType string
|
||||||
|
command string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewJKSKeyStore creates a new Java Key Store, managed by the runmqckm command
|
||||||
|
func NewJKSKeyStore(filename, password string) *KeyStore {
|
||||||
|
return &KeyStore{
|
||||||
|
Filename: filename,
|
||||||
|
Password: password,
|
||||||
|
keyStoreType: "jks",
|
||||||
|
command: "/opt/mqm/bin/runmqckm",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCMSKeyStore creates a new MQ CMS Key Store, managed by the runmqakm command
|
||||||
|
func NewCMSKeyStore(filename, password string) *KeyStore {
|
||||||
|
return &KeyStore{
|
||||||
|
Filename: filename,
|
||||||
|
Password: password,
|
||||||
|
keyStoreType: "cms",
|
||||||
|
command: "/opt/mqm/bin/runmqakm",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPKCS12KeyStore creates a new PKCS12 Key Store, managed by the runmqakm command
|
||||||
|
func NewPKCS12KeyStore(filename, password string) *KeyStore {
|
||||||
|
return &KeyStore{
|
||||||
|
Filename: filename,
|
||||||
|
Password: password,
|
||||||
|
keyStoreType: "p12",
|
||||||
|
command: "/opt/mqm/bin/runmqakm",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a key store, if it doesn't already exist
|
||||||
|
func (ks *KeyStore) Create() error {
|
||||||
|
_, err := os.Stat(ks.Filename)
|
||||||
|
if err == nil {
|
||||||
|
// Keystore already exists so we should refresh it by deleting it.
|
||||||
|
extension := filepath.Ext(ks.Filename)
|
||||||
|
if ks.keyStoreType == "cms" {
|
||||||
|
// Only delete these when we are refreshing the kdb keystore
|
||||||
|
stashFile := ks.Filename[0:len(ks.Filename)-len(extension)] + ".sth"
|
||||||
|
rdbFile := ks.Filename[0:len(ks.Filename)-len(extension)] + ".rdb"
|
||||||
|
crlFile := ks.Filename[0:len(ks.Filename)-len(extension)] + ".crl"
|
||||||
|
err = os.Remove(stashFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = os.Remove(rdbFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = os.Remove(crlFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = os.Remove(ks.Filename)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else if !os.IsNotExist(err) {
|
||||||
|
// If the keystore exists but cannot be accessed then return the error
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the keystore now we're sure it doesn't exist
|
||||||
|
out, _, err := command.Run(ks.command, "-keydb", "-create", "-type", ks.keyStoreType, "-db", ks.Filename, "-pw", ks.Password, "-stash")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error running \"%v -keydb -create\": %v %s", ks.command, err, out)
|
||||||
|
}
|
||||||
|
|
||||||
|
mqmUID, mqmGID, err := command.LookupMQM()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = os.Chown(ks.Filename, mqmUID, mqmGID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateStash creates a key stash, if it doesn't already exist
|
||||||
|
func (ks *KeyStore) CreateStash() error {
|
||||||
|
extension := filepath.Ext(ks.Filename)
|
||||||
|
stashFile := ks.Filename[0:len(ks.Filename)-len(extension)] + ".sth"
|
||||||
|
_, err := os.Stat(stashFile)
|
||||||
|
if err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
out, _, err := command.Run(ks.command, "-keydb", "-stashpw", "-type", ks.keyStoreType, "-db", ks.Filename, "-pw", ks.Password)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error running \"%v -keydb -stashpw\": %v %s", ks.command, err, out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
mqmUID, mqmGID, err := command.LookupMQM()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = os.Chown(stashFile, mqmUID, mqmGID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Import imports a certificate file in the keystore
|
||||||
|
func (ks *KeyStore) Import(inputFile, password string) error {
|
||||||
|
out, _, err := command.Run(ks.command, "-cert", "-import", "-file", inputFile, "-pw", password, "-target", ks.Filename, "-target_pw", ks.Password, "-target_type", ks.keyStoreType)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error running \"%v -cert -import\": %v %s", ks.command, err, out)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateSelfSignedCertificate creates a self-signed certificate in the keystore
|
||||||
|
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, "-san_dnsname", hostname)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error running \"%v -cert -create\": %v %s", ks.command, err, out)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add adds a CA certificate to the keystore
|
||||||
|
func (ks *KeyStore) Add(inputFile, label string) error {
|
||||||
|
out, _, err := command.Run(ks.command, "-cert", "-add", "-db", ks.Filename, "-type", ks.keyStoreType, "-pw", ks.Password, "-file", inputFile, "-label", label)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error running \"%v -cert -add\": %v %s", ks.command, err, out)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add adds a CA certificate to the keystore
|
||||||
|
func (ks *KeyStore) AddNoLabel(inputFile string) error {
|
||||||
|
out, _, err := command.Run(ks.command, "-cert", "-add", "-db", ks.Filename, "-type", ks.keyStoreType, "-pw", ks.Password, "-file", inputFile)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error running \"%v -cert -add\": %v %s", ks.command, err, out)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCertificateLabels returns the labels of all certificates in the key store
|
||||||
|
func (ks *KeyStore) GetCertificateLabels() ([]string, error) {
|
||||||
|
out, _, err := command.Run(ks.command, "-cert", "-list", "-type", ks.keyStoreType, "-db", ks.Filename, "-pw", ks.Password)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error running \"%v -cert -list\": %v %s", ks.command, err, out)
|
||||||
|
}
|
||||||
|
scanner := bufio.NewScanner(strings.NewReader(out))
|
||||||
|
var labels []string
|
||||||
|
for scanner.Scan() {
|
||||||
|
s := scanner.Text()
|
||||||
|
if strings.HasPrefix(s, "-") || strings.HasPrefix(s, "*-") {
|
||||||
|
s := strings.TrimLeft(s, "-*")
|
||||||
|
labels = append(labels, strings.TrimSpace(s))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = scanner.Err()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return labels, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RenameCertificate renames the specified certificate
|
||||||
|
func (ks *KeyStore) RenameCertificate(from, to string) error {
|
||||||
|
if ks.command == "/opt/mqm/bin/runmqakm" {
|
||||||
|
// 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.Env = append(os.Environ(), "LD_LIBRARY_PATH=/opt/mqm/gskit8/lib64/:/opt/mqm/gskit8/lib")
|
||||||
|
out, _, err := command.RunCmd(cmd)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error running \"%v -cert -rename\": %v %s", "/opt/mqm/gskit8/bin/gsk8capicmd_64", err, out)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
out, _, err := command.Run(ks.command, "-cert", "-rename", "-db", ks.Filename, "-pw", ks.Password, "-label", from, "-new_label", to)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error running \"%v -cert -rename\": %v %s", ks.command, err, out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAllCertificates Lists all certificates in the keystore
|
||||||
|
func (ks *KeyStore) ListAllCertificates() ([]string, error) {
|
||||||
|
out, _, err := command.Run(ks.command, "-cert", "-list", "-type", ks.keyStoreType, "-db", ks.Filename, "-pw", ks.Password)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error running \"%v -cert -list\": %v %s", ks.command, err, out)
|
||||||
|
}
|
||||||
|
scanner := bufio.NewScanner(strings.NewReader(out))
|
||||||
|
var labels []string
|
||||||
|
for scanner.Scan() {
|
||||||
|
s := scanner.Text()
|
||||||
|
if strings.HasPrefix(s, "-") || strings.HasPrefix(s, "*-") || strings.HasPrefix(s, "!") {
|
||||||
|
s := strings.TrimLeft(s, "-*!")
|
||||||
|
labels = append(labels, strings.TrimSpace(s))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = scanner.Err()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return labels, 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.
|
||||||
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Package logger provides utility functions for logging purposes
|
||||||
package logger
|
package logger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -22,6 +23,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -39,10 +41,10 @@ type Logger struct {
|
|||||||
debug bool
|
debug bool
|
||||||
json bool
|
json bool
|
||||||
processName string
|
processName string
|
||||||
pid int
|
pid string
|
||||||
serverName string
|
serverName string
|
||||||
host string
|
host string
|
||||||
user *user.User
|
userName string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLogger creates a new logger
|
// NewLogger creates a new logger
|
||||||
@@ -51,9 +53,13 @@ func NewLogger(writer io.Writer, debug bool, json bool, serverName string) (*Log
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// This can fail because the container's running as a random UID which
|
||||||
|
// is not known by the OS. We don't want this to break the logging
|
||||||
|
// entirely, so just use a blank user name.
|
||||||
user, err := user.Current()
|
user, err := user.Current()
|
||||||
if err != nil {
|
userName := ""
|
||||||
return nil, err
|
if err == nil {
|
||||||
|
userName = user.Username
|
||||||
}
|
}
|
||||||
return &Logger{
|
return &Logger{
|
||||||
mutex: sync.Mutex{},
|
mutex: sync.Mutex{},
|
||||||
@@ -61,10 +67,10 @@ func NewLogger(writer io.Writer, debug bool, json bool, serverName string) (*Log
|
|||||||
debug: debug,
|
debug: debug,
|
||||||
json: json,
|
json: json,
|
||||||
processName: os.Args[0],
|
processName: os.Args[0],
|
||||||
pid: os.Getpid(),
|
pid: strconv.Itoa(os.Getpid()),
|
||||||
serverName: serverName,
|
serverName: serverName,
|
||||||
host: hostname,
|
host: hostname,
|
||||||
user: user,
|
userName: userName,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +97,7 @@ func (l *Logger) log(level string, msg string) {
|
|||||||
"ibm_serverName": l.serverName,
|
"ibm_serverName": l.serverName,
|
||||||
"ibm_processName": l.processName,
|
"ibm_processName": l.processName,
|
||||||
"ibm_processId": l.pid,
|
"ibm_processId": l.pid,
|
||||||
"ibm_userName": l.user.Username,
|
"ibm_userName": l.userName,
|
||||||
"type": "mq_containerlog",
|
"type": "mq_containerlog",
|
||||||
}
|
}
|
||||||
s, err := l.format(entry)
|
s, err := l.format(entry)
|
||||||
@@ -108,46 +114,51 @@ func (l *Logger) log(level string, msg string) {
|
|||||||
l.mutex.Unlock()
|
l.mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *Logger) LogDirect(msg string) {
|
// Debug logs a line as debug
|
||||||
fmt.Println(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *Logger) Debug(args ...interface{}) {
|
func (l *Logger) Debug(args ...interface{}) {
|
||||||
if l.debug {
|
if l.debug {
|
||||||
l.log(debugLevel, fmt.Sprint(args...))
|
l.log(debugLevel, fmt.Sprint(args...))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debugf logs a line as debug using format specifiers
|
||||||
func (l *Logger) Debugf(format string, args ...interface{}) {
|
func (l *Logger) Debugf(format string, args ...interface{}) {
|
||||||
if l.debug {
|
if l.debug {
|
||||||
l.log(debugLevel, fmt.Sprintf(format, args...))
|
l.log(debugLevel, fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print logs a message as info
|
||||||
func (l *Logger) Print(args ...interface{}) {
|
func (l *Logger) Print(args ...interface{}) {
|
||||||
l.log(infoLevel, fmt.Sprint(args...))
|
l.log(infoLevel, fmt.Sprint(args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Println logs a message
|
||||||
func (l *Logger) Println(args ...interface{}) {
|
func (l *Logger) Println(args ...interface{}) {
|
||||||
l.Print(args...)
|
l.Print(args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Printf logs a message as info using format specifiers
|
||||||
func (l *Logger) Printf(format string, args ...interface{}) {
|
func (l *Logger) Printf(format string, args ...interface{}) {
|
||||||
l.log(infoLevel, fmt.Sprintf(format, args...))
|
l.log(infoLevel, fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PrintString logs a string as info
|
||||||
func (l *Logger) PrintString(msg string) {
|
func (l *Logger) PrintString(msg string) {
|
||||||
l.log(infoLevel, msg)
|
l.log(infoLevel, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Errorf logs a message as error
|
||||||
func (l *Logger) Error(args ...interface{}) {
|
func (l *Logger) Error(args ...interface{}) {
|
||||||
l.log(errorLevel, fmt.Sprint(args...))
|
l.log(errorLevel, fmt.Sprint(args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Errorf logs a message as error using format specifiers
|
||||||
func (l *Logger) Errorf(format string, args ...interface{}) {
|
func (l *Logger) Errorf(format string, args ...interface{}) {
|
||||||
l.log(errorLevel, fmt.Sprintf(format, args...))
|
l.log(errorLevel, fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fatalf logs a message as fatal using format specifiers
|
||||||
// TODO: Remove this
|
// TODO: Remove this
|
||||||
func (l *Logger) Fatalf(format string, args ...interface{}) {
|
func (l *Logger) Fatalf(format string, args ...interface{}) {
|
||||||
l.log("FATAL", fmt.Sprintf(format, args...))
|
l.log("FATAL", fmt.Sprintf(format, args...))
|
||||||
|
|||||||
191
internal/metrics/exporter.go
Normal file
191
internal/metrics/exporter.go
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
/*
|
||||||
|
© Copyright IBM Corporation 2018
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Package metrics contains code to provide metrics for the queue manager
|
||||||
|
package metrics
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/logger"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
namespace = "ibmmq"
|
||||||
|
qmgrPrefix = "qmgr"
|
||||||
|
qmgrLabel = "qmgr"
|
||||||
|
objectPrefix = "object"
|
||||||
|
objectLabel = "object"
|
||||||
|
)
|
||||||
|
|
||||||
|
type exporter struct {
|
||||||
|
qmName string
|
||||||
|
gaugeMap map[string]*prometheus.GaugeVec
|
||||||
|
counterMap map[string]*prometheus.CounterVec
|
||||||
|
firstCollect bool
|
||||||
|
log *logger.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func newExporter(qmName string, log *logger.Logger) *exporter {
|
||||||
|
return &exporter{
|
||||||
|
qmName: qmName,
|
||||||
|
gaugeMap: make(map[string]*prometheus.GaugeVec),
|
||||||
|
counterMap: make(map[string]*prometheus.CounterVec),
|
||||||
|
firstCollect: true,
|
||||||
|
log: log,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describe provides details of all available metrics
|
||||||
|
func (e *exporter) Describe(ch chan<- *prometheus.Desc) {
|
||||||
|
|
||||||
|
requestChannel <- false
|
||||||
|
response := <-responseChannel
|
||||||
|
|
||||||
|
for key, metric := range response {
|
||||||
|
|
||||||
|
if metric.isDelta {
|
||||||
|
// For delta type metrics - allocate a Prometheus Counter
|
||||||
|
counterVec := createCounterVec(metric.name, metric.description, metric.objectType)
|
||||||
|
e.counterMap[key] = counterVec
|
||||||
|
|
||||||
|
// Describe metric
|
||||||
|
counterVec.Describe(ch)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// For non-delta type metrics - allocate a Prometheus Gauge
|
||||||
|
gaugeVec := createGaugeVec(metric.name, metric.description, metric.objectType)
|
||||||
|
e.gaugeMap[key] = gaugeVec
|
||||||
|
|
||||||
|
// Describe metric
|
||||||
|
gaugeVec.Describe(ch)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect is called at regular intervals to provide the current metric data
|
||||||
|
func (e *exporter) Collect(ch chan<- prometheus.Metric) {
|
||||||
|
|
||||||
|
requestChannel <- true
|
||||||
|
response := <-responseChannel
|
||||||
|
|
||||||
|
for key, metric := range response {
|
||||||
|
|
||||||
|
if metric.isDelta {
|
||||||
|
// For delta type metrics - update their Prometheus Counter
|
||||||
|
counterVec := e.counterMap[key]
|
||||||
|
|
||||||
|
// Populate Prometheus Counter with metric values
|
||||||
|
// - Skip on first collect to avoid build-up of accumulated values
|
||||||
|
if !e.firstCollect {
|
||||||
|
for label, value := range metric.values {
|
||||||
|
var err error
|
||||||
|
var counter prometheus.Counter
|
||||||
|
|
||||||
|
if label == qmgrLabelValue {
|
||||||
|
counter, err = counterVec.GetMetricWithLabelValues(e.qmName)
|
||||||
|
} else {
|
||||||
|
counter, err = counterVec.GetMetricWithLabelValues(label, e.qmName)
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
counter.Add(value)
|
||||||
|
} else {
|
||||||
|
e.log.Errorf("Metrics Error: %s", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect metric
|
||||||
|
counterVec.Collect(ch)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// For non-delta type metrics - reset their Prometheus Gauge
|
||||||
|
gaugeVec := e.gaugeMap[key]
|
||||||
|
gaugeVec.Reset()
|
||||||
|
|
||||||
|
// Populate Prometheus Gauge with metric values
|
||||||
|
// - Skip on first collect to avoid build-up of accumulated values
|
||||||
|
if !e.firstCollect {
|
||||||
|
for label, value := range metric.values {
|
||||||
|
var err error
|
||||||
|
var gauge prometheus.Gauge
|
||||||
|
|
||||||
|
if label == qmgrLabelValue {
|
||||||
|
gauge, err = gaugeVec.GetMetricWithLabelValues(e.qmName)
|
||||||
|
} else {
|
||||||
|
gauge, err = gaugeVec.GetMetricWithLabelValues(label, e.qmName)
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
gauge.Set(value)
|
||||||
|
} else {
|
||||||
|
e.log.Errorf("Metrics Error: %s", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect metric
|
||||||
|
gaugeVec.Collect(ch)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if e.firstCollect {
|
||||||
|
e.firstCollect = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// createCounterVec returns a Prometheus CounterVec populated with metric details
|
||||||
|
func createCounterVec(name, description string, objectType bool) *prometheus.CounterVec {
|
||||||
|
|
||||||
|
prefix, labels := getVecDetails(objectType)
|
||||||
|
|
||||||
|
counterVec := prometheus.NewCounterVec(
|
||||||
|
prometheus.CounterOpts{
|
||||||
|
Namespace: namespace,
|
||||||
|
Name: prefix + "_" + name,
|
||||||
|
Help: description,
|
||||||
|
},
|
||||||
|
labels,
|
||||||
|
)
|
||||||
|
return counterVec
|
||||||
|
}
|
||||||
|
|
||||||
|
// createGaugeVec returns a Prometheus GaugeVec populated with metric details
|
||||||
|
func createGaugeVec(name, description string, objectType bool) *prometheus.GaugeVec {
|
||||||
|
|
||||||
|
prefix, labels := getVecDetails(objectType)
|
||||||
|
|
||||||
|
gaugeVec := prometheus.NewGaugeVec(
|
||||||
|
prometheus.GaugeOpts{
|
||||||
|
Namespace: namespace,
|
||||||
|
Name: prefix + "_" + name,
|
||||||
|
Help: description,
|
||||||
|
},
|
||||||
|
labels,
|
||||||
|
)
|
||||||
|
return gaugeVec
|
||||||
|
}
|
||||||
|
|
||||||
|
// getVecDetails returns the required prefix and labels for a metric
|
||||||
|
func getVecDetails(objectType bool) (prefix string, labels []string) {
|
||||||
|
|
||||||
|
prefix = qmgrPrefix
|
||||||
|
labels = []string{qmgrLabel}
|
||||||
|
|
||||||
|
if objectType {
|
||||||
|
prefix = objectPrefix
|
||||||
|
labels = []string{objectLabel, qmgrLabel}
|
||||||
|
}
|
||||||
|
return prefix, labels
|
||||||
|
}
|
||||||
204
internal/metrics/exporter_test.go
Normal file
204
internal/metrics/exporter_test.go
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
/*
|
||||||
|
© Copyright IBM Corporation 2018
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
package metrics
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-golang/ibmmq"
|
||||||
|
"github.com/ibm-messaging/mq-golang/mqmetric"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
dto "github.com/prometheus/client_model/go"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestDescribe_Counter(t *testing.T) {
|
||||||
|
testDescribe(t, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDescribe_Gauge(t *testing.T) {
|
||||||
|
testDescribe(t, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testDescribe(t *testing.T, isDelta bool) {
|
||||||
|
|
||||||
|
teardownTestCase := setupTestCase(false)
|
||||||
|
defer teardownTestCase()
|
||||||
|
log := getTestLogger()
|
||||||
|
|
||||||
|
ch := make(chan *prometheus.Desc)
|
||||||
|
go func() {
|
||||||
|
exporter := newExporter("qmName", log)
|
||||||
|
exporter.Describe(ch)
|
||||||
|
}()
|
||||||
|
|
||||||
|
collect := <-requestChannel
|
||||||
|
if collect {
|
||||||
|
t.Errorf("Received unexpected collect request")
|
||||||
|
}
|
||||||
|
|
||||||
|
if isDelta {
|
||||||
|
mqmetric.Metrics.Classes[0].Types[0].Elements[0].Datatype = ibmmq.MQIAMO_MONITOR_DELTA
|
||||||
|
}
|
||||||
|
metrics, _ := initialiseMetrics(log)
|
||||||
|
responseChannel <- metrics
|
||||||
|
|
||||||
|
select {
|
||||||
|
case prometheusDesc := <-ch:
|
||||||
|
expected := "Desc{fqName: \"ibmmq_qmgr_" + testElement1Name + "\", help: \"" + testElement1Description + "\", constLabels: {}, variableLabels: [qmgr]}"
|
||||||
|
actual := prometheusDesc.String()
|
||||||
|
if actual != expected {
|
||||||
|
t.Errorf("Expected value=%s; actual %s", expected, actual)
|
||||||
|
}
|
||||||
|
case <-time.After(1 * time.Second):
|
||||||
|
t.Error("Did not receive channel response from describe")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCollect_Counter(t *testing.T) {
|
||||||
|
testCollect(t, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCollect_Gauge(t *testing.T) {
|
||||||
|
testCollect(t, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testCollect(t *testing.T, isDelta bool) {
|
||||||
|
|
||||||
|
teardownTestCase := setupTestCase(false)
|
||||||
|
defer teardownTestCase()
|
||||||
|
log := getTestLogger()
|
||||||
|
|
||||||
|
exporter := newExporter("qmName", log)
|
||||||
|
if isDelta {
|
||||||
|
exporter.counterMap[testKey1] = createCounterVec(testElement1Name, testElement1Description, false)
|
||||||
|
} else {
|
||||||
|
exporter.gaugeMap[testKey1] = createGaugeVec(testElement1Name, testElement1Description, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 1; i <= 3; i++ {
|
||||||
|
|
||||||
|
ch := make(chan prometheus.Metric)
|
||||||
|
go func() {
|
||||||
|
exporter.Collect(ch)
|
||||||
|
close(ch)
|
||||||
|
}()
|
||||||
|
|
||||||
|
collect := <-requestChannel
|
||||||
|
if !collect {
|
||||||
|
t.Errorf("Received unexpected describe request")
|
||||||
|
}
|
||||||
|
|
||||||
|
populateTestMetrics(i, false)
|
||||||
|
if isDelta {
|
||||||
|
mqmetric.Metrics.Classes[0].Types[0].Elements[0].Datatype = ibmmq.MQIAMO_MONITOR_DELTA
|
||||||
|
}
|
||||||
|
metrics, _ := initialiseMetrics(log)
|
||||||
|
updateMetrics(metrics)
|
||||||
|
responseChannel <- metrics
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-ch:
|
||||||
|
var actual float64
|
||||||
|
prometheusMetric := dto.Metric{}
|
||||||
|
if isDelta {
|
||||||
|
exporter.counterMap[testKey1].WithLabelValues("qmName").Write(&prometheusMetric)
|
||||||
|
actual = prometheusMetric.GetCounter().GetValue()
|
||||||
|
} else {
|
||||||
|
exporter.gaugeMap[testKey1].WithLabelValues("qmName").Write(&prometheusMetric)
|
||||||
|
actual = prometheusMetric.GetGauge().GetValue()
|
||||||
|
}
|
||||||
|
|
||||||
|
if i == 1 {
|
||||||
|
if actual != float64(0) {
|
||||||
|
t.Errorf("Expected values to be zero on first collect; actual %f", actual)
|
||||||
|
}
|
||||||
|
} else if isDelta && i != 2 {
|
||||||
|
if actual != float64(i+(i-1)) {
|
||||||
|
t.Errorf("Expected value=%f; actual %f", float64(i+(i-1)), actual)
|
||||||
|
}
|
||||||
|
} else if actual != float64(i) {
|
||||||
|
t.Errorf("Expected value=%f; actual %f", float64(i), actual)
|
||||||
|
}
|
||||||
|
case <-time.After(1 * time.Second):
|
||||||
|
t.Error("Did not receive channel response from collect")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCreateCounterVec(t *testing.T) {
|
||||||
|
|
||||||
|
ch := make(chan *prometheus.Desc)
|
||||||
|
counterVec := createCounterVec("MetricName", "MetricDescription", false)
|
||||||
|
go func() {
|
||||||
|
counterVec.Describe(ch)
|
||||||
|
}()
|
||||||
|
description := <-ch
|
||||||
|
|
||||||
|
expected := "Desc{fqName: \"ibmmq_qmgr_MetricName\", help: \"MetricDescription\", constLabels: {}, variableLabels: [qmgr]}"
|
||||||
|
actual := description.String()
|
||||||
|
if actual != expected {
|
||||||
|
t.Errorf("Expected value=%s; actual %s", expected, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCreateCounterVec_ObjectLabel(t *testing.T) {
|
||||||
|
|
||||||
|
ch := make(chan *prometheus.Desc)
|
||||||
|
counterVec := createCounterVec("MetricName", "MetricDescription", true)
|
||||||
|
go func() {
|
||||||
|
counterVec.Describe(ch)
|
||||||
|
}()
|
||||||
|
description := <-ch
|
||||||
|
|
||||||
|
expected := "Desc{fqName: \"ibmmq_object_MetricName\", help: \"MetricDescription\", constLabels: {}, variableLabels: [object qmgr]}"
|
||||||
|
actual := description.String()
|
||||||
|
if actual != expected {
|
||||||
|
t.Errorf("Expected value=%s; actual %s", expected, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCreateGaugeVec(t *testing.T) {
|
||||||
|
|
||||||
|
ch := make(chan *prometheus.Desc)
|
||||||
|
gaugeVec := createGaugeVec("MetricName", "MetricDescription", false)
|
||||||
|
go func() {
|
||||||
|
gaugeVec.Describe(ch)
|
||||||
|
}()
|
||||||
|
description := <-ch
|
||||||
|
|
||||||
|
expected := "Desc{fqName: \"ibmmq_qmgr_MetricName\", help: \"MetricDescription\", constLabels: {}, variableLabels: [qmgr]}"
|
||||||
|
actual := description.String()
|
||||||
|
if actual != expected {
|
||||||
|
t.Errorf("Expected value=%s; actual %s", expected, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCreateGaugeVec_ObjectLabel(t *testing.T) {
|
||||||
|
|
||||||
|
ch := make(chan *prometheus.Desc)
|
||||||
|
gaugeVec := createGaugeVec("MetricName", "MetricDescription", true)
|
||||||
|
go func() {
|
||||||
|
gaugeVec.Describe(ch)
|
||||||
|
}()
|
||||||
|
description := <-ch
|
||||||
|
|
||||||
|
expected := "Desc{fqName: \"ibmmq_object_MetricName\", help: \"MetricDescription\", constLabels: {}, variableLabels: [object qmgr]}"
|
||||||
|
actual := description.String()
|
||||||
|
if actual != expected {
|
||||||
|
t.Errorf("Expected value=%s; actual %s", expected, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
124
internal/metrics/mapping.go
Normal file
124
internal/metrics/mapping.go
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
© Copyright IBM Corporation 2018
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Package metrics contains code to provide metrics for the queue manager
|
||||||
|
package metrics
|
||||||
|
|
||||||
|
type metricLookup struct {
|
||||||
|
name string
|
||||||
|
enabled bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// generateMetricNamesMap generates metric names mapped from their description
|
||||||
|
func generateMetricNamesMap() map[string]metricLookup {
|
||||||
|
|
||||||
|
metricNamesMap := map[string]metricLookup{
|
||||||
|
"CPU/SystemSummary/CPU load - one minute average": metricLookup{"cpu_load_one_minute_average_percentage", true},
|
||||||
|
"CPU/SystemSummary/CPU load - five minute average": metricLookup{"cpu_load_five_minute_average_percentage", true},
|
||||||
|
"CPU/SystemSummary/CPU load - fifteen minute average": metricLookup{"cpu_load_fifteen_minute_average_percentage", true},
|
||||||
|
"CPU/SystemSummary/System CPU time percentage": metricLookup{"system_cpu_time_percentage", true},
|
||||||
|
"CPU/SystemSummary/User CPU time percentage": metricLookup{"user_cpu_time_percentage", true},
|
||||||
|
"CPU/SystemSummary/RAM free percentage": metricLookup{"ram_free_percentage", true},
|
||||||
|
"CPU/SystemSummary/RAM total bytes": metricLookup{"system_ram_size_bytes", false},
|
||||||
|
"CPU/QMgrSummary/System CPU time - percentage estimate for queue manager": metricLookup{"system_cpu_time_estimate_for_queue_manager_percentage", true},
|
||||||
|
"CPU/QMgrSummary/User CPU time - percentage estimate for queue manager": metricLookup{"user_cpu_time_estimate_for_queue_manager_percentage", true},
|
||||||
|
"CPU/QMgrSummary/RAM total bytes - estimate for queue manager": metricLookup{"ram_usage_estimate_for_queue_manager_bytes", true},
|
||||||
|
"DISK/SystemSummary/MQ trace file system - free space": metricLookup{"trace_file_system_free_space_percentage", true},
|
||||||
|
"DISK/SystemSummary/MQ trace file system - bytes in use": metricLookup{"trace_file_system_in_use_bytes", true},
|
||||||
|
"DISK/SystemSummary/MQ errors file system - free space": metricLookup{"errors_file_system_free_space_percentage", true},
|
||||||
|
"DISK/SystemSummary/MQ errors file system - bytes in use": metricLookup{"errors_file_system_in_use_bytes", true},
|
||||||
|
"DISK/SystemSummary/MQ FDC file count": metricLookup{"fdc_files", true},
|
||||||
|
"DISK/QMgrSummary/Queue Manager file system - free space": metricLookup{"queue_manager_file_system_free_space_percentage", true},
|
||||||
|
"DISK/QMgrSummary/Queue Manager file system - bytes in use": metricLookup{"queue_manager_file_system_in_use_bytes", true},
|
||||||
|
"DISK/Log/Log - logical bytes written": metricLookup{"log_logical_written_bytes_total", true},
|
||||||
|
"DISK/Log/Log - physical bytes written": metricLookup{"log_physical_written_bytes_total", true},
|
||||||
|
"DISK/Log/Log - current primary space in use": metricLookup{"log_primary_space_in_use_percentage", true},
|
||||||
|
"DISK/Log/Log - workload primary space utilization": metricLookup{"log_workload_primary_space_utilization_percentage", true},
|
||||||
|
"DISK/Log/Log - write latency": metricLookup{"log_write_latency_seconds", true},
|
||||||
|
"DISK/Log/Log - bytes max": metricLookup{"log_max_bytes", true},
|
||||||
|
"DISK/Log/Log - write size": metricLookup{"log_write_size_bytes", true},
|
||||||
|
"DISK/Log/Log - bytes in use": metricLookup{"log_in_use_bytes", true},
|
||||||
|
"DISK/Log/Log file system - bytes max": metricLookup{"log_file_system_max_bytes", true},
|
||||||
|
"DISK/Log/Log file system - bytes in use": metricLookup{"log_file_system_in_use_bytes", true},
|
||||||
|
"DISK/Log/Log - bytes occupied by reusable extents": metricLookup{"log_occupied_by_reusable_extents_bytes", true},
|
||||||
|
"DISK/Log/Log - bytes occupied by extents waiting to be archived": metricLookup{"log_occupied_by_extents_waiting_to_be_archived_bytes", true},
|
||||||
|
"DISK/Log/Log - bytes required for media recovery": metricLookup{"log_required_for_media_recovery_bytes", true},
|
||||||
|
"STATMQI/SUBSCRIBE/Create durable subscription count": metricLookup{"durable_subscription_create_total", true},
|
||||||
|
"STATMQI/SUBSCRIBE/Alter durable subscription count": metricLookup{"durable_subscription_alter_total", true},
|
||||||
|
"STATMQI/SUBSCRIBE/Resume durable subscription count": metricLookup{"durable_subscription_resume_total", true},
|
||||||
|
"STATMQI/SUBSCRIBE/Delete durable subscription count": metricLookup{"durable_subscription_delete_total", true},
|
||||||
|
"STATMQI/SUBSCRIBE/Create non-durable subscription count": metricLookup{"non_durable_subscription_create_total", true},
|
||||||
|
"STATMQI/SUBSCRIBE/Delete non-durable subscription count": metricLookup{"non_durable_subscription_delete_total", true},
|
||||||
|
"STATMQI/SUBSCRIBE/Failed create/alter/resume subscription count": metricLookup{"failed_subscription_create_alter_resume_total", true},
|
||||||
|
"STATMQI/SUBSCRIBE/Subscription delete failure count": metricLookup{"failed_subscription_delete_total", true},
|
||||||
|
"STATMQI/SUBSCRIBE/MQSUBRQ count": metricLookup{"mqsubrq_total", true},
|
||||||
|
"STATMQI/SUBSCRIBE/Failed MQSUBRQ count": metricLookup{"failed_mqsubrq_total", true},
|
||||||
|
"STATMQI/SUBSCRIBE/Durable subscriber - high water mark": metricLookup{"durable_subscriber_high_water_mark", false},
|
||||||
|
"STATMQI/SUBSCRIBE/Durable subscriber - low water mark": metricLookup{"durable_subscriber_low_water_mark", false},
|
||||||
|
"STATMQI/SUBSCRIBE/Non-durable subscriber - high water mark": metricLookup{"non_durable_subscriber_high_water_mark", false},
|
||||||
|
"STATMQI/SUBSCRIBE/Non-durable subscriber - low water mark": metricLookup{"non_durable_subscriber_low_water_mark", false},
|
||||||
|
"STATMQI/PUBLISH/Topic MQPUT/MQPUT1 interval total": metricLookup{"topic_mqput_mqput1_total", true},
|
||||||
|
"STATMQI/PUBLISH/Interval total topic bytes put": metricLookup{"topic_put_bytes_total", true},
|
||||||
|
"STATMQI/PUBLISH/Failed topic MQPUT/MQPUT1 count": metricLookup{"failed_topic_mqput_mqput1_total", true},
|
||||||
|
"STATMQI/PUBLISH/Persistent - topic MQPUT/MQPUT1 count": metricLookup{"persistent_topic_mqput_mqput1_total", true},
|
||||||
|
"STATMQI/PUBLISH/Non-persistent - topic MQPUT/MQPUT1 count": metricLookup{"non_persistent_topic_mqput_mqput1_total", true},
|
||||||
|
"STATMQI/PUBLISH/Published to subscribers - message count": metricLookup{"published_to_subscribers_message_total", true},
|
||||||
|
"STATMQI/PUBLISH/Published to subscribers - byte count": metricLookup{"published_to_subscribers_bytes_total", true},
|
||||||
|
"STATMQI/CONNDISC/MQCONN/MQCONNX count": metricLookup{"mqconn_mqconnx_total", true},
|
||||||
|
"STATMQI/CONNDISC/Failed MQCONN/MQCONNX count": metricLookup{"failed_mqconn_mqconnx_total", true},
|
||||||
|
"STATMQI/CONNDISC/MQDISC count": metricLookup{"mqdisc_total", true},
|
||||||
|
"STATMQI/CONNDISC/Concurrent connections - high water mark": metricLookup{"concurrent_connections_high_water_mark", false},
|
||||||
|
"STATMQI/OPENCLOSE/MQOPEN count": metricLookup{"mqopen_total", true},
|
||||||
|
"STATMQI/OPENCLOSE/Failed MQOPEN count": metricLookup{"failed_mqopen_total", true},
|
||||||
|
"STATMQI/OPENCLOSE/MQCLOSE count": metricLookup{"mqclose_total", true},
|
||||||
|
"STATMQI/OPENCLOSE/Failed MQCLOSE count": metricLookup{"failed_mqclose_total", true},
|
||||||
|
"STATMQI/INQSET/MQINQ count": metricLookup{"mqinq_total", true},
|
||||||
|
"STATMQI/INQSET/Failed MQINQ count": metricLookup{"failed_mqinq_total", true},
|
||||||
|
"STATMQI/INQSET/MQSET count": metricLookup{"mqset_total", true},
|
||||||
|
"STATMQI/INQSET/Failed MQSET count": metricLookup{"failed_mqset_total", true},
|
||||||
|
"STATMQI/PUT/Persistent message MQPUT count": metricLookup{"persistent_message_mqput_total", true},
|
||||||
|
"STATMQI/PUT/Persistent message MQPUT1 count": metricLookup{"persistent_message_mqput1_total", true},
|
||||||
|
"STATMQI/PUT/Put persistent messages - byte count": metricLookup{"persistent_message_put_bytes_total", true},
|
||||||
|
"STATMQI/PUT/Non-persistent message MQPUT count": metricLookup{"non_persistent_message_mqput_total", true},
|
||||||
|
"STATMQI/PUT/Non-persistent message MQPUT1 count": metricLookup{"non_persistent_message_mqput1_total", true},
|
||||||
|
"STATMQI/PUT/Put non-persistent messages - byte count": metricLookup{"non_persistent_message_put_bytes_total", true},
|
||||||
|
"STATMQI/PUT/Interval total MQPUT/MQPUT1 count": metricLookup{"mqput_mqput1_total", true},
|
||||||
|
"STATMQI/PUT/Interval total MQPUT/MQPUT1 byte count": metricLookup{"mqput_mqput1_bytes_total", true},
|
||||||
|
"STATMQI/PUT/Failed MQPUT count": metricLookup{"failed_mqput_total", true},
|
||||||
|
"STATMQI/PUT/Failed MQPUT1 count": metricLookup{"failed_mqput1_total", true},
|
||||||
|
"STATMQI/PUT/MQSTAT count": metricLookup{"mqstat_total", true},
|
||||||
|
"STATMQI/GET/Persistent message destructive get - count": metricLookup{"persistent_message_destructive_get_total", true},
|
||||||
|
"STATMQI/GET/Persistent message browse - count": metricLookup{"persistent_message_browse_total", true},
|
||||||
|
"STATMQI/GET/Got persistent messages - byte count": metricLookup{"persistent_message_get_bytes_total", true},
|
||||||
|
"STATMQI/GET/Persistent message browse - byte count": metricLookup{"persistent_message_browse_bytes_total", true},
|
||||||
|
"STATMQI/GET/Non-persistent message destructive get - count": metricLookup{"non_persistent_message_destructive_get_total", true},
|
||||||
|
"STATMQI/GET/Non-persistent message browse - count": metricLookup{"non_persistent_message_browse_total", true},
|
||||||
|
"STATMQI/GET/Got non-persistent messages - byte count": metricLookup{"non_persistent_message_get_bytes_total", true},
|
||||||
|
"STATMQI/GET/Non-persistent message browse - byte count": metricLookup{"non_persistent_message_browse_bytes_total", true},
|
||||||
|
"STATMQI/GET/Interval total destructive get- count": metricLookup{"destructive_get_total", true},
|
||||||
|
"STATMQI/GET/Interval total destructive get - byte count": metricLookup{"destructive_get_bytes_total", true},
|
||||||
|
"STATMQI/GET/Failed MQGET - count": metricLookup{"failed_mqget_total", true},
|
||||||
|
"STATMQI/GET/Failed browse count": metricLookup{"failed_browse_total", true},
|
||||||
|
"STATMQI/GET/MQCTL count": metricLookup{"mqctl_total", true},
|
||||||
|
"STATMQI/GET/Expired message count": metricLookup{"expired_message_total", true},
|
||||||
|
"STATMQI/GET/Purged queue count": metricLookup{"purged_queue_total", true},
|
||||||
|
"STATMQI/GET/MQCB count": metricLookup{"mqcb_total", true},
|
||||||
|
"STATMQI/GET/Failed MQCB count": metricLookup{"failed_mqcb_total", true},
|
||||||
|
"STATMQI/SYNCPOINT/Commit count": metricLookup{"commit_total", true},
|
||||||
|
"STATMQI/SYNCPOINT/Rollback count": metricLookup{"rollback_total", true},
|
||||||
|
}
|
||||||
|
return metricNamesMap
|
||||||
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
// +build !mqdev
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
© Copyright IBM Corporation 2018
|
© Copyright IBM Corporation 2018
|
||||||
|
|
||||||
@@ -15,8 +13,25 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
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.
|
||||||
*/
|
*/
|
||||||
package main
|
package metrics
|
||||||
|
|
||||||
func postInit(name string) error {
|
import "testing"
|
||||||
return nil
|
|
||||||
|
func TestGenerateMetricNamesMap(t *testing.T) {
|
||||||
|
|
||||||
|
metricNamesMap := generateMetricNamesMap()
|
||||||
|
|
||||||
|
if len(metricNamesMap) != 93 {
|
||||||
|
t.Errorf("Expected mapping-size=%d; actual %d", 93, len(metricNamesMap))
|
||||||
|
}
|
||||||
|
|
||||||
|
actual, ok := metricNamesMap[testKey1]
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
t.Errorf("No metric name mapping found for %s", testKey1)
|
||||||
|
} else {
|
||||||
|
if actual.name != testElement1Name {
|
||||||
|
t.Errorf("Expected metric name=%s; actual %s", testElement1Name, actual.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
120
internal/metrics/metrics.go
Normal file
120
internal/metrics/metrics.go
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
© 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Package metrics contains code to provide metrics for the queue manager
|
||||||
|
package metrics
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/logger"
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/ready"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultPort = "9157"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
metricsEnabled = false
|
||||||
|
metricsServer = &http.Server{Addr: ":" + defaultPort}
|
||||||
|
)
|
||||||
|
|
||||||
|
// GatherMetrics gathers metrics for the queue manager
|
||||||
|
func GatherMetrics(qmName string, log *logger.Logger) {
|
||||||
|
|
||||||
|
// If running in standby mode - wait until the queue manager becomes active
|
||||||
|
for {
|
||||||
|
active, _ := ready.IsRunningAsActiveQM(qmName)
|
||||||
|
if active {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
time.Sleep(requestTimeout * time.Second)
|
||||||
|
}
|
||||||
|
|
||||||
|
metricsEnabled = true
|
||||||
|
|
||||||
|
err := startMetricsGathering(qmName, log)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Metrics Error: %s", err.Error())
|
||||||
|
StopMetricsGathering(log)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// startMetricsGathering starts gathering metrics for the queue manager
|
||||||
|
func startMetricsGathering(qmName string, log *logger.Logger) error {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
log.Errorf("Metrics Error: %v", r)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
log.Println("Starting metrics gathering")
|
||||||
|
|
||||||
|
// Start processing metrics
|
||||||
|
go processMetrics(log, qmName)
|
||||||
|
|
||||||
|
// Wait for metrics to be ready before starting the Prometheus handler
|
||||||
|
<-startChannel
|
||||||
|
|
||||||
|
// Register metrics
|
||||||
|
metricsExporter := newExporter(qmName, log)
|
||||||
|
err := prometheus.Register(metricsExporter)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Failed to register metrics: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup HTTP server to handle requests from Prometheus
|
||||||
|
http.Handle("/metrics", prometheus.Handler())
|
||||||
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(200)
|
||||||
|
// #nosec G104
|
||||||
|
w.Write([]byte("Status: METRICS ACTIVE"))
|
||||||
|
})
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
err = metricsServer.ListenAndServe()
|
||||||
|
if err != nil && err != http.ErrServerClosed {
|
||||||
|
log.Errorf("Metrics Error: Failed to handle metrics request: %v", err)
|
||||||
|
StopMetricsGathering(log)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// StopMetricsGathering stops gathering metrics for the queue manager
|
||||||
|
func StopMetricsGathering(log *logger.Logger) {
|
||||||
|
|
||||||
|
if metricsEnabled {
|
||||||
|
|
||||||
|
// Stop processing metrics
|
||||||
|
stopChannel <- true
|
||||||
|
|
||||||
|
// Shutdown HTTP server
|
||||||
|
timeout, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
err := metricsServer.Shutdown(timeout)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Failed to shutdown metrics server: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
227
internal/metrics/update.go
Normal file
227
internal/metrics/update.go
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
/*
|
||||||
|
© Copyright IBM Corporation 2018
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Package metrics contains code to provide metrics for the queue manager
|
||||||
|
package metrics
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/ibm-messaging/mq-container/internal/logger"
|
||||||
|
"github.com/ibm-messaging/mq-golang/ibmmq"
|
||||||
|
"github.com/ibm-messaging/mq-golang/mqmetric"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
qmgrLabelValue = mqmetric.QMgrMapKey
|
||||||
|
requestTimeout = 10
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
startChannel = make(chan bool)
|
||||||
|
stopChannel = make(chan bool, 2)
|
||||||
|
requestChannel = make(chan bool)
|
||||||
|
responseChannel = make(chan map[string]*metricData)
|
||||||
|
)
|
||||||
|
|
||||||
|
type metricData struct {
|
||||||
|
name string
|
||||||
|
description string
|
||||||
|
objectType bool
|
||||||
|
values map[string]float64
|
||||||
|
isDelta bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// processMetrics processes publications of metric data and handles describe/collect/stop requests
|
||||||
|
func processMetrics(log *logger.Logger, qmName string) {
|
||||||
|
|
||||||
|
var err error
|
||||||
|
var firstConnect = true
|
||||||
|
var metrics map[string]*metricData
|
||||||
|
|
||||||
|
for {
|
||||||
|
// Connect to queue manager and discover available metrics
|
||||||
|
err = doConnect(qmName)
|
||||||
|
if err == nil {
|
||||||
|
if firstConnect {
|
||||||
|
firstConnect = false
|
||||||
|
startChannel <- true
|
||||||
|
}
|
||||||
|
// #nosec G104
|
||||||
|
metrics, _ = initialiseMetrics(log)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now loop until something goes wrong
|
||||||
|
for err == nil {
|
||||||
|
|
||||||
|
// Process publications of metric data
|
||||||
|
// TODO: If we have a large number of metrics to process, then we could be blocked from responding to stop requests
|
||||||
|
err = mqmetric.ProcessPublications()
|
||||||
|
|
||||||
|
// Handle describe/collect/stop requests
|
||||||
|
if err == nil {
|
||||||
|
select {
|
||||||
|
case collect := <-requestChannel:
|
||||||
|
if collect {
|
||||||
|
updateMetrics(metrics)
|
||||||
|
}
|
||||||
|
responseChannel <- metrics
|
||||||
|
case <-stopChannel:
|
||||||
|
log.Println("Stopping metrics gathering")
|
||||||
|
mqmetric.EndConnection()
|
||||||
|
return
|
||||||
|
case <-time.After(requestTimeout * time.Second):
|
||||||
|
log.Debugf("Metrics: No requests received within timeout period (%d seconds)", requestTimeout)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.Errorf("Metrics Error: %s", err.Error())
|
||||||
|
|
||||||
|
// Close the connection
|
||||||
|
mqmetric.EndConnection()
|
||||||
|
|
||||||
|
// Handle stop requests
|
||||||
|
select {
|
||||||
|
case <-stopChannel:
|
||||||
|
log.Println("Stopping metrics gathering")
|
||||||
|
return
|
||||||
|
case <-time.After(requestTimeout * time.Second):
|
||||||
|
log.Println("Retrying metrics gathering")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// doConnect connects to the queue manager and discovers available metrics
|
||||||
|
func doConnect(qmName string) error {
|
||||||
|
|
||||||
|
// Set connection configuration
|
||||||
|
var connConfig mqmetric.ConnectionConfig
|
||||||
|
connConfig.ClientMode = false
|
||||||
|
connConfig.UserId = ""
|
||||||
|
connConfig.Password = ""
|
||||||
|
|
||||||
|
// Connect to the queue manager - open the command and dynamic reply queues
|
||||||
|
err := mqmetric.InitConnectionStats(qmName, "SYSTEM.DEFAULT.MODEL.QUEUE", "", &connConfig)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Failed to connect to queue manager %s: %v", qmName, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Discover available metrics for the queue manager and subscribe to them
|
||||||
|
err = mqmetric.DiscoverAndSubscribe("", true, "")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Failed to discover and subscribe to metrics: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// initialiseMetrics sets initial details for all available metrics
|
||||||
|
func initialiseMetrics(log *logger.Logger) (map[string]*metricData, error) {
|
||||||
|
|
||||||
|
metrics := make(map[string]*metricData)
|
||||||
|
validMetrics := true
|
||||||
|
metricNamesMap := generateMetricNamesMap()
|
||||||
|
|
||||||
|
for _, metricClass := range mqmetric.Metrics.Classes {
|
||||||
|
for _, metricType := range metricClass.Types {
|
||||||
|
if !strings.Contains(metricType.ObjectTopic, "%s") {
|
||||||
|
for _, metricElement := range metricType.Elements {
|
||||||
|
|
||||||
|
// Get unique metric key
|
||||||
|
key := makeKey(metricElement)
|
||||||
|
|
||||||
|
// Get metric name from mapping
|
||||||
|
if metricLookup, found := metricNamesMap[key]; found {
|
||||||
|
|
||||||
|
// Check if metric is enabled
|
||||||
|
if metricLookup.enabled {
|
||||||
|
|
||||||
|
// Check if metric is a delta type
|
||||||
|
isDelta := false
|
||||||
|
if metricElement.Datatype == ibmmq.MQIAMO_MONITOR_DELTA {
|
||||||
|
isDelta = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set metric details
|
||||||
|
metric := metricData{
|
||||||
|
name: metricLookup.name,
|
||||||
|
description: metricElement.Description,
|
||||||
|
isDelta: isDelta,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add metric
|
||||||
|
if _, exists := metrics[key]; !exists {
|
||||||
|
metrics[key] = &metric
|
||||||
|
} else {
|
||||||
|
log.Errorf("Metrics Error: Found duplicate metric key [%s]", key)
|
||||||
|
validMetrics = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Debugf("Metrics: Skipping metric, metric is not enabled for key [%s]", key)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Errorf("Metrics Error: Skipping metric, unexpected key [%s]", key)
|
||||||
|
validMetrics = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !validMetrics {
|
||||||
|
return metrics, fmt.Errorf("Invalid metrics data")
|
||||||
|
}
|
||||||
|
return metrics, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateMetrics updates values for all available metrics
|
||||||
|
func updateMetrics(metrics map[string]*metricData) {
|
||||||
|
|
||||||
|
for _, metricClass := range mqmetric.Metrics.Classes {
|
||||||
|
for _, metricType := range metricClass.Types {
|
||||||
|
if !strings.Contains(metricType.ObjectTopic, "%s") {
|
||||||
|
for _, metricElement := range metricType.Elements {
|
||||||
|
|
||||||
|
// Unexpected metric elements (with no defined mapping) are handled in 'initialiseMetrics'
|
||||||
|
// - if any exist, they are logged as errors and skipped (they are not added to the metrics map)
|
||||||
|
// Therefore we can ignore handling any unexpected metric elements found here
|
||||||
|
// - this avoids us logging excessive errors, as this function is called frequently
|
||||||
|
metric, ok := metrics[makeKey(metricElement)]
|
||||||
|
if ok {
|
||||||
|
// Clear existing metric values
|
||||||
|
metric.values = make(map[string]float64)
|
||||||
|
|
||||||
|
// Update metric with cached values of publication data
|
||||||
|
for label, value := range metricElement.Values {
|
||||||
|
normalisedValue := mqmetric.Normalise(metricElement, label, value)
|
||||||
|
metric.values[label] = normalisedValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset cached values of publication data for this metric
|
||||||
|
metricElement.Values = make(map[string]int64)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// makeKey builds a unique key for each metric
|
||||||
|
func makeKey(metricElement *mqmetric.MonElement) string {
|
||||||
|
return metricElement.Parent.Parent.Name + "/" + metricElement.Parent.Name + "/" + metricElement.Description
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user