Skip to content

Conversation

@tommasodotNET
Copy link
Contributor

Closes #639

DAB can now be run as executable locally. This allows support for https and OTEL in the local dev experience:

var dab = builder.AddDataAPIBuilder("dab")
    .RunAsExecutable()
    .WaitFor(sqlServer)
    .WithReference(sqlDatabase);

When the application is in Publish mode, the RunAsExecutable extension will be ignored and the resource will be deployed using the DAB docker image.

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
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • 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

Copilot AI review requested due to automatic review settings September 3, 2025 14:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds API support for running Data API Builder (DAB) as a local executable instead of just as a container. The main purpose is to enable HTTPS and OpenTelemetry (OTEL) support in the local development experience while maintaining container deployment for publish mode.

Key changes:

  • Introduces RunAsExecutable() extension method that creates an executable resource in development mode while falling back to container deployment in publish mode
  • Adds new DataApiBuilderExecutableResource class and IDataApiBuilderResource interface to support both container and executable resource types
  • Updates example configuration to demonstrate the new functionality with OTEL telemetry support

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
DataApiBuilderHostingExtension.cs Adds the RunAsExecutable() extension method and refactors shared defaults into generic method
DataApiBuilderContainerResource.cs Introduces interface abstraction and new executable resource class with shared constants
ContainerResourceCreationTests.cs Comprehensive test coverage for the new executable functionality including argument construction, endpoints, and error cases
dab-config.json Updates example configuration to include OpenTelemetry settings
Program.cs Demonstrates usage of the new RunAsExecutable() method

tommasodotNET and others added 6 commits September 3, 2025 17:08
…piBuilderHostingExtension.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…piBuilderContainerResource.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…piBuilderHostingExtension.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2025

Code Coverage

Package Line Rate Branch Rate Complexity Health
CommunityToolkit.Aspire.EventStore 100% 100% 46
CommunityToolkit.Aspire.GoFeatureFlag 100% 97% 74
CommunityToolkit.Aspire.Hosting.ActiveMQ 79% 40% 100
CommunityToolkit.Aspire.Hosting.ActiveMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.Adminer 73% 50% 20
CommunityToolkit.Aspire.Hosting.Azure.Dapr 66% 50% 832
CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis 97% 88% 36
CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder 96% 86% 56
CommunityToolkit.Aspire.Hosting.Bun 82% 71% 54
CommunityToolkit.Aspire.Hosting.Dapr 62% 51% 728
CommunityToolkit.Aspire.Hosting.DbGate 94% 50% 18
CommunityToolkit.Aspire.Hosting.Deno 84% 75% 72
CommunityToolkit.Aspire.Hosting.EventStore 94% 100% 18
CommunityToolkit.Aspire.Hosting.GoFeatureFlag 93% 50% 18
CommunityToolkit.Aspire.Hosting.Golang 87% 70% 28
CommunityToolkit.Aspire.Hosting.Java 69% 72% 120
CommunityToolkit.Aspire.Hosting.k6 58% 12% 20
CommunityToolkit.Aspire.Hosting.LavinMQ 78% 50% 18
CommunityToolkit.Aspire.Hosting.LavinMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.MailPit 91% 50% 14
CommunityToolkit.Aspire.Hosting.McpInspector 89% 55% 148
CommunityToolkit.Aspire.Hosting.Meilisearch 73% 57% 50
CommunityToolkit.Aspire.Hosting.Minio 93% 75% 48
CommunityToolkit.Aspire.Hosting.MongoDB.Extensions 96% 83% 36
CommunityToolkit.Aspire.Hosting.MySql.Extensions 100% 88% 78
CommunityToolkit.Aspire.Hosting.Ngrok 52% 35% 82
CommunityToolkit.Aspire.Hosting.NodeJS.Extensions 97% 78% 286
CommunityToolkit.Aspire.Hosting.Ollama 67% 70% 174
CommunityToolkit.Aspire.Hosting.PapercutSmtp 92% 50% 10
CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions 99% 89% 84
CommunityToolkit.Aspire.Hosting.Python.Extensions 68% 55% 90
CommunityToolkit.Aspire.Hosting.RavenDB 63% 49% 136
CommunityToolkit.Aspire.Hosting.Redis.Extensions 100% 71% 48
CommunityToolkit.Aspire.Hosting.Rust 94% 83% 16
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects 76% 64% 154
CommunityToolkit.Aspire.Hosting.Sqlite 99% 89% 42
CommunityToolkit.Aspire.Hosting.SqlServer.Extensions 100% 87% 78
CommunityToolkit.Aspire.Hosting.SurrealDb 54% 37% 234
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.Minio.Client 73% 59% 88
CommunityToolkit.Aspire.OllamaSharp 74% 69% 120
CommunityToolkit.Aspire.RavenDB.Client 60% 53% 237
CommunityToolkit.Aspire.SurrealDb 79% 63% 78
Summary 73% (7818 / 10721) 60% (2442 / 4058) 4855

Minimum allowed line rate is 60%

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.

Before doing a detailed review, I want to ask a question about the design.

My assumption is that the intent of RunAsExecutable would be to treat the exe version as a local dev only solution, essentially an emulator right?

Working on that assumption, I think it'd be best to use the pattern we see with RunAsEmulator on things like the Azure Storage resource, or RunAsContainer for databases.

The primary difference in the design would be that you don't return the "emulated" resource, but instead you provide it as a callback to the RunAsEmulator method (or in this case RunAsExecutable). That way, if there's stuff you want to do that is specific to the "emulated" resource, you do it in the callback, and everything else is bubbled up from the real resource.

@ErikEJ
Copy link
Contributor

ErikEJ commented Sep 4, 2025

@tommasodotNET Does this also address #388 ?

@aaronpowell
Copy link
Member

@ErikEJ it would in a sense as you don't have to inject the certificates into the container so you can get OTEL since it's running on the host that DCP runs on.

But with #602 there is a new method that will allow injecting certificates into containers, which would unblock it in a different manner.

@tommasodotNET
Copy link
Contributor Author

Let's wait for #602 and see if that solves the issue for both otel and https support in dab locally. If it does, this extension might not be needed.

@tommasodotNET
Copy link
Contributor Author

in any case, we should update the dab image tag to at least 1.4.26 since it introduces support for otel.

@github-actions github-actions bot added the Stale label Sep 10, 2025
@github-actions github-actions bot closed this Sep 13, 2025
@aaronpowell aaronpowell reopened this Sep 15, 2025
@aaronpowell aaronpowell removed the Stale label Sep 15, 2025
@aaronpowell aaronpowell deleted the issue-639 branch September 26, 2025 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data API Builder RunAsExecutable

4 participants