Skip to content

Commit

Permalink
some minor improvements (#61)
Browse files Browse the repository at this point in the history
## Purpose
1. add springbootadmin binding to eureka
2. fix default placeholder image tag
3. refine the azd up steps

## 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)
[ ] Documentation content changes
[ ] Other... Please describe:
```
  • Loading branch information
sonwan2020 authored Sep 26, 2024
1 parent 9cd0681 commit 5f4b1ee
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
30 changes: 17 additions & 13 deletions azure.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json

name: java-microservices-aca-lab

workflows:
up:
- azd: provision
- azd: package --all
- azd: deploy --all

infra:
provider: bicep
path: infra/bicep
Expand All @@ -12,7 +19,7 @@ services:
host: containerapp
language: java
docker:
registry: <your-acr>.azurecr.io
registry: <acr-name>.azurecr.io
image: java-microservices-aca-lab/spring-petclinic-api-gateway
tag: passwordless

Expand All @@ -22,7 +29,7 @@ services:
host: containerapp
language: java
docker:
registry: <your-acr>.azurecr.io
registry: <acr-name>.azurecr.io
image: java-microservices-aca-lab/spring-petclinic-customers-service
tag: passwordless

Expand All @@ -32,7 +39,7 @@ services:
host: containerapp
language: java
docker:
registry: <your-acr>.azurecr.io
registry: <acr-name>.azurecr.io
image: java-microservices-aca-lab/spring-petclinic-vets-service
tag: passwordless

Expand All @@ -42,7 +49,7 @@ services:
host: containerapp
language: java
docker:
registry: <your-acr>.azurecr.io
registry: <acr-name>.azurecr.io
image: java-microservices-aca-lab/spring-petclinic-visits-service
tag: passwordless

Expand All @@ -52,7 +59,7 @@ services:
host: containerapp
language: java
docker:
registry: <your-acr>.azurecr.io
registry: <acr-name>.azurecr.io
image: java-microservices-aca-lab/spring-petclinic-chat-agent
tag: passwordless

Expand All @@ -62,20 +69,17 @@ services:
host: containerapp
language: java
docker:
registry: <your-acr>.azurecr.io
registry: <acr-name>.azurecr.io
image: java-microservices-aca-lab/spring-petclinic-admin-server
tag: passwordless

hooks:
prepackage:
windows:
shell: pwsh
run: 'cd src; .\mvnw.cmd clean package -DskipTests'
postprovision:
posix:
shell: sh
run: 'cd src; chmod +x ./mvnw; ./mvnw clean package -DskipTests'
run: ./infra/bicep/hooks/postprovision.sh

postprovision:
prepackage:
posix:
shell: sh
run: ./infra/bicep/hooks/postprovision.sh
run: 'cd src; chmod +x ./mvnw; ./mvnw clean package -DskipTests'
2 changes: 1 addition & 1 deletion docs/06_lab_automation/0601.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Prepare your local environment and plan your Azure resource, get ready for the o
- Option 1: Create a new Azure Container Registry

```bash
ACR_RESOURCE_GROUP=<your-resource-group>
ACR_RESOURCE_GROUP=<resource-group-name>
ACR_NAME=<acr-name>
az acr create \
-n $ACR_NAME \
Expand Down
9 changes: 6 additions & 3 deletions docs/06_lab_automation/0602.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ Run `azd up` to deploy the petclinic solution and dependent components to Azure
If you meet any problems during this step, refer to page [Triage the issues](0603.md)
1. Run `azd show`
1. Run `azd env get-values`
You may see lots of variables from the results.
Open the urls to your deployed service:
```text
gatewayFqdn="api-gateway.<cluster-id>.<region>.azurecontainerapps.io"
adminFqdn="admin-server.<cluster-id>.<region>.azurecontainerapps.io"
API gateway: gatewayFqdn="api-gateway.<cluster-id>.<region>.azurecontainerapps.io"
Admin Server: adminFqdn="admin-server.<cluster-id>.<region>.azurecontainerapps.io"
Spring Boot Admin: springbootAdminFqdn="springbootadmin-azure-java.ext.<cluster-id>.<region>.azurecontainerapps.io"
```
Visit the urls to check the status of the services.
4 changes: 3 additions & 1 deletion infra/bicep/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var vnetPrefix = '10.1.0.0/16'
var infraSubnetPrefix = '10.1.0.0/24'
var infraSubnetName = '${abbrs.networkVirtualNetworksSubnets}infra'

var placeholderImage = 'azurespringapps/default-banner:distroless-2024022107-66ea1a62-87936983'
var placeholderImage = 'azurespringapps/default-banner:latest'

var abbrs = loadJsonContent('./abbreviations.json')
var tags = { 'azd-env-name': environmentName }
Expand Down Expand Up @@ -139,6 +139,7 @@ module mysql 'modules/database/mysql.bicep' = {
administratorLoginPassword: sqlAdminPassword
serverName: !empty(sqlServerName) ? sqlServerName : '${abbrs.sqlServers}${environmentName}'
databaseName: 'petclinic'
tags: tags
}
}

Expand Down Expand Up @@ -266,6 +267,7 @@ module applications 'modules/app/petclinic.bicep' = {

output resourceGroupName string = rg.name

output springbootAdminFqdn string = javaComponents.outputs.springbootAdminFqdn
output gatewayFqdn string = applications.outputs.gatewayFqdn
output adminFqdn string = applications.outputs.adminFqdn

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ resource configServer 'Microsoft.App/managedEnvironments/javaComponents@2024-02-
propertyName: 'spring.cloud.config.server.git.search-paths'
value: configServerGitPath
}
{
propertyName: 'spring.cloud.config.server.git.refresh-rate'
value: '60'
}
]
}
}

resource eureka 'Microsoft.App/managedEnvironments/javaComponents@2024-02-02-preview' = {
dependsOn: [
configServer
]
parent: managedEnvironmentsResource
name: 'eureka'
properties: {
Expand All @@ -48,8 +55,16 @@ resource springbootadmin 'Microsoft.App/managedEnvironments/javaComponents@2024-
name: 'springbootadmin'
properties: {
componentType: 'SpringBootAdmin'
serviceBinds: [
{
name: eureka.name
serviceId: eureka.id
}
]
}
}

output eurekaId string = eureka.id
output configServerId string = configServer.id

output springbootAdminFqdn string = springbootadmin.properties.ingress.fqdn

0 comments on commit 5f4b1ee

Please sign in to comment.