Skip to content

Add new MongoDownloader tool #109

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

Merged
merged 8 commits into from
Mar 26, 2021
Merged

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Jan 20, 2021

This tool automates the download of latest MongoDB binaries (MongoDB Community Server and MongoDB Database Tools) for Linux, macOS and Windows.

  • MongoDB Community Server contains the mongod binary.
  • MongoDB Database Tools contains the mongoexport and mongoimport binaries.

Then it merges the binaries into a bin directory for each platform and moves other files into community-server and database-tools directories.

Here is how the layout of the tools directory looks like after downlading and extracting files for MongoDB Community Server 4.4.3 and MongoDB Database Tools 100.2.1:

.
├── README.md
├── mongodb-linux-4.4.3-database-tools-100.2.1
│   ├── bin
│   │   ├── mongod
│   │   ├── mongoexport
│   │   └── mongoimport
│   ├── community-server
│   │   ├── LICENSE-Community.txt
│   │   ├── MPL-2
│   │   ├── README
│   │   └── THIRD-PARTY-NOTICES
│   └── database-tools
│       ├── LICENSE.md
│       ├── README.md
│       └── THIRD-PARTY-NOTICES
├── mongodb-macos-4.4.3-database-tools-100.2.1
│   ├── bin
│   │   ├── mongod
│   │   ├── mongoexport
│   │   └── mongoimport
│   ├── community-server
│   │   ├── LICENSE-Community.txt
│   │   ├── MPL-2
│   │   ├── README
│   │   └── THIRD-PARTY-NOTICES
│   └── database-tools
│       ├── LICENSE.md
│       ├── README.md
│       └── THIRD-PARTY-NOTICES
└── mongodb-windows-4.4.3-database-tools-100.2.1
    ├── bin
    │   ├── mongod.exe
    │   ├── mongoexport.exe
    │   └── mongoimport.exe
    ├── community-server
    │   ├── LICENSE-Community.txt
    │   ├── MPL-2
    │   ├── README
    │   └── THIRD-PARTY-NOTICES
    └── database-tools
        ├── LICENSE.md
        ├── README.md
        └── THIRD-PARTY-NOTICES

Fixes #82

@0xced 0xced force-pushed the downloader branch 3 times, most recently from cdeef71 to e075c62 Compare January 21, 2021 16:09
@0xced
Copy link
Contributor Author

0xced commented Jan 22, 2021

I have tested the downloader on both on macOS and Windows so I'm pretty confident it works well.

I tried to run the tests with the new binaries and I encountered a problem: the logs are now in JSON format and the ReplicaSetReadyIdentifier log (i.e. transition to primary complete; database writes are now permitted) is not printed anymore resulting in this exceptions:

System.TimeoutException
Replica set initialization took longer than the specified timeout of 10 seconds. Please consider increasing the value of singleNodeReplSetWaitTimeout.

Some more work needs to be done for the tests to pass.

@0xced 0xced force-pushed the downloader branch 3 times, most recently from 7b7aeef to 0fb3008 Compare March 9, 2021 10:46
0xced added 2 commits March 9, 2021 13:24
This tool automates the download of latest MongoDB binaries (_MongoDB Community Server_ and _MongoDB Database Tools_) for Linux, macOS and Windows.

* _MongoDB Community Server_ contains the `mongod` binary.
* _MongoDB Database Tools_ contains the `mongoexport` and `mongoimport` binaries.

Then it merges the binaries into a `bin` directory for each platform and moves other files into `community-server` and `database-tools` directories.

Here is how the layout of the `tools` directory looks like after downlading and extracting files  for _MongoDB Community Server_ 4.4.3 and _MongoDB Database Tools_ 100.2.1:

```
.
├── README.md
├── mongodb-linux-4.4.3-database-tools-100.2.1
│   ├── bin
│   │   ├── mongod
│   │   ├── mongoexport
│   │   └── mongoimport
│   ├── community-server
│   │   ├── LICENSE-Community.txt
│   │   ├── MPL-2
│   │   ├── README
│   │   └── THIRD-PARTY-NOTICES
│   └── database-tools
│       ├── LICENSE.md
│       ├── README.md
│       └── THIRD-PARTY-NOTICES
├── mongodb-macos-4.4.3-database-tools-100.2.1
│   ├── bin
│   │   ├── mongod
│   │   ├── mongoexport
│   │   └── mongoimport
│   ├── community-server
│   │   ├── LICENSE-Community.txt
│   │   ├── MPL-2
│   │   ├── README
│   │   └── THIRD-PARTY-NOTICES
│   └── database-tools
│       ├── LICENSE.md
│       ├── README.md
│       └── THIRD-PARTY-NOTICES
└── mongodb-windows-4.4.3-database-tools-100.2.1
    ├── bin
    │   ├── mongod.exe
    │   ├── mongoexport.exe
    │   └── mongoimport.exe
    ├── community-server
    │   ├── LICENSE-Community.txt
    │   ├── MPL-2
    │   ├── README
    │   └── THIRD-PARTY-NOTICES
    └── database-tools
        ├── LICENSE.md
        ├── README.md
        └── THIRD-PARTY-NOTICES
```

Fixes Mongo2Go#82
@0xced 0xced force-pushed the downloader branch 2 times, most recently from f50947a to 96c4997 Compare March 9, 2021 20:08
0xced added 6 commits March 9, 2021 22:22
Also remove the AssemblyInfo.cs file and have everything in the csproj instead.
The `transition to primary complete` message in recent mongod versions now starts with a capital `T`.
* MongoDB Community Server 4.4.4
* MongoDB Database Tools 100.3.0

This is required for the tests to pass since the search patterns in the `MongoBinaryLocator` have been updated to match the new MongoDB naming scheme.
@0xced
Copy link
Contributor Author

0xced commented Mar 10, 2021

All the tests are now passing with the latest MongoDB server (4.4.4) on macOS. On Windows, I get the following error in when using commands that create console output → should not timeout:

MongoDB.Driver.MongoCommandException: Command dropIndexes failed: cannot perform operation: a background operation is currently running for collection IntegrationTest.TestCollection.

According to https://jira.mongodb.org/browse/SERVER-37726 this issue should be fixed in MongoDB 4.3.4 so maybe that's an issue with the C# driver?


To verify that the binaries committed in a55bd18 are the original ones, delete the 3 directories in the tools directory then download them with the new downloader tool:

cd src/MongoDownloader
dotnet run

You should see that the git repository has no diff if the latest versions are still MongoDB Community Server 4.4.4 and MongoDB Database Tools 100.3.0.

@JohannesHoppe
Copy link
Member

Awesome work!!! =)

According to https://jira.mongodb.org/browse/SERVER-37726 this issue should be fixed in MongoDB 4.3.4 so maybe that's an issue with the C# driver?

I don't see any issue in updating the C# driver, if this fixes the tests. The nuget package itself has no external dependencies (including the c# driver) at all.

@0xced
Copy link
Contributor Author

0xced commented Mar 11, 2021

I don't see any issue in updating the C# driver, if this fixes the tests.

The thing is, the tests are not fixed on Windows. 🙁 They pass 100% only on macOS (I haven't tested on Linux). Can you try yourself on Windows? Do yo get the same MongoDB.Driver.MongoCommandException in when_using_commands_that_create_console_output or do all the tests pass for you?

@0xced
Copy link
Contributor Author

0xced commented Mar 26, 2021

Have you had a chance to test with the latest version of MongoDB?

@JohannesHoppe
Copy link
Member

Same for me. 😞

  • 100% green on macOS
  • Mongo2GoTests.Runner.when_using_commands_that_create_console_output.should_not_timeout fails on Windows 10

Screen Shot 2021-03-27 at 00 42 09

@JohannesHoppe
Copy link
Member

Fixed! 🎉

@JohannesHoppe
Copy link
Member

@0xced I pushed v3 to nuget. Please give it a try! Many thanks for your support! 🙂👍

@0xced 0xced deleted the downloader branch March 28, 2021 14:32
@0xced
Copy link
Contributor Author

0xced commented Mar 28, 2021

Awesome, thanks for merging and releasing a new version on NuGet, it works like a charm. 🎉

@JohannesHoppe
Copy link
Member

I thank you for making it all possible. Great job! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UP FOR GRAPS: Download latest Mongodb binaries automatically for Linux / OSX / Win
2 participants