mq-mqi-nodejs icon indicating copy to clipboard operation
mq-mqi-nodejs copied to clipboard

Deployment error on IBM Z, air-gapped system

Open pgzisis opened this issue 4 years ago • 7 comments

Hi mq-mqi-nodejs team

We have a node.js application that makes use of mq-mqi-nodejs. As mentioned in the title, not having an internet connection in an air-gapped environment as well as the target architecture which is s390x has added some additional complexity. The issue rises once we try to build our docker image.

Version of mq-mqi-nodejs: 0.9.16

Part of the relevant Dockerfile:

FROM .../s390x/node:14 AS build

ENV LD_LIBRARY_PATH=/usr/mqc9100/lib64
ENV MQIJS_NOREDIST=true

ADD 9.2.0.0-IBM-MQC-Redist-LinuxX64.tar.gz /usr/mqc9100

WORKDIR /usr/src/app

COPY package.json ./

COPY node-v14.15.4-headers.tar.gz .

RUN npm config set registry .../ && \
    npm config set tarball /usr/src/app/node-v14.15.4-headers.tar.gz

RUN npm install --only=prod

Part of the error logs, errors occur on step RUN npm install --only=prod:

> [email protected] install /usr/src/app/node_modules/ffi-napi
> node-gyp-build

make: Entering directory '/usr/src/app/node_modules/ffi-napi/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  AR(target) Release/obj.target/../node-addon-api/src/nothing.a
  COPY Release/nothing.a
  CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
In file included from ../deps/libffi/src/prep_cif.c:27:0:
../deps/libffi/include/ffi_common.h:17:23: fatal error: fficonfig.h: No such file or directory
 #include <fficonfig.h>
                       ^
compilation terminated.
make: *** [Release/obj.target/ffi/deps/libffi/src/prep_cif.o] Error 1
deps/libffi/ffi.target.mk:131: recipe for target 'Release/obj.target/ffi/deps/libffi/src/prep_cif.o' failed
make: Leaving directory '/usr/src/app/node_modules/ffi-napi/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 4.18.0-193.23.1.el8_2.s390x
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/app/node_modules/ffi-napi
gyp ERR! node -v v14.5.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 

Lastly, the same error appears when using 9.2.0.0-IBM-MQC-UbuntuLinuxS390X.tar.gz. It contains .deb installation files that we are able to install on Z-Linux using:

RUN /tmp/MQClient/mqlicense.sh -accept & \
    apt install /tmp/MQClient/ibmmq-*.deb

pgzisis avatar Feb 10 '21 09:02 pgzisis

It looks like the problem is actually due to lack of full support in the ffi-napi package for buliding on the s390x platform. I've opened an issue against that, but until it gets resolved, integrated and a new version released, automatic building is not going to work.

ibmmqmet avatar Feb 10 '21 18:02 ibmmqmet

Thank you for looking into this.

Would you have any suggestions on how we could build everything manually?

pgzisis avatar Feb 11 '21 10:02 pgzisis

Not something I've tried or will spend any time on experimenting with, but I might suggest something like npm install --ignore-scripts to get all the prereqs at least downloaded. Then for all the packages with a script:build or script:install stage named in their package.json I'd look to run those pieces manually. Which might in turn mean running node-gyp build. And for the specific compile error, then I'd look at the linked issues in the ffi-napi repository to see what might need to be done to patch up the s390x build.

ibmmqmet avatar Feb 11 '21 13:02 ibmmqmet

In your extensive documentation, you mention Alternative JavaScript routes into MQ. Within that section, MQTT is mentioned as an alternative way to communicate with MQ. We have a Nest.js application and there is built-in integration with MQTT https://docs.nestjs.com/microservices/mqtt.

We are using mq.Connx, mq.Open, mq.Close, mq.Disc, mq.Put, mq.CrtMh, mq.DltMh, mq.InqMp and mq.Get from your API.

In your experience, would you see this as a possible solution?

pgzisis avatar Feb 11 '21 14:02 pgzisis

Unlikely that MQTT would help - it's a pub/sub model. The other alternative is the MQ REST messaging interface but suitability of that would depend on exact messaging requirements including things like formats and transactionality. And since you imply using message properties, it's very unlikely that would be flexible enough.

ibmmqmet avatar Feb 12 '21 08:02 ibmmqmet

Can we raise an RFE or an issue to enable support for Z and P architecture for this module. We need this to support the MQ capabilities of our product on multiple platforms. Manually compiling may be unreliable it will be great if the module supports all native platforms for consumption.

srihakum avatar May 12 '22 07:05 srihakum

The key prereq that needs "compiling" for other platforms is the ffi-napi component that links to the native C libraries. That's not something that can be provided directly here, but instead you can lobby in the ffi-napi repo for more platforms. Though I know people have asked for s390x to be integrated already without a lot of success - perhaps you can submit a PR there to assist.

ibmmqmet avatar May 12 '22 15:05 ibmmqmet