commit 56493d361c9005be7aee9527e178d9dce9c03976 Author: Rasmus Lauritsen Date: Sun Apr 28 23:00:46 2024 +0200 first commit diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..d8fb83d --- /dev/null +++ b/readme.md @@ -0,0 +1,61 @@ +## Creating a MQ container +https://www.ibm.com/docs/en/ibm-mq/9.3?topic=containers-mq-advanced-developers-container-image + +```bash +# Cleanup previous container +docker stop QM1 +docker rm QM1 +docker volume rm qm1data + +# Create volume and container +docker volume create qm1data +docker run \ +--detach \ +--env LICENSE=accept \ +--env MQ_ADMIN_PASSWORD=passw0rd \ +--env MQ_APP_PASSWORD=passw0rd \ +--env MQ_DEV=true \ +--env MQ_ENABLE_METRICS=true \ +--env MQ_QMGR_NAME=QM1 \ +--name QM1 \ +--publish 1414:1414 \ +--publish 9157:9157 \ +--publish 9443:9443 \ +--volume qm1data:/mnt/mqm \ +icr.io/ibm-messaging/mq:latest + +# Inside the container +echo "" > /mnt/mqm/data/web/installations/Installation1/servers/mqweb/mqwebuser.xml +echo "" >> /mnt/mqm/data/web/installations/Installation1/servers/mqweb/mqwebuser.xml +echo " " >> /mnt/mqm/data/web/installations/Installation1/servers/mqweb/mqwebuser.xml +echo " apiDiscovery-1.0" >> /mnt/mqm/data/web/installations/Installation1/servers/mqweb/mqwebuser.xml +echo " " >> /mnt/mqm/data/web/installations/Installation1/servers/mqweb/mqwebuser.xml +echo "" >> /mnt/mqm/data/web/installations/Installation1/servers/mqweb/mqwebuser.xml +endmqweb && sleep 5 && strmqweb +exit + +# Restart container +docker restart QM1 +``` +## Webconsole / Swagger UI +https://localhost:9443/ibmmq/console/#/ +https://localhost:9443/ibm/api/explorer + +## Using the API +```bash +curl --insecure -k https://localhost:9443/ibmmq/rest/v2/admin/action/qmgr/QM1/mqsc -X POST -u admin:passw0rd -H "ibm-mq-rest-csrf-token: value" -H "Content-Type: application/json" --data "{\"type\": \"runCommandJSON\",\"command\": \"define\", \"qualifier\": \"qlocal\",\"name\": \"MSGQ\"}" +``` + +### Expected output: +```bash +rasmus@pop-os:~$ curl --insecure -k https://localhost:9443/ibmmq/rest/v2/admin/action/qmgr/QM1/mqsc -X POST -u admin:passw0rd -H "ibm-mq-rest-csrf-token: value" -H "Content-Type: application/json" --data "{\"type\": \"runCommandJSON\",\"command\": \"define\", \"qualifier\": \"qlocal\",\"name\": \"MSGQ\"}" + +{ + "commandResponse": [{ + "completionCode": 0, + "reasonCode": 0, + "message": ["AMQ8006I: IBM MQ queue created."] + }], + "overallReasonCode": 0, + "overallCompletionCode": 0 + ``` \ No newline at end of file