-
Notifications
You must be signed in to change notification settings - Fork 85
Deployment stuck in "Pending" state when using Aspire.Hosting.Azure.Sql locally #529
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
Comments
Related to #434 I believe |
@yorek What happens if you remove usage of SQL Projects? Can you share a dashboard screen shot? @aaronpowell Yes, sounds related to #434 |
That looks like a good catch. I wonder how we can best tackle it, do we create a separate |
What is the difference between builder.AddAzureSqlServer("sql") And .AddSqlServer Is it deployment support or anything else? |
@aaronpowell If you use Microsoft.Data.SqlClient you end up with a lot of Azure "stuff" anyway currently. |
What if the Resource classes here were in a seperate package? https://github.com/dotnet/aspire/tree/main/src/Aspire.Hosting.Azure.Sql |
Thinking through this, the question, in my mind, is "what happens if it's an Azure SQL resource?", as in, not configured to be a container locally, just purely an Azure SQL resource - should (can?) it deploy to Azure SQL? Since the SqlDatabaseProjects package doesn't produce anything in the manifest, it means we have to be careful on how the support works. Take this code for example: var sqlSrv = builder.AddAzureSqlServer("sql");
var sqlDb = sqlSrv.AddDatabase("aspiretodo");
var dbPrj = builder.AddSqlProject<Projects.TodoDB>("tododb")
.WithReference(sqlDb)
.WaitFor(sqlDb); What happens when you use Aspire to deploy? Well, the So back to the problem at hand, I think this works (I haven't tested): var dbPrj = builder.AddSqlProject<Projects.TodoDB>("tododb");
var sqlSrv = builder.AddAzureSqlServer("sql")
.RunAsContainer(resource => {
// find databases from the resource, or maybe via the builder
});
var sqlDb = sqlSrv.AddDatabase("aspiretodo"); The callback provided to |
Hey both, from my understanding the |
I think it should, right? Conceptually it would be equivalent to run EF Core migrations against Azure SQL instead of SQL Server and that is expected to work right away |
Yep, I'd expect so (I'm just unfamiliar with the tooling that powers the integration). Deployment is more complex though, as you need to run the dacpac deployment as part of the Bicep files, which I guess you'd do as a custom script in Bicep, but you'd need to somehow upload the dacpac to somewhere that it can be downloaded in the script run. This is why it's not currently enabled for deployment - deployment makes it complex. |
Yeah, I dug into the source - since there is no "Azure SQL Container" it spins up a plain SQL Server 2022 container...
Yeah, exactly! And I absolutely agree that this is a noble end goal! I am not an expert, but maybe the following options are worth investigating:
|
Yep, that is fine and expected |
@yorek We seem to be discussing at least two topics here
Maybe you should open a new issue for the second topic? Did you try what @aaronpowell suggested above? @jmezach Any thoughts on this issue - it would be a great scenario to support. |
@ErikEJ I would definitely want to support the ability to deploy a .dacpac to an Azure SQL-like container during local development. One might argue that at least for local-dev there really isn't a distinction between Azure SQL and SQL Server. Not sure why it gets stuck into a pending state though. If the target resource is not a |
@jmezach Good observation. I will attempt to debug.. |
Ok, let me open a new issue for the .dacpac deployment then. Here we can just continue focusing on the local container. I updated the issue name to better reflect that. |
@yorek Thanks, I think you will agree that it takes more than this little NuGet package to accomplish this! |
Created: #595 |
Definitely. I added an idea in the issue I just opened. |
@yorek OK, I got some useful insights from @jmezach as usual! So you should not use Removing that will cause deployment to start, but it will fail if you do not have a persisted container and database volume, since it will start too early. |
With a regular SqlServer reference (not AzureSqlServer) with WaitFor works perfectly:
So maybe the issues is really not in the SqlDatabaseProject object, but in AzureSqlServer one, and specifically in the ? |
@yorek Yes, I think that the RunAsContainer method does not really participate corrrectly in the eventing system |
builder.ApplicationBuilder.Eventing.Subscribe<AfterResourcesCreatedEvent>(async (@event, ct) => {
await RunPublish(builder, target, targetDatabaseName, @event.Services, ct);
}); If the RunAsContainer method was updated for eventing, I think this would work out of the box with the current implementation |
Should we file an issue on the main Aspire repo? |
@jmezach I think so, looks like even an attempt was made to fix this: dotnet/aspire#6164 @mitchdenny FYI |
@jmezach @yorek I created an issue here: dotnet/aspire#8383 |
We have noticed this issue has not been updated within 21 days. If there is no action on this issue in the next 14 days, we will automatically close it. You can use |
Describe the bug
When using
AddAzureSqlServer("").RunAscontainer()
using theAspire.Hosting.Azure.Sql
package, the deployment just hangs. No error, no logs...just hanging, and deployment reports "Pending" as a status.Regression
No response
Steps to reproduce
Expected behavior
Deploy the database project
Screenshots
No response
IDE and version
Other
IDE version
VS Code
Nuget packages
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item
The text was updated successfully, but these errors were encountered: