Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silently failing in manjaro linux #107

Closed
germanp opened this issue Nov 14, 2018 · 15 comments
Closed

Silently failing in manjaro linux #107

germanp opened this issue Nov 14, 2018 · 15 comments

Comments

@germanp
Copy link

germanp commented Nov 14, 2018

Hi,

I'm trying to configure jest to use this package but I've found that doesn't work with manjaro. This is the error I get when I activate the debugging:

Determining test suites to run...  Mongo[45603] Starting MongoDB instance with following options: {"port":45603,"dbName":"jest","uri":"mongodb://127.0.0.1:45603/jest","storageEngine":"ephemeralForTest","dbPath":"/tmp/mongo-mem-16705EyirF2mqsJ7s"} +0ms
  Mongo[45603] MongoBinary options: {"downloadDir":"/home/german/Proyectos/dyd/dyd-plus/node_modules/.cache/mongodb-memory-server/mongodb-binaries","platform":"linux","arch":"x64","version":"latest"} +1ms
  Mongo[45603] MongoBinary: Mongod binary path: /home/german/Proyectos/dyd/dyd-plus/node_modules/.cache/mongodb-memory-server/mongodb-binaries/latest/mongod +6ms
  Mongo[45603] MongoBinary: Download lock removed +6ms
  Mongo[45603] STDERR: /home/german/Proyectos/dyd/dyd-plus/node_modules/.cache/mongodb-memory-server/mongodb-binaries/latest/mongod: /usr/lib/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by /home/german/Proyectos/dyd/dyd-plus/node_modules/.cache/mongodb-memory-server/mongodb-binaries/latest/mongod)
  Mongo[45603]  +1ms
  Mongo[45603] CLOSE: 1 +0ms
Done in 2.70s.

Seems like it is downloading the ubuntu's version which does not work with manjaro, I've tried manually downloading the generic one and it works well. Besides that I think whould be very useful to throw some exception in this case. I checked the code and maybe it can be changed around there https://github.com/nodkz/mongodb-memory-server/blob/master/src/util/MongoInstance.js#L148 to handle an exit codes different than 0, but I'm not realy sure.

Greetings.

@nodkz
Copy link
Collaborator

nodkz commented Nov 14, 2018

Very similar problem was with ubuntu 18 and mongodb v4 #89 (comment)

Just need determine correct distro for downloading in https://github.com/nodkz/mongodb-memory-server/blob/master/src/util/MongoBinaryDownloadUrl.js

If you have time to make a pull request, please do it. Right now i'm prepearing talk for conference and can look on this problem only in the next month.

Also will be great if you try to play with error reporting in another pull request.

Thanks!

@AJRdev
Copy link
Collaborator

AJRdev commented Nov 15, 2018

@germanp What do you mean by downloading from the generic one ? From which mirror link are you downloading the binary for manjaroo ?

@germanp
Copy link
Author

germanp commented Nov 15, 2018

@AJRdev This one works with manjaro:

http://downloads.mongodb.org/linux/mongodb-linux-x86_64-latest.tgz

The directory tree isn't browseable anymore, but you can check the link here, https://www.mongodb.com/download-center/community, it is the one labeled as 64-bit Legacy

@AJRdev
Copy link
Collaborator

AJRdev commented Nov 15, 2018

@germanp Ok thanks for info, so it's pretty weird because that link is the default fallback if the os distrib is not found here :
https://github.com/nodkz/mongodb-memory-server/blob/master/src/util/MongoBinaryDownloadUrl.js#L116

In this function, if you are in an Manjaroo environment, we will have os.dist equal to "Arch Linux" so it will fallback in the getLegacyVersionString function that returns an empty string.

Where did you saw on your logs that it was downloading the ubuntu version of the mongodb binary ?

@germanp
Copy link
Author

germanp commented Nov 15, 2018

The actual problem is that getos is resolving to ubuntu linux. There are some PRs that should fix that (retrohacker/getos#69 and retrohacker/getos#73), but there weren't merged.

@AJRdev
Copy link
Collaborator

AJRdev commented Nov 15, 2018

@germanp Well it's weird since I just tested getos in a Manjaroo environement with docker, and just printed out the result of getos and had :

{ os: 'linux', dist: 'Arch Linux' }

It doesn't seem to resolve into ubuntu linux..
I've used this docker image for my test : https://hub.docker.com/r/zalox/manjaro/

How do you know that it is resolving to ubuntu linux, on the PR you gave and the issues of the getos repos, I don't see that kind of behaviour that is reported.

The PR just give a more precise description of the distrib returned by getos (Arch Linux -> Manjaroo Linux) but nothing about returning ubuntu in that environment.

@germanp
Copy link
Author

germanp commented Nov 15, 2018

This is from the node's console:

> const getos = require('getos')
undefined
> getos((err, os) => console.log(os))
undefined
> { os: 'linux', dist: 'Ubuntu Linux' }

@AJRdev
Copy link
Collaborator

AJRdev commented Nov 15, 2018

Ok well I don't really know why it is not returning Ubuntu in the Manjaroo docker image

cat /etc/arch-release 
Manjaro Linux
node
> const getos = require('getos')
undefined
> getos((err, os) => console.log(os))
undefined
> { os: 'linux', dist: 'Arch Linux' }

Anyway I don't know if we can do something since the problem comes from getos, and the collaborators don't seem very active on their repo...

As a temporary fix for your case, you could use the environment variable MONGOMS_DOWNLOAD_MIRROR to specify the download link for the Mongodb binary, and point it to the right link.

@retrohacker
Copy link

retrohacker commented Nov 22, 2018

Hi, getos maintainer here, sorry for the radio silence on these PRs. I merged the Manjaro PR today, let me know if this resolves the problem on that distribution.

Taking a look at the arch file now, may do some finagling with that file to make sure we don't accidentally cause other operating systems to regress by reshuffling the order markers appear in, we've had that happen in the past.

@retrohacker
Copy link

Alright, Arch is bumped up in the file and Raspbian appears to still be working: c58eef6b097f105de0957897f8c134df07437b67

Released as 3.1.1

@AJRdev
Copy link
Collaborator

AJRdev commented Nov 22, 2018

@retrohacker Awesome thanks ! @germanp Could you give it a try again ?

@germanp
Copy link
Author

germanp commented Nov 22, 2018

getos is working for me now:

> const getos = require("getos")
undefined
> getos
[Function: getOs]
> getos((e, os) => console.log(e, os))
undefined
> null { os: 'linux',
  dist: 'Manjaro Linux',
  codename: 'illyria',
  release: '18.0.0' }

AJRdev pushed a commit that referenced this issue Nov 22, 2018
@AJRdev
Copy link
Collaborator

AJRdev commented Nov 22, 2018

@germanp @nodkz I've created a PR to update the getos package to 3.1.1 to fix this OS detection issue.

AJRdev pushed a commit that referenced this issue Nov 22, 2018
@AJRdev
Copy link
Collaborator

AJRdev commented Nov 23, 2018

@germanp My PR has been merged, can you update this repo package and see that it is downloading the right mongodb binary ? :)

@germanp
Copy link
Author

germanp commented Nov 23, 2018

@AJRdev Yes, I confirm that is working ok now, Thanks for the help!

Maybe next week I can send a PR to improve throwing an error when the command fails.

@AJRdev AJRdev closed this as completed Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants