- Main Readme
- About
- Settings
- Prerequisites
- Install
- Uses
- Pending
- Appendix
This project is build to integrate GoLang into IBM-MQ-Usage As starting-point this repos have been used
- mq-golang was used as a starting-point integration part
- MQ messaging REST API tutorial
- Getting started with the messaging REST API
- Used on our MQS-Container (only Point 4. Replace the existing configuration file, mqwebuser.xml) Basic configuration for the mqweb server
- Using token-based authentication with the REST API
What | Why | |
---|---|---|
Docker | as it is used for all your containers | |
docker-compose | as we work only with comosed containers | |
File | Description | |
---|---|---|
./config.base | Definitions for all needed Project- and Container-Related Environment | |
./env.sh | environment-load script e.g. used by ./dc | |
./dc | docker-compose commands including environment-load | |
./docker-compose | docker-compose for all containers in this project |
- Side Note
- If you change the
CONIXMQM_MQMGR:QM1
in./_config.base
to something different thenQM1
- the
./mq-test.sh
ingomq_mqc_1
will no longer work. The TestCases are not designed, to use it correctly
- If you change the
Folder | Description | |
---|---|---|
mqs | IDM-MQ-Server | |
mqc | GoLang-MqClient | |
mqw | Writer to Queue CONIX.LOCAL.QUEUE | |
mqr | Reader to Queue CONIX.LOCAL.QUEUE |
Url | Description | |
---|---|---|
Portainer | http://localhost:10001 |
- Testing go-progs
- cd gopath/src/github.com/conix/mqio
- go run mq-io.go -config ../../../../config/queue.config.producer.host.json -limit 5
- go run mq-io.go -config ../../../../config/queue.config.producer.host.json -browse
- go run mq-io.go -config ../../../../config/queue.config.producer.host.json -consume
- Enviroment are loaded from project-root/_conifg.base by project-root/env.sh
- All docker related stuff should be managed by project-root/dc-script, as this loads the environment
./dc build mqc
and./dc build mqs
or./dc build
to build your container / containers./dc up
to startup your cluster (takes 30sec to startup and config coinx-settings)./dc down
to shutdown your cluster
- MQS-Container is used to setup the Conix-Queue
- The Startup-Script used is
./mqs/mq-entry.sh
- The Conix-Queue-Config is
./mqs/mq-setup.sh
- Alternative the Conix-Config can be done by
./mqs/11-dev.mqsc
- copied to
/etc/mqm
in the container at build-time- BUT
- this has not been tested !!!
- the
./mqs/mq-setup.sh
-call has to be disabled in./mqs/mq-entry.sh
- BUT
- Alternative the Conix-Config can be done by
- The Startup-Script used is
- Test conix-queue (earliest >30sec after cluster is up)
docker exec -it gomq_mqs_1 ./mq-test.sh
test golang-base within containerdocker exec -it gomq_mqc_1 ./mq-io-test.sh
test golang-jms selfmade code within container. ./project-root/mqs/mq-test.sh
test on your host
- Control your Docker Containers via Portainer used on locale Build-Stack
- on first connect you have to define your admin password (this is never asked again, so take care)
- choose following settings and contiune
These projects are related to or derived from this one. This is not a complete list
Repository | Description | |
---|---|---|
ibm-messaging/mq-metric-samples | Extracts metrics for use in Prometheus, Influx JSON consumers etc. |
|
ibm-messaging/mq-golang-jms20 | JMS-style messaging interface for Go applications | |
ibm-messaging/mq-container | Building MQ into containers. Uses features from this package for configuration and |
|
felix-lessoer/qbeat | Extract monitoring and statstics from MQ for use in Elasticsearch | |
ibm-messaging/mq-mqi-nodejs | A similar MQI interface for Node.js applications |
- Dev-Pattern
- Start here goto Download HTTPS and then select your version
- [helm install stable/jaeger-operator --version 2.8.0]
- inside docker-mq-client-container
-
# --------------------------------------------------------------------------- # Configure your Go environment variables # --------------------------------------------------------------------------- . /go/.profile
-
- on your project-root at your host
-
# --------------------------------------------------------------------------- # only needed on "go build" if, # you have not used standard installation-path as /opt/mqm # --------------------------------------------------------------------------- export MQ_OS_LIBPATH="/opt/mqm" export CGO_CFLAGS="-I${MQ_OS_LIBPATH}/inc" \ export CGO_LDFLAGS="-L${MQ_OS_LIBPATH}/lib64 -Wl,-rpath,${MQ_OS_LIBPATH}/lib64" \
- inside the docker-mq-client-container it's already done
-
# --------------------------------------------------------------------------- git clone https://github.com/ibm-messaging/mq-golang.git ${GOPATH}/src/github.com/ibm-messaging/mq-golang # --------------------------------------------------------------------------- cd ${GOPATH}/src/github.com/ibm-messaging/mq-golang/ibmmq/ go build
- this is done only inside the docker-mq-client-container
-
The most straightforward way to use this golang-image is to use a Go container as both the build and runtime environment. In your Dockerfile
, writing something along the lines of the following will compile and run your project:
#ROM golang:1.8
FROM golang/1.12-alpine3.10
WORKDIR /go/src/app
COPY . .
RUN go get -d -v ./...
RUN go install -v ./...
CMD ["app"]
You can then build and run the Docker image:
$ docker build -t go-ctx .
$ docker run -it --rm --name go-app go-ctx
There may be occasions where it is not appropriate to run your app inside a container. To compile, but not run your app inside the Docker instance, you can write something like:
$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp golang:1.8 go build -v
This will add your current directory as a volume to the container, set the working directory to the volume, and run the command go build
which will tell go to compile the project in the working directory and output the executable to myapp
. Alternatively, if you have a Makefile
, you can run the make
command inside your container.
$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp golang:1.8 make
see also howto Use multistage builds