Skip to content

Commit 1b6e093

Browse files
authored
Merge pull request #260122 from moarychan/moary/microservice/support-asae-portal-and-maven
Add portal + maven plugin option for microservice apps deployment
2 parents d59a774 + 5695e6d commit 1b6e093

32 files changed

+608
-54
lines changed

articles/spring-apps/includes/quickstart-deploy-microservice-apps/clean-up-resources.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ ms.topic: include
66
ms.date: 05/24/2022
77
---
88

9-
<!--
9+
<!--
1010
For clarity of structure, a separate markdown file is used to describe how to clean up resources using Azure Portal or AZD.
1111
12-
[!INCLUDE [clean-up-resources-portal-or-azd](includes/quickstart-deploy-microservice-apps/clean-up-resources.md)]
12+
[!INCLUDE [clean-up-resources](includes/quickstart-deploy-microservice-apps/clean-up-resources.md)]
1313
1414
-->
1515

@@ -41,4 +41,4 @@ The console outputs messages similar to the following example:
4141
SUCCESS: Your application was removed from Azure in xx minutes xx seconds.
4242
```
4343

44-
---
44+
---

articles/spring-apps/includes/quickstart-deploy-microservice-apps/deploy-microservice-apps-with-basic-standard-plan.md

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ author: KarlErickson
33
ms.author: v-shilichen
44
ms.service: spring-apps
55
ms.topic: include
6-
ms.date: 06/9/2023
6+
ms.date: 01/10/2024
77
---
88

9-
<!--
9+
<!--
1010
For clarity of structure, a separate markdown file is used to describe how to deploy to Azure Spring Apps with Basic/Standard plan.
1111
1212
[!INCLUDE [deploy-microservice-apps-with-basic-standard-plan](includes/quickstart-deploy-microservice-apps/deploy-microservice-apps-with-basic-standard-plan.md)]
@@ -17,27 +17,13 @@ For clarity of structure, a separate markdown file is used to describe how to de
1717

1818
### [Azure portal + Maven plugin](#tab/Azure-portal-maven-plugin)
1919

20-
Use the following steps to prepare the sample locally.
21-
22-
1. Use the following command to clone the sample GitHub project:
23-
24-
```bash
25-
git clone https://github.com/Azure-Samples/spring-petclinic-microservices.git
26-
```
27-
28-
1. Use the following command to change to the sample root path and execute the shell script to run the sample project locally:
29-
30-
```bash
31-
bash ./scripts/run_all_without_infra.sh
32-
```
33-
34-
1. After the script executes successfully, go to `http://localhost:8080` in your browser to access the PetClinic app.
20+
[!INCLUDE [prepare-spring-project](prepare-spring-project.md)]
3521

3622
### [Azure Developer CLI](#tab/Azure-Developer-CLI)
3723

3824
Use the following steps to initialize the Pet Clinic application using Azure Developer CLI templates:
3925

40-
1. Open a terminal, create a new, empty folder, and then navigate to it.
26+
1. In the Bash window, create a new, empty folder and then navigate to it.
4127

4228
1. Use the following command to initialize the project:
4329

@@ -53,11 +39,11 @@ Use the following steps to initialize the Pet Clinic application using Azure Dev
5339

5440
```output
5541
Initializing a new project (azd init)
56-
42+
5743
Downloading template code to: <your-local-path>
5844
(✓) Done: Initialized git repository
5945
Enter a new environment name: <your-env-name>
60-
46+
6147
SUCCESS: New project initialized!
6248
You can view the template code in your directory: <your-local-path>
6349
Learn more about running 3rd party code on our DevHub: https://aka.ms/azd-third-party-code-notice
@@ -98,7 +84,7 @@ Use the following steps to create the service instance:
9884
| **Name** | *myasa* | A unique name that identifies your Azure Spring Apps instance. The name must be between 4 and 32 characters long and can contain only lowercase letters, numbers, and hyphens. The first character of the service name must be a letter and the last character must be either a letter or a number. |
9985
| **Plan** | **Standard** | The pricing plan determines the resources and cost associated with your instance. |
10086
| **Region** | The region closest to your users. | The location that is closest to your users. |
101-
| **Zone Redundant** | Unchecked | Creates your Azure Spring Apps service in an Azure availability zone. Not currently supported in all regions. |
87+
| **Zone Redundant** | Unselected | Creates your Azure Spring Apps service in an Azure availability zone. Not currently supported in all regions. |
10288

10389
1. Navigate to the **Diagnostic settings** tab on the **Create Azure Spring Apps** page and then select **Create new** to create a new Log Analytics workspaces instance. On the **Create new Log Analytics workspace** page, update the name of the **Log Analytics workspace** as needed, and then select **OK** to confirm the creation.
10490

@@ -118,7 +104,7 @@ Use the following steps to create the service instance:
118104

119105
1. Select **Config Server** in the navigation pane.
120106

121-
1. On the **Config Server** page, for **URI**, enter *`https://github.com/Azure-Samples/spring-petclinic-microservices-config.git`*, and then select **Validate**.
107+
1. On the **Config Server** page, for **URI**, enter *https://github.com/Azure-Samples/spring-petclinic-microservices-config.git* and then select **Validate**.
122108

123109
:::image type="content" source="../../media/quickstart-deploy-microservice-apps/validate-config-server.png" alt-text="Screenshot of the Azure portal that shows the Config Server page with the Default URI and the Validate button highlighted and the Apply button disabled." lightbox="../../media/quickstart-deploy-microservice-apps/validate-config-server.png":::
124110

@@ -128,15 +114,15 @@ Use the following steps to create the service instance:
128114

129115
Use the following steps to create the required resources:
130116

131-
1. Use the following command to sign in to Azure with OAuth2. Ignore this step if you've already signed in.
117+
1. Use the following command to sign in to Azure with OAuth2. Ignore this step if you already signed in.
132118

133119
```bash
134120
azd auth login
135121
```
136122

137123
The console outputs messages similar to the following example:
138124

139-
```text
125+
```output
140126
Logged in to Azure.
141127
```
142128

@@ -172,7 +158,7 @@ You can now deploy the app to Azure Spring Apps.
172158

173159
Use the following steps to deploy the microservice applications using the [Maven plugin for Azure Spring Apps](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Spring-Apps):
174160

175-
1. Navigate to the sample project directory and use the following command to configure the apps for Azure Spring Apps:
161+
1. Navigate to the sample project directory and then use the following command to configure the apps for Azure Spring Apps:
176162

177163
```bash
178164
./mvnw -P spring-apps com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:config
@@ -198,7 +184,7 @@ Use the following steps to deploy the microservice applications using the [Maven
198184
> [!NOTE]
199185
> Deployment to Azure Spring Apps can take up to 25 minutes.
200186
201-
After the command is executed, a log displays output similar to the following example, which indicates that all deployments are successful:
187+
After the command runs, a log displays output similar to the following example, which indicates that all deployments are successful:
202188

203189
```output
204190
[INFO] Deployment(default) is successfully updated.
@@ -239,23 +225,23 @@ Use the following steps to package the app, provision the Azure resources requir
239225

240226
```output
241227
Deploying services (azd deploy)
242-
228+
243229
(✓) Done: Deploying service admin-server
244230
- Endpoint: https://<your-Azure-Spring-Apps-instance-name>-admin-server.azuremicroservices.io
245-
231+
246232
(✓) Done: Deploying service api-gateway
247233
- Endpoint: https://<your-Azure-Spring-Apps-instance-name>-api-gateway.azuremicroservices.io
248-
234+
249235
(✓) Done: Deploying service customers-service
250236
- No endpoints were found
251-
237+
252238
(✓) Done: Deploying service vets-service
253239
- No endpoints were found
254-
240+
255241
(✓) Done: Deploying service visits-service
256242
- No endpoints were found
257-
258-
243+
244+
259245
SUCCESS: Your application was deployed to Azure in xx minutes xx seconds.
260246
You can view the resources created under the resource group rg-<your-environment-name> in Azure Portal:
261247
https://portal.azure.com/#@/resource/subscriptions/<your-subscription-id>/resourceGroups/rg-<your-environment-name>/overview

articles/spring-apps/includes/quickstart-deploy-microservice-apps/deploy-microservice-apps-with-enterprise-plan.md

Lines changed: 122 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ author: KarlErickson
33
ms.author: v-shilichen
44
ms.service: spring-apps
55
ms.topic: include
6-
ms.date: 9/15/2023
6+
ms.date: 01/10/2024
77
---
88

9-
<!--
9+
<!--
1010
For clarity of structure, a separate markdown file is used to describe how to deploy to Azure Spring Apps with Enterprise plan.
1111
1212
[!INCLUDE [deploy-microservice-apps-with-enterprise-plan](includes/quickstart-deploy-microservice-apps/deploy-microservice-apps-with-enterprise-plan.md)]
@@ -15,12 +15,67 @@ For clarity of structure, a separate markdown file is used to describe how to de
1515

1616
## 2. Prepare the Spring project
1717

18+
### [Azure portal](#tab/Azure-portal-ent)
19+
1820
The **Deploy to Azure** button in the next section launches an Azure portal experience that downloads a JAR package from the [ASA-Samples-Web-Application releases](https://github.com/Azure-Samples/ASA-Samples-Web-Application/releases) page on GitHub. No local preparation steps are needed.
1921

22+
### [Azure portal + Maven plugin](#tab/Azure-portal-maven-plugin-ent)
23+
24+
Use the following steps to prepare the project and run the sample locally:
25+
26+
1. Use the following command to clone the [Pet Clinic application](https://github.com/Azure-Samples/spring-petclinic-microservices.git) from GitHub:
27+
28+
```bash
29+
git clone https://github.com/Azure-Samples/spring-petclinic-microservices.git
30+
```
31+
32+
1. Navigate to the project root directory and then use the following command to build the project:
33+
34+
```bash
35+
./mvnw clean package -DskipTests
36+
```
37+
38+
Use the following steps if you want to run the application locally. Otherwise, you can skip these steps.
39+
40+
1. Open a new Bash window and then use the following command to start Config Server:
41+
42+
```bash
43+
./mvnw spring-boot:run -pl spring-petclinic-config-server
44+
```
45+
46+
1. Open a new Bash window and then use the following command to start Discovery Server:
47+
48+
```bash
49+
./mvnw spring-boot:run -pl spring-petclinic-discovery-server
50+
```
51+
52+
1. For the Customers, Vets, Visits, and Spring Cloud Gateway services, open a new Bash window and use the following commands to start the services:
53+
54+
```bash
55+
./mvnw spring-boot:run -pl spring-petclinic-customers-service
56+
./mvnw spring-boot:run -pl spring-petclinic-vets-service
57+
./mvnw spring-boot:run -pl spring-petclinic-visits-service
58+
./mvnw spring-boot:run -Dspring-boot.run.profiles=default,development \
59+
-pl spring-petclinic-api-gateway
60+
```
61+
62+
1. Open a new Bash window and navigate to the project `spring-petclinic-frontend` directory. Use the following commands to install dependencies and run the frontend application:
63+
64+
```bash
65+
npm install
66+
npm run start
67+
````
68+
69+
1. After the script completes successfully, go to `http://localhost:8080` in your browser to access the PetClinic application.
70+
71+
---
72+
2073
## 3. Prepare the cloud environment
2174

2275
The main resource you need to run this sample is an Azure Spring Apps instance. This section describes how to create this resource.
2376

77+
### [Azure portal](#tab/Azure-portal-ent)
78+
2479
This section uses a **Deploy to Azure** button to launch a deployment experience in the Azure portal. This experience uses an [ARM template](../../../azure-resource-manager/templates/overview.md) to create Azure resources.
2580

2681
### 3.1. Sign in to the Azure portal
@@ -43,14 +98,78 @@ Use the following steps to create all the Azure resources that the app depends o
4398
| **Resource group** | *myresourcegroup* | A new resource group name or an existing one from your subscription. |
4499
| **Region** | The region closest to your users. | The region is used to create the resource group. |
45100
46-
:::image type="content" source="../../media/quickstart-deploy-microservice-apps/custom-deployment-microservice.png" alt-text="Screenshot of the Azure portal that shows the custom deployment for microservice." lightbox="../../media/quickstart-deploy-microservice-apps/custom-deployment-microservice.png":::
101+
:::image type="content" source="../../media/quickstart-deploy-microservice-apps/custom-deployment-microservice.png" alt-text="Screenshot of the Azure portal that shows the Custom deployment page." lightbox="../../media/quickstart-deploy-microservice-apps/custom-deployment-microservice.png":::
47102
48103
1. Select **Review and Create** to review your selections. Then, select **Create** to deploy the app to Azure Spring Apps.
49104
50105
1. On the toolbar, select the **Notifications** icon (a bell) to monitor the deployment process. After the deployment finishes, you can select **Pin to dashboard**, which creates a tile for this service on your Azure portal dashboard as a shortcut to the service's **Overview** page. Select **Go to resource** to open the service's **Overview** page.
51106
52107
:::image type="content" source="../../media/quickstart-deploy-microservice-apps/custom-deployment-notifications.png" alt-text="Screenshot of the Azure portal that shows the Overview page with the custom deployment notifications pane open." lightbox="../../media/quickstart-deploy-microservice-apps/custom-deployment-notifications.png":::
53108
109+
### [Azure portal + Maven plugin](#tab/Azure-portal-maven-plugin-ent)
110+
111+
[!INCLUDE [provision-enterprise-azure-spring-apps](provision-enterprise-azure-spring-apps.md)]
112+
113+
---
114+
54115
## 4. Deploy the apps to Azure Spring Apps
55116
117+
### [Azure portal](#tab/Azure-portal-ent)
118+
56119
The **Deploy to Azure** button in the previous section launches an Azure portal experience that includes application deployment, so nothing else is needed.
120+
121+
### [Azure portal + Maven plugin](#tab/Azure-portal-maven-plugin-ent)
122+
123+
[!INCLUDE [microservice-spring-apps-maven-plugin](microservice-spring-apps-maven-plugin.md)]
124+
125+
2. Use the following command to deploy the backend applications:
126+
127+
```bash
128+
./mvnw azure-spring-apps:deploy
129+
```
130+
131+
After the command runs, you can see from the following log messages that the deployment was successful:
132+
133+
```output
134+
[INFO] Start deploying artifact(customers-service-3.0.1.jar) to deployment(default) of app(customers-service)...
135+
[INFO] Artifact(customers-service-3.0.1.jar) is successfully deployed to deployment(default) of app(customers-service).
136+
[INFO] Starting Spring App after deploying artifacts...
137+
[INFO] Deployment Status: Running
138+
139+
...
140+
141+
[INFO] Start deploying artifact(vets-service-3.0.1.jar) to deployment(default) of app(vets-service)...
142+
[INFO] Artifact(vets-service-3.0.1.jar) is successfully deployed to deployment(default) of app(vets-service).
143+
[INFO] Starting Spring App after deploying artifacts...
144+
[INFO] Deployment Status: Running
145+
146+
...
147+
148+
[INFO] Start deploying artifact(visits-service-3.0.1.jar) to deployment(default) of app(visits-service)...
149+
[INFO] Artifact(visits-service-3.0.1.jar) is successfully deployed to deployment(default) of app(visits-service).
150+
[INFO] Starting Spring App after deploying artifacts...
151+
[INFO] Deployment Status: Running
152+
```
153+
154+
1. The Azure portal doesn't support deploying the frontend applications, so use the following Azure CLI command to deploy the frontend application:
155+
156+
```azurecli
157+
az spring app deploy \
158+
--resource-group ${RESOURCE_GROUP} \
159+
--service ${SPRING_APPS_NAME} \
160+
--name ${APP_FRONTEND} \
161+
--source-path spring-petclinic-frontend \
162+
--build-env BP_WEB_SERVER=nginx \
163+
--builder ${APP_FRONTEND}
164+
```
165+
166+
After the command runs, you can see from the following log messages that the deployment was successful:
167+
168+
```output
169+
[5/5] Updating deployment in app "frontend" (this operation can take a while to complete)
170+
Azure Spring Apps will use rolling upgrade to update your deployment, you have 1 instance, Azure Spring Apps will update the deployment in 1 round.
171+
The deployment is in round 1, 1 old instance is deleted/deleting and 1 new instance is started/starting
172+
Your application is successfully deployed.
173+
```
174+
175+
---
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
author: karlerickson
3+
ms.author: v-shilichen
4+
ms.service: spring-apps
5+
ms.topic: include
6+
ms.date: 01/10/2024
7+
---
8+
9+
<!--
10+
Use the following line at the end of the heading Prerequisites, with blank lines before and after. App deployments with Spring Apps Maven plugin.
11+
12+
[!INCLUDE [microservice-spring-apps-maven-plugin](includes/quickstart-deploy-microservice-apps/microservice-spring-apps-maven-plugin.md)]
13+
-->
14+
15+
Use the following steps to deploy using the [Maven plugin for Azure Spring Apps](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Spring-Apps):
16+
17+
1. Navigate to the project root directory and then run the following command to configure the apps in Azure Spring Apps:
18+
19+
```bash
20+
./mvnw -P spring-apps-enterprise com.microsoft.azure:azure-spring-apps-maven-plugin:1.19.0:config
21+
```
22+
23+
The following list describes the command interactions:
24+
25+
- **Select child modules to configure**: Press <kbd>Enter</kbd> to select all.
26+
- **Select subscription**: Select the subscription list number of the Azure Spring Apps instance you created, which defaults to the first subscription in the list. If you use the default number, press <kbd>Enter</kbd> directly.
27+
- **Use existing Azure Spring Apps in Azure**: Press <kbd>y</kbd> to use the existing Azure Spring Apps instance.
28+
- **Select apps to expose public access**: Press <kbd>Enter</kbd> to select none.
29+
- **Confirm to save all the above configurations**: Press <kbd>y</kbd>. If you press <kbd>n</kbd>, the configuration isn't saved in the POM files.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
author: KarlErickson
3+
ms.author: v-shilichen
4+
ms.service: spring-apps
5+
ms.topic: include
6+
ms.date: 01/10/2024
7+
---
8+
9+
<!--
10+
For clarity of structure, a separate markdown file is used to describe how to prepare project locally.
11+
12+
[!INCLUDE [prepare-spring-project](includes/quickstart-deploy-microservice-apps/prepare-spring-project.md)]
13+
14+
-->
15+
16+
Use the following steps to prepare the sample locally:
17+
18+
1. Clone the sample project by using the following command:
19+
20+
```bash
21+
git clone https://github.com/Azure-Samples/spring-petclinic-microservices.git
22+
```
23+
24+
1. Navigate to the project root directory and then use the following command to run the sample project locally:
25+
26+
```bash
27+
bash ./scripts/run_all_without_infra.sh
28+
```
29+
30+
1. After the script completes successfully, go to `http://localhost:8080` in your browser to access the PetClinic application.

0 commit comments

Comments
 (0)