lao8n / cnstlltn

MIT License
0 stars 0 forks source link

cnstlltn.ai connection deploy custom domain and managed certificate with bicep #5

Closed lao8n closed 11 months ago

lao8n commented 1 year ago
Screenshot 2023-06-28 at 15 46 30
lao8n commented 1 year ago

i think it is because the custom domain mapping gets wiped everytime i deploy as well

lao8n commented 12 months ago

https://stackoverflow.com/questions/74804714/how-can-i-add-a-custom-domain-to-azure-container-app-via-bicep image

lao8n commented 12 months ago

seeem to need to do something around this https://learn.microsoft.com/en-us/azure/templates/microsoft.app/containerapps?pivots=deployment-language-bicep#customdomain https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain?tabs=root%2Cazurecli

lao8n commented 12 months ago

https://learn.microsoft.com/en-us/azure/templates/microsoft.web/certificates?pivots=deployment-language-bicep https://learn.microsoft.com/en-us/azure/container-apps/custom-domains-certificates

lao8n commented 12 months ago

nothing beats old fashioned stack overflow https://stackoverflow.com/questions/76392675/use-bicep-to-deploy-an-azure-container-app-with-a-managed-certificate#:~:text=Create%20app%20environment%20and%20app%20container%20and%20also,in%20customer%20domain%20configuration%20%28Refer%20to%20customDomains%20property%29.

lao8n commented 12 months ago

deployment failed for the managed certificate image

lao8n commented 12 months ago

image Run azd provision --no-prompt

Provisioning Azure resources (azd provision) Provisioning Azure resources can take some time

Downloading Bicep Creating a deployment plan Creating/Updating resources You can view detailed progress in the Azure Portal: https://portal.azure.com/#blade/HubsExtension/DeploymentDetailsBlade/overview/id/%2Fsubscriptions%2F98d3a17a-a631-4a58-85f7-db2d9a7abae6%2Fproviders%2FMicrosoft.Resources%2Fdeployments%2Fcnstlltn-prod-1688748161

(✓) Done: Resource group: rg-cnstlltn-prod (✓) Done: Key Vault: kv-4a73yskoiju2e (✓) Done: Log Analytics workspace: log-4a73yskoiju2e (✓) Done: Application Insights: appi-4a73yskoiju2e (✓) Done: Portal dashboard: dash-4a73yskoiju2e (✓) Done: Azure Cosmos DB: cosmos-4a73yskoiju2e

ERROR: deployment failed: failing invoking action 'provision', error deploying infrastructure: deploying to subscription:

Deployment Error Details: DeploymentActive: Unable to edit or replace deployment 'container-apps': previous deployment from '7/7/2023 4:43:33 PM' is still active (expiration time is '7/14/2023 4:09:58 PM'). Please see https://aka.ms/arm-deploy-resources for usage details.

lao8n commented 12 months ago

image tried switching from cname to txt - tbf i think when i did it in the portal i used txt

lao8n commented 12 months ago

new error is RequireCustomHostnameInEnvironment: Creating managed certificate requires hostname 'cnstlltn.ai' added as a custom hostname to a container app in environment 'cae-4a73yskoiju2e' not sure if above is the dependency everyone is talking about https://stackoverflow.com/questions/74804714/how-can-i-add-a-custom-domain-to-azure-container-app-via-bicep

lao8n commented 12 months ago

https://johnnyreilly.com/azure-container-apps-bicep-managed-certificates-custom-domains#:~:text=Azure%20Container%20Apps%20support%20managed%20certificates%20and%20custom,deploy%20managed%20certificates%20and%20custom%20domains%20using%20Bicep.

lao8n commented 12 months ago

got a new build error which is MissingRegistrationForLocation: The subscription is not registered for the resource type 'dnszones' in the location 'eastus'. Please re-register for this provider in order to have access to this location.

az provider register --namespace Microsoft.Network

lao8n commented 12 months ago

https://github.com/microsoft/azure-container-apps/issues/607

lao8n commented 11 months ago

image finally failed but a certificate is showing image

lao8n commented 11 months ago

do decompiilng the umm stuff i have seen on azure portal you can do it by exporting the resource and then doing az bicep decompile --file template.json image frustratingly there is no export for the container app... so i'll try again two ways once as before and once with http... because to be fair the validation seems to time out for azure portal stuff as well - so werid.

lao8n commented 11 months ago

so previously i was trying to delete the managed environment and the containers but maybe that isn't necessary actually as i can just delete the managed certificate bit which is taking agaes and i'm not quite sure what is doing - technically the deployment is active which is the prorlbem so okay that is some progress i'm learning stuff hmm image

image

lao8n commented 11 months ago

so read the discussion more carefully and actually teh certificate succeeded it jsut didn't tell anyone about it - so maybe i can now do the third step? image

so i cancelled the deployment and the certificate is still there so that's good so maybe i can just try the third step as eveyrone suggests - the switch to http might have made the difference

lao8n commented 11 months ago

Deployment Error Details: InvalidTemplateDeployment: The template deployment 'web-container-app-update' is not valid according to the validation procedure. The tracking id is '13aac6e9-560b-47e4-8f96-201ce186686a'. See inner errors for details. ValidationForResourceFailed: Validation failed for a resource. Check 'Error.Details[0]' for more information. ContainerAppInvalidSchema: Invalid request body for container app. Path: $. Does not conform to Container App schema, please visit for more information https://docs.microsoft.com/azure/container-apps/azure-resource-manager-api-spec?tabs=arm-template#container-app new error message when i add parent maybe there is a way to validate bicep code locally so you can do it with az bicep build --file infra\app\web.bicep etc. but doesn't seem to highlight any errors

lao8n commented 11 months ago

so i somehow got it to work - not quite sure why image

this was the key commit https://github.com/lao8n/cnstlltn/commit/080ba4624c46e77fec0714e6a5a58142bb07903e i think the harded code website was the key change - and possible the date change? i'm not sure hmm