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

Add DbGate support for MongoDB #453

Merged
merged 9 commits into from
Feb 10, 2025
Merged

Add DbGate support for MongoDB #453

merged 9 commits into from
Feb 10, 2025

Conversation

Alirexaa
Copy link
Member

@Alirexaa Alirexaa commented Feb 6, 2025

**Contributes to #415 **

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • New integration
    • Docs are written
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

Other information

@Alirexaa
Copy link
Member Author

Alirexaa commented Feb 6, 2025

Running the Postgres-ext example causes multiple DbGate containers to spin up—one for Postgres and another for MongoDB.

This occurred because we shared and compiled DbGateContainerResource.cs in two projects. This means these types are not what we expected(as same or equal type), as they have different assemblies. Therefore, the following code does not function as intended.

        //The `else` branch will be hit because DbGateContainerResource is not the same.
        if (builder.Resources.OfType<DbGateContainerResource>().SingleOrDefault() is { } existingDbGateResource)
        {
            var builderForExistingResource = builder.CreateResourceBuilder(existingDbGateResource);
            return builderForExistingResource;
        }
        else
        {
            var dbGateContainer = new DbGateContainerResource(name);
            var dbGateContainerBuilder = builder.AddResource(dbGateContainer)
                                               .WithImage(DbGateContainerImageTags.Image, DbGateContainerImageTags.Tag)
                                               .WithImageRegistry(DbGateContainerImageTags.Registry)
                                               .WithHttpEndpoint(targetPort: 3000, port: port, name: DbGateContainerResource.PrimaryEndpointName)
                                               .ExcludeFromManifest();

            return dbGateContainerBuilder;
        }

@aaronpowell, I suggest adding CommunityToolkit.Aspire.Hosting.DbGate and placing these shared files there.

@Alirexaa Alirexaa requested review from shiranshalom and aaronpowell and removed request for shiranshalom February 6, 2025 20:54
@Alirexaa Alirexaa added this to the 9.2 milestone Feb 6, 2025
@aaronpowell
Copy link
Member

Ah yes, that's a really good point.

You're right, we're going to need to create that package for the shared types.

@Alirexaa
Copy link
Member Author

Alirexaa commented Feb 7, 2025

@aaronpowell PR is ready for review.

Copy link
Member

@aaronpowell aaronpowell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question on the README

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just provide a mostly empty README since this is a package that isn't really designed for direct consumption?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can not pack the packages with an empty README, but I updated the README to indicate that this package is designed for internal consumption.

@Alirexaa Alirexaa enabled auto-merge (squash) February 10, 2025 07:46
@Alirexaa Alirexaa merged commit f0936d9 into main Feb 10, 2025
6 checks passed
@Alirexaa Alirexaa deleted the alirexaa/dbgate-mongodb branch February 10, 2025 07:49
Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
Aspire.Hosting.MongoDB 38% 19% 136
CommunityToolkit.Aspire.EventStore 100% 100% 46
CommunityToolkit.Aspire.GoFeatureFlag 100% 97% 74
CommunityToolkit.Aspire.Hosting.ActiveMQ 70% 27% 144
CommunityToolkit.Aspire.Hosting.ActiveMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder 100% 100% 22
CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps 100% 100% 28
CommunityToolkit.Aspire.Hosting.Bun 81% 71% 54
CommunityToolkit.Aspire.Hosting.Dapr 60% 51% 560
CommunityToolkit.Aspire.Hosting.Dapr.AzureRedis 93% 71% 54
CommunityToolkit.Aspire.Hosting.DbGate 63% 11% 62
CommunityToolkit.Aspire.Hosting.Deno 84% 75% 72
CommunityToolkit.Aspire.Hosting.EventStore 90% 71% 62
CommunityToolkit.Aspire.Hosting.GoFeatureFlag 59% 11% 62
CommunityToolkit.Aspire.Hosting.Golang 94% 50% 16
CommunityToolkit.Aspire.Hosting.Java 69% 72% 120
CommunityToolkit.Aspire.Hosting.Meilisearch 61% 27% 94
CommunityToolkit.Aspire.Hosting.MongoDB.Extensions 65% 38% 80
CommunityToolkit.Aspire.Hosting.Ngrok 59% 50% 58
CommunityToolkit.Aspire.Hosting.NodeJS.Extensions 90% 68% 92
CommunityToolkit.Aspire.Hosting.Ollama 65% 64% 198
CommunityToolkit.Aspire.Hosting.PapercutSmtp 92% 50% 10
CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions 70% 45% 88
CommunityToolkit.Aspire.Hosting.Python.Extensions 69% 50% 86
CommunityToolkit.Aspire.Hosting.RavenDB 64% 49% 176
CommunityToolkit.Aspire.Hosting.Rust 94% 83% 16
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects 74% 61% 114
CommunityToolkit.Aspire.Hosting.Sqlite 96% 96% 38
CommunityToolkit.Aspire.MassTransit.RabbitMQ 100% 100% 30
CommunityToolkit.Aspire.Meilisearch 97% 92% 68
CommunityToolkit.Aspire.Microsoft.Data.Sqlite 89% 85% 52
CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite 50% 50% 88
CommunityToolkit.Aspire.OllamaSharp 87% 82% 68
CommunityToolkit.Aspire.RavenDB.Client 60% 53% 237
Summary 71% (4762 / 6715) 55% (1432 / 2610) 3119

Minimum allowed line rate is 60%

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

Successfully merging this pull request may close these issues.

2 participants