-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Purpose And fix doc order issue ## Does this introduce a breaking change? <!-- Mark one with an "x". --> ``` [ ] Yes [x] No ``` ## Pull Request Type What kind of change does this Pull Request introduce? <!-- Please check the one that applies to this PR using "x". --> ``` [x] Bugfix [x] Feature [ ] Code style update (formatting, local variables) [ ] Refactoring (no functional changes, no api changes) [x] Documentation content changes [ ] Other... Please describe: ```
- Loading branch information
1 parent
d04f42e
commit 1683b31
Showing
26 changed files
with
184 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,67 @@ | ||
--- | ||
title: '1. Prepare the configuration' | ||
title: '1. Prepare the environment' | ||
layout: default | ||
nav_order: 1 | ||
parent: 'Lab 8: Use Azd to deploy the lab solution' | ||
parent: 'Lab 6: Deploy to Azure automatically' | ||
--- | ||
|
||
# 1. Prepare the configuration | ||
# 1. Prepare the environment | ||
|
||
Fill the configuration file according to your environment. | ||
Prepare your local environment and plan your Azure resource, get ready for the one-click deployment. | ||
|
||
{: .note } | ||
> This automation guide is tested in linux environment only. Here we use WSL environment to run the automation tool. | ||
## Step by step guidance | ||
|
||
1. If you want to use azd to deploy from a new environment, prepare your images in Azure Container Registry | ||
1. Install WSL environment | ||
Note: you may skip this step if you are using other linux environment. | ||
Install WSL to your windows system [How to install Linux on Windows with WSL](https://learn.microsoft.com/en-us/windows/wsl/install) | ||
|
||
```bash | ||
APPNAME=petclinic | ||
RESOURCE_GROUP=rg-$APPNAME | ||
1. Install tools | ||
|
||
- Follow this guide to install azd tool to your WSL environment: [Install Azd](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd?tabs=winget-windows%2Cbrew-mac%2Cscript-linux&pivots=os-linux) | ||
- Install az cli: [Install az](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt#option-1-install-with-one-command) | ||
- Install docker: [Docker Desktop WSL 2](https://docs.docker.com/desktop/wsl/) | ||
|
||
1. Plan your Azure Container Registry | ||
|
||
An Azure Container Registry is required to save the images for the solution, either create a new Container Registry or use an existing one: | ||
- Option 1: Create a new Azure Container Registry | ||
|
||
# prepare ACR | ||
MYACR=acr$APPNAME | ||
```bash | ||
ACR_RESOURCE_GROUP=<your-resource-group> | ||
ACR_NAME=<acr-name> | ||
az acr create \ | ||
-n $MYACR \ | ||
-g $RESOURCE_GROUP \ | ||
-n $ACR_NAME \ | ||
-g $ACR_RESOURCE_GROUP \ | ||
--sku Basic \ | ||
--admin-enabled true | ||
``` | ||
|
||
ACR_ID=$(az acr show -n $MYACR -g $RESOURCE_GROUP --query id -o tsv) | ||
- Option 2: Use existing | ||
Collect the values for variable `ACR_RESOURCE_GROUP` and `ACR_NAME` | ||
Please add yourself the `Contributor` role in the container registry, we will: | ||
1. push images to the acr. | ||
1. assign `AcrPull` permission to new user managed identity. | ||
|
||
# create user managed identity | ||
ACR_IDENTITY=uid-acr-$APPNAME | ||
1. Prepare placeholder image to Azure Container Registry | ||
In the azd deploy process, we will first create azure resource and container apps, then update the target container apps with the code in the lab solution. | ||
In this step, we push a placeholder image for the new container apps. | ||
|
||
az identity create --resource-group $RESOURCE_GROUP --name $ACR_IDENTITY | ||
ACR_UMID=$(az identity show --resource-group $RESOURCE_GROUP --name $ACR_IDENTITY --query id --output tsv) | ||
SP_ID=$(az identity show --resource-group $RESOURCE_GROUP --name $ACR_IDENTITY --query principalId --output tsv) | ||
CLIENT_ID=$(az identity show --resource-group $RESOURCE_GROUP --name $ACR_IDENTITY --query clientId --output tsv) | ||
- login to acr with command `az acr login -n $ACR_NAME` | ||
- use a simple java image as the placeholder image: | ||
|
||
# assign role | ||
az role assignment create --assignee $SP_ID --scope $ACR_ID --role acrpull | ||
```bash | ||
az acr import --name $ACR_NAME \ | ||
--source mcr.microsoft.com/azurespringapps/default-banner:distroless-2024022107-66ea1a62-87936983 \ | ||
--image azurespringapps/default-banner:latest | ||
``` | ||
|
||
1. Prepare your images to Azure Container Registry | ||
You may use the ACR createed in Lab 3, and the user managed identity too. | ||
Please build your passwordless image after Lab 4. | ||
|
||
1. In your local repo, open file `infra/bicep/main.parameters.json`, fill the parameters | ||
|
||
- vnetEndpointInternal: is the container apps subnet internal-only? | ||
- sqlAdmin: the admin user for sql server | ||
- sqlAdminPassword: the admin password for sql server | ||
- configGitRepo: Default to this repo `https://github.com/Azure-Samples/spring-petclinic-microservices-config` | ||
- configGitPath: `passwordless` profile default to directory `config` in this repo | ||
- acrRegistry: The ACR address with your build images, `$MYACR.azurecr.io` | ||
- acrIdentityId: The user mananged identity id with AcrPull access, `$ACR_UMID` | ||
- miPrincipalId: The principal id for the user mananged identity, `$SP_ID` | ||
- miClientId: The client id for the user mananged identity, `$CLIENT_ID` | ||
- apiGatewayImage: The API gateway image with tag | ||
- customerServiceImage: The customer service image with tag | ||
- vetsServiceImage: The vets service image with tag | ||
- visitsServiceImage: The visits service image with tag | ||
- adminServerImage: The admin server image with tag | ||
- chatAgentImage: The chat agent image with tag | ||
- applicationInsightsConnString: The connection string of your AI instance | ||
1. Fill the azd configuration files | ||
|
||
- In your local repo, open file `azure.yaml` | ||
- replace all the `<your-acr>` with your variable `$ACR_NAME` | ||
|
||
- By default, the azd tool will create all resource into the same resource group, default to `rg-${environmentName}` | ||
Please refer to file [main.bicep](../../infra/bicep/main.bicep) for more configurations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: '3. Triage the issues' | ||
layout: default | ||
nav_order: 3 | ||
parent: 'Lab 6: Deploy to Azure automatically' | ||
--- | ||
|
||
# 3. Triage the issues | ||
|
||
1. Visit deployment details | ||
From the command output, find the hint: | ||
`You can view detailed progress in the Azure Portal:` | ||
And visit the link to see the details of your deployment. | ||
|
||
In your deployment page, you may click each Resource link, and check the Inputs/Output variables for better triage. | ||
|
||
1. Failed to provision java component 'configserver' | ||
|
||
```text | ||
ERROR: error deploying infrastructure: deploying to subscription: | ||
Deployment Error Details: | ||
JavaComponentOperationError: Failed to provision java component 'configserver'. Error details: Failed to create config map external-auth-config-map for JavaComponent configserver in k8se-system namespace. There will be no re-tries.. | ||
``` | ||
> This is a temporary error in service, just ignore and retry. | ||
1. Failed to deploy open AI instance | ||
```text | ||
InvalidTemplateDeployment: The template deployment 'openai' is not valid according to the validation procedure. The tracking id is 'xxx'. See inner errors for details. | ||
SpecialFeatureOrQuotaIdRequired: The subscription does not have QuotaId/Feature required by SKU 'S0' from kind 'OpenAI' or contains blocked QuotaId/Feature. | ||
``` | ||
> Azure OpenAI is not enabled in your subscription + region settings, please check the feature status. You may edit the configurations in `./infra/bicep/main.parameters.json` | ||
> - Disable openAI by set *enableOpenAi = false* and run *azd up*. | ||
> - Find a subcription + region combination and set the values `openAiSubscription`, `openAiLocation`, and run *azd up*. | ||
> - Use an existed openAI instance. See guide in page [Reuse existing resource](./0604.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: '4. Reuse existing resource' | ||
layout: default | ||
nav_order: 4 | ||
parent: 'Lab 6: Deploy to Azure automatically' | ||
--- | ||
|
||
# 4. Reuse existing resource | ||
|
||
The default `azd up` process will create lots of resource into the target resource group. | ||
Sometimes you may reuse some existing resources for your solution. | ||
|
||
1. Reuse Azure openAI instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.