aheckmann / m

mongodb version management
MIT License
267 stars 55 forks source link

Add option to download MongoDB tools #62

Closed stennie closed 3 years ago

stennie commented 4 years ago

As of the MongoDB 4.4 RCs, database tools like mongodump, mongorestore, etc are now separately distributed and versioned from the core server so the tarball downloads only include mongod, mongos, and mongo.

MongoDB Database Tools version 100 supports 3.6 through 4.4. It would be helpful for m to have a shortcut to download the latest tools. The tool binaries should probably be saved in a separate directory from the server versions.

tfogo commented 4 years ago

I would love if we could add functionality to choose a version of tools to download. My ideal API for this would be adding a "tools" command that has several subcommands that mimic the behavior of the root commands:

m tools stable
m tools latest
m tools X.Y
m tools ls
m tools installed

As a disclaimer, I work on the database tools, so my need for switching between particular versions of tools is probably greater than typical users of m. Still I think this would be a great addition and the approach could be used to support mongosh too.

I'd be happy to contribute to implementing support for the new standalone tools.

stennie commented 4 years ago

Thanks @tfogo! I also regularly switch between different combinations of server/tools and your subcommand suggestion is in line with what I was thinking of.

Some help on testing and defining expected behaviour would be excellent:

Any another planning considerations would be helpful.

Regards, Stennie

tfogo commented 4 years ago

Awesome! The new tools use semver so the options for versions should be:

Any versioned release of tools is a stable version. The "latest" release channel points to the head of master and is unstable. The "stable" release channel points to the latest stable version. The release process documentation is here: https://github.com/mongodb/mongo-tools/blob/master/RELEASE.md

When using m to switch to an older server version which still includes the tools, should the server tool versions take precedence over the standalone tools?

Our recommendation to users is to always use the latest version of tools with non-EOL versions of the server. We guarantee tools will work with non-EOL versions, but they should work fine with earlier versions too. So I think it would be best to have the standalone tools take precedence over the server tools.

I think it would be worth changing the log messages to help make it clear what versions of each are being used. Something like:

$ m 4.0.10
Activating: Server 4.0.10, Database Tools 100.0.1

$ m tools 4.0.10
Activating: Server 4.0.10, Database Tools 4.0.10
tfogo commented 4 years ago

Also tagging @rychipman in case he has any thoughts.

rychipman commented 4 years ago

@tfogo covered all the points I would have brought up. The proposed API & log message changes LGTM!