aspire-samples icon indicating copy to clipboard operation
aspire-samples copied to clipboard

DatabaseMigrations service does not work in ACA

Open BartNetJS opened this issue 1 year ago • 1 comments

Hi, I've implemented the DatabaseMigrations sample in my solution. It works fine on my development machine

When I deploy via azd up, it gets deployed to aca. But the migration service never stops.

And console logs are strange:

{"EventId":0,"LogLevel":"Information","Category":"Program","Message":"Entering app startup."}
{"EventId":0,"LogLevel":"Information","Category":"Program","Message":"Using settings file: /var/msi/settings/capps.json"}
{"EventId":0,"LogLevel":"Information","Category":"Program","Message":"Settings file not found. Creating one.."}
{"EventId":0,"LogLevel":"Information","Category":"Program","Message":"Copying from local file: capps.json"}
{"EventId":0,"LogLevel":"Information","Category":"Program","Message":"Found initial lifecycle value: main."}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Azure.AppService.TokenService.ManagedIdentityInformationProvider.ConfigurationManagedIdentityInformationProvider","Message":"Configuration update started. Site: migrations","CorrelationId":"00000000-0000-0000-0000-000000000000","SiteName":"migrations"}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Azure.AppService.TokenService.ManagedIdentityInformationProvider.ConfigurationManagedIdentityInformationProvider","Message":"Token service settings configuration found. Setting lifecycle to main","CorrelationId":"00000000-0000-0000-0000-000000000000"}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Azure.AppService.TokenService.CertificateProvider.P12FileCertificateProvider","Message":"Start load certificate. Client ID: 8a3659e3-a1f0-47a2-a2ec-bfd712931f48. Name: 1987e263-3d81-41b3-b019-02ae4acd1ce6","CorrelationId":"00000000-0000-0000-0000-000000000000"}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Azure.AppService.TokenService.CertificateProvider.P12FileCertificateProvider","Message":"Finished loading certificate. Client ID: 8a3659e3-a1f0-47a2-a2ec-bfd712931f48. Name: 1987e263-3d81-41b3-b019-02ae4acd1ce6","CorrelationId":"00000000-0000-0000-0000-000000000000"}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Azure.AppService.TokenService.ManagedIdentityInformationProvider.ConfigurationManagedIdentityInformationProvider","Message":"[UserAssigned] Added Identity with ClientId: 8a3659e3-a1f0-47a2-a2ec-bfd712931f48 | ResourceId: /subscriptions/86acb8d9-8100-431b-a38c-bc9fc7420798/resourcegroups/rg-spikes-dev/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mi-j7pcrz7inuv2k | Lifecycle: all","CorrelationId":"00000000-0000-0000-0000-000000000000","IdentityType":"UserAssigned","ClientId":"8a3659e3-a1f0-47a2-a2ec-bfd712931f48","ResourceId":"/subscriptions/86acb8d9-8100-431b-a38c-bc9fc7420798/resourcegroups/rg-spikes-dev/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mi-j7pcrz7inuv2k","Lifecycle":"all"}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Azure.AppService.TokenService.ManagedIdentityInformationProvider.ConfigurationManagedIdentityInformationProvider","Message":"[SiteMetadataProvider] AddOrUpdateSite - SiteName: migrations | Secret: 8aa88c65-7968-4c0c-8e11-7a5431be43b5 | Type: Msi","CorrelationId":"00000000-0000-0000-0000-000000000000","SiteName":"migrations","Secret":"8aa88c65-7968-4c0c-8e11-7a5431be43b5","Type":"Msi"}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Azure.AppService.TokenService.Startup","Message":"Starting TokenService version 2.0.2.16 from /app with the ContainerApps SKU. Environment check: IsLinuxDedicated: False, IsLinuxConsumption: False, IsContainerApps: True, IsContainerAppSystemService: False, IsWindows: False.","CorrelationId":"00000000-0000-0000-0000-000000000000"}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Azure.AppService.TokenService.Middleware.CorrelationIdMiddleware","Message":"Request to TokenService: Endpoint localhost:42356, Port 42356, Path /healthcheck, Query ?api-version=2021-08-01, Method GET, UserAgent curl/8.8.0","CorrelationId":"5f2d3517-aae2-4d3a-83ca-d7b1761cd3b2","Endpoint":"localhost:42356","Port":42356,"Path":"/healthcheck","Query":"?api-version=2021-08-01","Method":"GET","UserAgent":"curl/8.8.0"}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Azure.AppService.TokenService.Middleware.CorrelationIdMiddleware","Message":"Returning response for Site , Endpoint localhost:42356, Port 42356, Path /healthcheck, Method GET, Result = 200, Duration: 610","CorrelationId":"5f2d3517-aae2-4d3a-83ca-d7b1761cd3b2","SiteName":"","Endpoint":"localhost:42356","Port":42356,"Path":"/healthcheck","Method":"GET","Result":"200","DurationInMs":610}

What can be wrong?

BartNetJS avatar Nov 28 '24 20:11 BartNetJS

I just created an example and deployed it and had no issues (aside the fact that by default ACA doesn't allow ingress from public internet and so it must be enable manually...but that is unreleaed to migration deployment). Take a look here: https://github.com/Azure-Samples/azure-sql-db-aspire

yorek avatar Mar 21 '25 18:03 yorek