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

Upgrade to mongodb version 6 ??? #10

Open
windward-hive opened this issue Mar 26, 2023 · 4 comments
Open

Upgrade to mongodb version 6 ??? #10

windward-hive opened this issue Mar 26, 2023 · 4 comments

Comments

@windward-hive
Copy link

Please, would be nice

@leandroguimaraes
Copy link

It can be done this way: leandroguimaraes@2e62132

@diegosasw
Copy link

diegosasw commented May 25, 2023

@leandroguimaraes thanks for that.

Do you know why your image wouldn't work on GitLab CI/CD as a service? I haven't tried in GitHub.

Not sure if it has to do with the HOST name, which is needed, as localhost does not mean anything when running a docker container as a service in GitLab, therefore I use the alias mongors and I refer to that connection string

mongodb://mongors:27017,mongors:27018,mongors:27019/?replicaSet=rs0&readPreference=primary&ssl=false

But for some reason, my functional tests, which work well when running the mongo Replica set container in my local, don't work when running it in GitLab CI/CD

I can see the following error in console before the traces about timeout connectivity show

MongoServerError: No host described in new configuration with {version: 1, term: 0} for replica set rs0 maps to this node

My CI/CD job looks like this

test:
    stage: test
    services:
        -   name: registry.gitlab.com/myrepo/mongo-rs:latest
            alias: mongors
    variables:
        # MongoDB
        HOST: "mongors"
    before_script:
        - echo "Wait, even more, for infrastructure"
        - sleep 60;
    script:
        - dotnet test --blame --configuration Release --logger "console;verbosity=minimal" --collect:"XPlat Code Coverage"
        - echo "tests will fail because of connectivity to mongors"
    allow_failure: false

And the exceptions have to do with timeout due to a ReplicaSetGhost.

System.TimeoutException: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Connected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/mongors:27017" }", EndPoint: "Unspecified/mongors:27017", ReasonChanged: "Heartbeat", State: "Connected", ServerVersion: 6.0.0, TopologyVersion: { "processId" : ObjectId("646f8812f45968696afba908"), "counter" : NumberLong(0) }, Type: "ReplicaSetGhost", WireVersionRange: "[0, 17]", LastHeartbeatTimestamp: "2023-05-25T16:11:22.6016326Z", LastUpdateTimestamp: "2023-05-25T16:11:22.6016336Z" }] }.
   at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedAsync(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Clusters.Cluster.SelectServerAsync(IServerSelector selector, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelectionAsync(CancellationToken cancellationToken)
   at MongoDB.Driver.MongoClient.AreSessionsSupportedAsync(CancellationToken cancellationToken)
   at MongoDB.Driver.MongoClient.StartImplicitSessionAsync(CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSessionAsync[TResult](Func`2 funcAsync, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionBase`1.ReplaceOneAsync(FilterDefinition`1 filter, TDocument replacement, ReplaceOptions options, Func`3 bulkWriteAsync)

However connectivity within GitLab CI/CD seems fine

$ nc -zv mongors 27017
Connection to mongors (172.17.0.4) 27017 port [tcp/*] succeeded!
$ nc -zv mongors 27018
Connection to mongors (172.17.0.4) 27018 port [tcp/*] succeeded!
$ nc -zv mongors 27019
Connection to mongors (172.17.0.4) 27019 port [tcp/*] succeeded!

so it looks like the problem is with the replicaset

Any tip would be much appreciated!

@windward-hive
Copy link
Author

It can be done this way: leandroguimaraes@2e62132

this never worked for me. it gives some error, but I didn't bother to debug extensively. also considering there's a newer version of mongodb, i decided to make this in light of version 7.

to whom it may concern

@pubkey
Copy link

pubkey commented Sep 13, 2023

@maybesmurf thank you very much. This helps me a lot.

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