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

Set up custom domain #161

Closed
Tracked by #60
tjementum opened this issue Jul 29, 2023 · 0 comments · Fixed by #196, #197, #199, #200 or #202
Closed
Tracked by #60

Set up custom domain #161

tjementum opened this issue Jul 29, 2023 · 0 comments · Fixed by #196, #197, #199, #200 or #202
Assignees
Labels
enhancement New feature or request

Comments

@tjementum
Copy link
Member

tjementum commented Jul 29, 2023

Background

To set up a custom domain and SSL certificate in Azure Container Apps two DNS records need to be added. E.g.

Type: CNAME
Host: account-management-api
Value: account-management-api.kindsand-a1a794b7.westeurope.azurecontainerapps.io

Type: TXT
Host: asuid.account-management-api
Value: CBCE06E92E4955E5625EC8190B8DD45CD98D72722D53468484C9000748278897

But there is a chicken and egg problem. These values need to be sent as parameters to Bicep scripts, but the values are not available before the environment is up and running. This includes both the value of the CNAME where the kindsand-a1a794b7 part is autogenerated by Azure, and the SHA1 hash for the TXT Record.

Challenges

  1. Autogenerated CNAME: The kindsand-a1a794b7 part in the CNAME value is autogenerated by Azure. Until the environment is up, we can't fetch this value.
  2. TXT Record SHA1 Hash: The hash is another piece of data that can't be determine until the environment is up.
  3. Bicep Script Parameters: Both values are needed as parameters to Bicep scripts, which complicates automation.
  4. Full Automation Requirement: The goal is to automate everything, so manual steps are undesirable.

Potential Solutions

  1. Two-Phase Deployment: First, deploy only the Azure Container App using Bicep. Once it's up, use Azure CLI or SDKs to fetch the autogenerated values, and then redeploy the Bicep script with these parameters. This makes the process semi-automatic but could be scripted.
  2. Custom DNS Management Script: Use Azure SDKs or Azure CLI to create a script that detects changes in the autogenerated domain name and updates DNS accordingly. This can run post-deployment. It's fully automated but adds an extra layer of complexity.
  3. Azure Functions/Webhooks: Utilize Azure Functions or similar to trigger when a new environment is up. The function can then update the DNS records. This is an event-driven approach.
  4. Azure Automation Account: Use Azure Automation to run a script that fetches the necessary data and updates the Bicep parameters. This could be a scheduled task that checks for changes and applies them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment