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

[Issue] [aspire] azd deploy removes custom domain bindings, can't work around after 1.9 #3875

Closed
mip1983 opened this issue May 8, 2024 · 10 comments
Assignees
Labels
aspire customer-reported identify a customer issue needs-team-attention Issues out of a milestone question

Comments

@mip1983
Copy link

mip1983 commented May 8, 2024

Output from azd version
Run azd version and copy and paste the output here:

azd version 1.9.0 (commit 651394c)

Describe the bug

After running 'azd deploy' (locally or via CI/CD), custom domain bindings are removed from my container apps.

I was working around this using 'azd infra synth' as I've outlined here, with custom domains added to the output of the bicep files and referenced in the yaml files.

As of 1.9, the *.tmpl.yaml files have moved to the AppHost of the aspire project, and despite adding back in the yaml for the custom domain, it doesn't seem to be picking it up n working anymore.

To Reproduce
Deploy the aspire starter template. Set up a custom domain binding with a bring your own certificate on the deployed web app. Redeploy via azd having run azd infra synth. See domain binding disappear.

Expected behavior
Domain bindings should be retained, and ideally #1765 addressed so there's a clear way of doing this.

Environment
Information on your environment:
* .NET 8 Aspire preview 6
* IDE and version : Visual Studio 2022 10.0 Preview 7

Additional context
Add any other context about the problem here.

@ellismg
Copy link
Member

ellismg commented May 8, 2024

As of 1.9, the *.tmpl.yaml files have moved to the AppHost of the aspire project, and despite adding back in the yaml for the custom domain, it doesn't seem to be picking it up n working anymore.

@mip1983 I'm a little surprised about this, the intention was to just move the files to the infra folder under the app host (named by the resource name) but allow customization there - I'll take a look as to why that isn't working.

Regarding #1765, the long term direction is to be able to do these customizations in C# code in the app host, instead of having to fall back to infra synth to make customizations, but the story is still being flushed out - it's a key priority for us post the initial GA of Aspire - we want to get to a place where you have full access to the IaC within the aspire app host so you can make customizations instead of needing to run azd infra synth and edit.

@ellismg
Copy link
Member

ellismg commented May 8, 2024

@mip1983 I just did a quick experiment locally where I took the aspire starter app, ran azd infra synth followed by azd up and then modified the webfrontend.tmpl.yaml to add an extra environment variable (a simplification for me instead of setting up a custom domain and everything, but should still let us know if the changes were getting picked up or not) and after running azd deploy again I could see my changes were deployed.

You might consider running with --debug and re-directing stderr to a file like 2>debug.log. We print a log message about what file we are loading and reading:

2024/05/08 13:01:30 service_target_dotnet_containerapp.go:186: using container app manifest from /Users/matell/dd/ellismg/AspireStarterChanges/AspireStarterChanges.AppHost/infra/webfrontend.tmpl.yaml

If we can't find the file, we log a message saying we are generating the infrastructure again from the manifest - I wonder if that's what is happening here?

@rajeshkamal5050 rajeshkamal5050 added this to the Backlog milestone May 10, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-team-attention Issues out of a milestone label May 10, 2024
@mip1983
Copy link
Author

mip1983 commented May 10, 2024

Thanks @ellismg, I'll do some digging today with debug and see what I can see. I do have another instance of me and someone else finding it's not picking things up from yaml files in #3597, so maybe it is being generated again.

@mip1983
Copy link
Author

mip1983 commented May 10, 2024

I've tried it running azd deploy locally with debug and my domain binding remains. I can see in the debug output:

2024/05/10 11:41:31 service_target_dotnet_containerapp.go:186: using container app manifest from 
D:\source\ecoDriverAnalytics\ecoDriverAnalytics.Aspire\ecoDriverAnalytics.Aspire.AppHost\infra\ecodriver-analytics-api.tmpl.yaml

Which looks correct.

However, when I try it from Azure DevOps, the domain binding is removed again, the output on the Azure DevOps console is:

2024/05/10 10:52:02 service_target_dotnet_containerapp.go:195: generating container app manifest from /home/vsts/work/1/s/.\ecoDriverAnalytics.Aspire\ecoDriverAnalytics.Aspire.AppHost\ecoDriverAnalytics.Aspire.AppHost.csproj for project ecodriver-analytics-api

yaml files are checked in, I've tried copy to output to see if that makes a difference, but no luck.

@mip1983
Copy link
Author

mip1983 commented May 13, 2024

@ellismg

Looking at the manifest path where it's not picked up the file running the DevOps pipeline, it looks a bit odd with the different slash directions, so I wondered if it was working locally on windows 11, but having trouble on the build agent which is ubuntu.

I've just tried updating my Azure DevOps build pipeline to use 'windows_latest' rather than 'ubuntu_latest', and that seems to work, my app has deployed without losing the custom domain binding set in my yaml file.

Hopefully that helps you track this down, seems like a linux path issue.

@vhvb1989
Copy link
Member

vhvb1989 commented Jul 9, 2024

@mip1983 , you can now use azd config set alpha.aca.persistDomains on to make azd to persist your domains w/o requiring to infra synth. See: #3955

@microsoft-github-policy-service microsoft-github-policy-service bot removed the needs-team-attention Issues out of a milestone label Jul 9, 2024
@mip1983
Copy link
Author

mip1983 commented Jul 10, 2024

Thanks @vhvb1989, I'll give that a try. Do you know if the problem with it not finding the manifest on the linux build agent has been resolved as well? Still using a windows agent at the moment.

@mip1983
Copy link
Author

mip1983 commented Jul 18, 2024

/unresolve

Hi @vhvb1989, I've been running with 'azd config set alpha.aca.persistDomains on' configured in my build pipeline for a little while and it's generally worked until now.

Just did a build/release just now, one environment was fine but on production it took out the domain name binding for one of the container apps (certificate was still in place on the container apps environment and the binding was still there on the other container app).

Both are using a wildcard certificate uploaded to the container apps environment, both are using 'A' records and the domain names validate in the UI.

@vhvb1989
Copy link
Member

Thanks @vhvb1989, I'll give that a try. Do you know if the problem with it not finding the manifest on the linux build agent has been resolved as well? Still using a windows agent at the moment.

Still an issue :(

@rajeshkamal5050
Copy link
Contributor

Marking this a complete for persisting the custom domains.

We can use #3891 for tracking the CI/CD pipeline path issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aspire customer-reported identify a customer issue needs-team-attention Issues out of a milestone question
Projects
None yet
Development

No branches or pull requests

4 participants