mongodb-js / mongodb-prebuilt

Install MongoDB prebuilt package using npm https://npmjs.org/package/mongodb-prebuilt
ISC License
56 stars 50 forks source link

fails to start in circleci node docker image #61

Open beatthat opened 4 years ago

beatthat commented 4 years ago

Mongo installed y mongo-prebuilt into any recent circleci/node docker image will fail to start with missing shared objects.

STEPS

  1. run the docker image as a shell
docker run --rm -it  --entrypoint /bin/bash --workdir /test circleci/node:12.13
  1. Install mongod-prebuilt
sudo npm install -g mongodb-prebuilt
  1. Run mongod
mongod

EXPECTED

Mongo starts successfully

ACTUAL

Fails to start with this error about unable to load libcrypto.so.1.0.0:

/home/circleci/.mongodb-prebuilt/mongodb-download/aa7220af5e9371f6c91e884d508c10a0/mongodb-linux-x86_64-debian81-4.1.10-425-g3b00dc3/bin/mongod: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory

With a little more digging, the installed version of all things libssl seems to be 1.0.2, e.g.

sudo find / -name "libcrypto*"

/usr/lib/x86_64-linux-gnu/pkgconfig/libcrypto.pc
/usr/lib/x86_64-linux-gnu/libcrypto.a
/usr/lib/x86_64-linux-gnu/libcrypto.so
/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
/usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2

...and here is the linux version info for circleci/node:12.13

circleci@48541f4403be:~$ lsb_release -a

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.11 (stretch)
Release:    9.11
Codename:   stretch

For context, what I'm trying to do is run tests using mongo-unit, which in turn seems to be starting a local mongo instance using mongod-prebuilt. My tests work on my mac laptop, but fail to run at all on circleci, and with digging it seems like this is the cause.

josemontesp commented 3 years ago

Have you found a workaround for this? I'm having the same issue in Circle CI, and also Gitpod.

josemontesp commented 3 years ago

I ran it passing the debug env flag. This is what I got in the console

  mongodb-prebuilt bin path: /workspace/poster-house-api/src/node_modules/mongodb-prebuilt/dist/3.2.0/bin/ +5s
/workspace/poster-house-api/src/node_modules/mongodb-prebuilt/dist/3.2.0/bin/
  mongodb-prebuilt spawn /workspace/poster-house-api/src/node_modules/mongodb-prebuilt/dist/3.2.0/bin/mongod --storageEngine ephemeralForTest --bind_ip 127.0.0.1 --port 8000 --dbpath /workspace/poster-house-api/src/node_modules/mongo-in-memory/.data-11qe4ts +2ms
  mongodb-prebuilt child process exited with code 127
beatthat commented 3 years ago

Have you found a workaround for this? I'm having the same issue in Circle CI, and also Gitpod.

Yes, in our case, the underlying fix was to switch from mongo-prebuilt to mongodb-memory-server, which works and is more actively maintained.

We were using mongo-prebuilt only indirectly through use of mongo-unit, so I reported the issue there and then PR'ed this fix, which has since been merged and released.