You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/spring-apps/how-to-staging-environment.md
+25-26Lines changed: 25 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Set up a staging environment in Azure Spring Apps | Microsoft Docs
2
+
title: Set up a staging environment in Azure Spring Apps
3
3
description: Learn how to use blue-green deployment with Azure Spring Apps
4
4
author: karlerickson
5
5
ms.service: spring-apps
@@ -22,10 +22,10 @@ This article explains how to set up a staging deployment by using the blue-green
22
22
23
23
## Prerequisites
24
24
25
-
* Azure Spring Apps instance on a Standard pricing tier
26
-
*[Azure Spring Apps extension](/cli/azure/azure-cli-extensions-overview) for the Azure CLI
25
+
- Azure Spring Apps instance on a Standard pricing tier
26
+
-[Azure Spring Apps extension](/cli/azure/azure-cli-extensions-overview) for the Azure CLI
27
27
28
-
This article uses an application built from Spring Initializr. If you want to use a different application for this example, you'll need to make a simple change in a public-facing portion of the application to differentiate your staging deployment from production.
28
+
This article uses an application built from Spring Initializr. If you want to use a different application for this example, make a change in a public-facing portion of the application to differentiate your staging deployment from the production deployment.
29
29
30
30
> [!TIP]
31
31
> [Azure Cloud Shell](https://shell.azure.com) is a free interactive shell that you can use to run the instructions in this article. It has common, preinstalled Azure tools, including the latest versions of Git, JDK, Maven, and the Azure CLI. If you're signed in to your Azure subscription, start your Cloud Shell instance. To learn more, see [Overview of Azure Cloud Shell](../cloud-shell/overview.md).
@@ -46,8 +46,8 @@ To build the application, follow these steps:
46
46
47
47
1. Generate the code for the sample app by using Spring Initializr with [this configuration](https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.3.4.RELEASE&packaging=jar&jvmVersion=1.8&groupId=com.example&artifactId=hellospring&name=hellospring&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.hellospring&dependencies=web,cloud-eureka,actuator,cloud-starter-sleuth,cloud-starter-zipkin,cloud-config-client).
48
48
49
-
2. Download the code.
50
-
3. Add the following *HelloController.java* source file to the folder *\src\main\java\com\example\hellospring\*:
49
+
1. Download the code.
50
+
1. Add the following *HelloController.java* source file to the folder *\src\main\java\com\example\hellospring\*:
51
51
52
52
```java
53
53
packagecom.example.hellospring;
@@ -67,25 +67,25 @@ To build the application, follow these steps:
67
67
}
68
68
```
69
69
70
-
4. Build the *.jar* file:
70
+
1. Build the *.jar* file:
71
71
72
72
```azurecli
73
73
mvn clean package -DskipTests
74
74
```
75
75
76
-
5. Create the app in your Azure Spring Apps instance:
76
+
1. Create the app in your Azure Spring Apps instance:
77
77
78
78
```azurecli
79
79
az spring app create -n demo -g <resourceGroup> -s <Azure Spring Apps instance> --assign-endpoint
80
80
```
81
81
82
-
6. Deploy the app to Azure Spring Apps:
82
+
1. Deploy the app to Azure Spring Apps:
83
83
84
84
```azurecli
85
85
az spring app deploy -n demo -g <resourceGroup> -s <Azure Spring Apps instance> --jar-path target\hellospring-0.0.1-SNAPSHOT.jar
86
86
```
87
87
88
-
7. Modify the code for your staging deployment:
88
+
1. Modify the code for your staging deployment:
89
89
90
90
```java
91
91
packagecom.example.hellospring;
@@ -105,54 +105,53 @@ To build the application, follow these steps:
105
105
}
106
106
```
107
107
108
-
8. Rebuild the *.jar* file:
108
+
1. Rebuild the *.jar* file:
109
109
110
110
```azurecli
111
111
mvn clean package -DskipTests
112
112
```
113
113
114
-
9. Create the green deployment:
114
+
1. Create the green deployment:
115
115
116
116
```azurecli
117
117
az spring app deployment create -n green --app demo -g <resourceGroup> -s <Azure Spring Apps instance> --jar-path target\hellospring-0.0.1-SNAPSHOT.jar
118
118
```
119
119
120
120
## View apps and deployments
121
121
122
-
View deployed apps by using the following procedure:
122
+
Use the following steps to view deployed apps.
123
123
124
124
1. Go to your Azure Spring Apps instance in the Azure portal.
125
125
126
126
1. From the left pane, open the **Apps** pane to view apps for your service instance.
127
127
128
-

128
+
:::image type="content" source="media/how-to-staging-environment/app-dashboard.png" lightbox="media/how-to-staging-environment/app-dashboard.png" alt-text="Screenshot of the Apps pane showing apps for your service instance.":::
129
129
130
-
1.You can select an app and view details.
130
+
1.Select an app to view details.
131
131
132
-

132
+
:::image type="content" source="media/how-to-staging-environment/app-overview.png" lightbox="media/how-to-staging-environment/app-overview.png" alt-text="Screenshot of details for an app.":::
133
133
134
134
1. Open **Deployments** to see all deployments of the app. The grid shows both production and staging deployments.
135
135
136
-

136
+
:::image type="content" source="media/how-to-staging-environment/deployments-dashboard.png" lightbox="media/how-to-staging-environment/deployments-dashboard.png" alt-text="Screenshot that shows listed app deployments.":::
137
137
138
138
1. Select the URL to open the currently deployed application.
139
139
140
-

140
+
:::image type="content" source="media/how-to-staging-environment/running-blue-app.png" lightbox="media/how-to-staging-environment/running-blue-app.png" alt-text="Screenshot that shows the URL of the deployed application.":::
141
141
142
142
1. Select **Production** in the **State** column to see the default app.
143
143
144
-

144
+
:::image type="content" source="media/how-to-staging-environment/running-default-app.png" lightbox="media/how-to-staging-environment/running-default-app.png" alt-text="Screenshot that shows the URL of the default app.":::
145
145
146
146
1. Select **Staging** in the **State** column to see the staging app.
147
147
148
-

148
+
:::image type="content" source="media/how-to-staging-environment/running-staging-app.png" lightbox="media/how-to-staging-environment/running-staging-app.png" alt-text="Screenshot that shows the URL of the staging app.":::
149
149
150
150
>[!TIP]
151
-
> * Confirm that your test endpoint ends with a slash (/) to ensure that the CSS file is loaded correctly.
152
-
> * If your browser requires you to enter login credentials to view the page, use [URL decode](https://www.urldecoder.org/) to decode your test endpoint. URL decode returns a URL in the format *https://\<username>:\<password>@\<cluster-name>.test.azureapps.io/gateway/green*. Use this format to access your endpoint.
151
+
> Confirm that your test endpoint ends with a slash (/) to ensure that the CSS file is loaded correctly. If your browser requires you to enter login credentials to view the page, use [URL decode](https://www.urldecoder.org/) to decode your test endpoint. URL decode returns a URL in the format `https://\<username>:\<password>@\<cluster-name>.test.azureapps.io/gateway/green`. Use this format to access your endpoint.
153
152
154
153
>[!NOTE]
155
-
> Configuration server settings apply to both your staging environment and your production environment. For example, if you set the context path (*server.servlet.context-path*) for your app gateway in the configuration server as *somepath*, the path to your green deployment changes to *https://\<username>:\<password>@\<cluster-name>.test.azureapps.io/gateway/green/somepath/...*.
154
+
> Configuration server settings apply to both your staging environment and your production environment. For example, if you set the context path (*server.servlet.context-path*) for your app gateway in the configuration server as *somepath*, the path to your green deployment changes to `https://\<username>:\<password>@\<cluster-name>.test.azureapps.io/gateway/green/somepath/...`.
156
155
157
156
If you visit your public-facing app gateway at this point, you should see the old page without your new change.
158
157
@@ -162,11 +161,11 @@ If you visit your public-facing app gateway at this point, you should see the ol
162
161
163
162
1. Select the ellipsis after **Registration status** of the green deployment, and then select **Set as production**.
164
163
165
-

164
+
:::image type="content" source="media/how-to-staging-environment/set-staging-deployment.png" lightbox="media/how-to-staging-environment/set-staging-deployment.png" alt-text="Screenshot that shows selections for setting the staging build to production.":::
166
165
167
166
1. Confirm that the URL of the app displays your changes.
168
167
169
-

168
+
:::image type="content" source="media/how-to-staging-environment/new-production-deployment.png" lightbox="media/how-to-staging-environment/new-production-deployment.png" alt-text="Screenshot that shows the URL of the app now in production.":::
170
169
171
170
>[!NOTE]
172
171
> After you've set the green deployment as the production environment, the previous deployment becomes the staging deployment.
@@ -191,4 +190,4 @@ az spring app deployment delete -n <staging-deployment-name> -g <resource-group-
191
190
192
191
## Next steps
193
192
194
-
*[CI/CD for Azure Spring Apps](./how-to-cicd.md?pivots=programming-language-java)
193
+
-[CI/CD for Azure Spring Apps](./how-to-cicd.md?pivots=programming-language-java)
0 commit comments