Skip to content

Commit 1638a1a

Browse files
Merge pull request #7 from craigshoemaker/aca/hang/launchfirstjava
[Container Apps] Update: Your First Java Application
2 parents 31056b9 + aca738e commit 1638a1a

File tree

7 files changed

+68
-41
lines changed

7 files changed

+68
-41
lines changed

articles/container-apps/.openpublishing.redirection.container-apps.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
"redirect_url": "/azure/container-apps/dapr-overview",
66
"redirect_document_id": false
77
},
8+
{
9+
"source_path_from_root": "/articles/container-apps/java-deploy-war-file.md",
10+
"redirect_url": "/azure/container-apps/java-get-started",
11+
"redirect_document_id": false
12+
},
813
{
914
"source_path_from_root": "/articles/container-apps/secure-app.md",
1015
"redirect_url": "/azure/container-apps/manage-secrets",

articles/container-apps/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@
312312
href: java-overview.md
313313
displayName: java
314314
- name: Launch your first Java app
315-
href: java-quickstart.md
315+
href: java-get-started.md
316316
displayName: java
317317
- name: Automatic memory fitting
318318
href: java-memory-fit.md

articles/container-apps/deploy-artifact.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Copy the FQDN to a web browser. From your web browser, go to the `/albums` endpo
181181

182182
## Deploy a WAR file
183183

184-
You can also deploy your container app from a [WAR file](java-quickstart.md?tabs=war).
184+
You can also deploy your container app from a [WAR file](java-get-started.md?tabs=war).
185185

186186
## Clean up resources
187187

articles/container-apps/java-quickstart.md renamed to articles/container-apps/java-get-started.md

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,24 @@ ms.custom: devx-track-extended-java
88
ms.topic: quickstart
99
ms.date: 05/07/2024
1010
ms.author: cshoe
11+
zone_pivot_groups: container-apps-java-artifacts
1112
---
1213

1314
# Quickstart: Launch your first Java application in Azure Container Apps
1415

15-
This article explains how to deploy a Spring PetClinic sample application to run on Azure Container Apps. By the end of this tutorial you will get an application accessible online, and you can manage it through the Azure portal.
16+
This article shows you how to deploy the Spring PetClinic sample application to run on Azure Container Apps. Rather than manually creating a Dockerfile and directly using a container registry, you can deploy your Java application directly from a Java Archive (JAR) file or a web application archive (WAR) file.
1617

17-
Rather than manually creating a Dockerfile and directly using a container registry, you can deploy your Java application directly from a Java Archive(JAR) file or a web application archive (WAR) file.
18+
By the end of this tutorial you deploy a web application, which you can manage through the Azure portal.
19+
20+
The following image is a screenshot of how your application looks once deployed to Azure.
1821

1922
:::image type="content" source="media/java-deploy-war-file/azure-container-apps-petclinic-warfile.png" alt-text="Screenshot of petclinic app.":::
2023

2124
## Prerequisites
2225

2326
| Requirement | Instructions |
2427
|--|--|
25-
| Azure account | If you don't have one, [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).<br<br>You need the *Contributor* or *Owner* permission on the Azure subscription to proceed. <br><br>Refer to [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.yml?tabs=current) for details. |
28+
| Azure account | If you don't have one, [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).<br><br>You need the *Contributor* or *Owner* permission on the Azure subscription to proceed. <br><br>Refer to [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.yml?tabs=current) for details. |
2629
| GitHub Account | Get one for [free](https://github.com/join). |
2730
| git | [Install git](https://git-scm.com/downloads) |
2831
| Azure CLI | Install the [Azure CLI](/cli/azure/install-azure-cli).|
@@ -31,117 +34,127 @@ Rather than manually creating a Dockerfile and directly using a container regist
3134

3235
## Prepare the project
3336

34-
Get the sample application.
35-
3637
Clone the Spring PetClinic sample application to your machine.
3738

38-
### [JAR](#tab/jar)
39+
::: zone pivot="jar"
40+
3941
```bash
4042
git clone https://github.com/spring-projects/spring-petclinic.git
4143
```
4244

43-
### [WAR](#tab/war)
45+
::: zone-end
46+
47+
::: zone pivot="war"
48+
4449
```bash
4550
git clone https://github.com/spring-petclinic/spring-framework-petclinic.git
4651
```
4752

48-
---
53+
::: zone-end
4954

5055
## Build the project
5156

52-
### [JAR](#tab/jar)
53-
> [!NOTE]
54-
> If necessary, you can specify the JDK version in the [Java build environment variables](java-build-environment-variables.md).
57+
::: zone pivot="jar"
58+
5559

56-
First, change into the *spring-petclinic* folder.
60+
Change into the *spring-petclinic* folder.
5761

5862
```bash
5963
cd spring-petclinic
6064
```
6165

62-
Then, clean the Maven build area, compile the project's code, and create a JAR file, all while skipping any tests.
66+
Clean the Maven build area, compile the project's code, and create a JAR file, all while skipping any tests.
6367

6468
```bash
6569
mvn clean package -DskipTests
6670
```
6771

6872
After you execute the build command, a file named *petclinic.jar* is generated in the */target* folder.
6973

70-
### [WAR](#tab/war)
74+
::: zone-end
75+
76+
::: zone pivot="war"
7177

7278
> [!NOTE]
7379
> If necessary, you can specify the Tomcat version in the [Java build environment variables](java-build-environment-variables.md).
7480
75-
First, change into the *spring-framework-petclinic* folder.
81+
Change into the *spring-framework-petclinic* folder.
7682

7783
```bash
7884
cd spring-framework-petclinic
7985
```
8086

81-
Then, clean the Maven build area, compile the project's code, and create a WAR file, all while skipping any tests.
87+
Clean the Maven build area, compile the project's code, and create a WAR file, all while skipping any tests.
8288

8389
```bash
8490
mvn clean package -DskipTests
8591
```
8692

8793
After you execute the build command, a file named *petclinic.war* is generated in the */target* folder.
8894

89-
---
95+
::: zone-end
9096

9197
## Deploy the project
9298

93-
### [JAR](#tab/jar)
99+
::: zone pivot="jar"
100+
94101
Deploy the JAR package to Azure Container Apps.
95102

103+
> [!NOTE]
104+
> If necessary, you can specify the JDK version in the [Java build environment variables](java-build-environment-variables.md).
105+
96106
Now you can deploy your WAR file with the `az containerapp up` CLI command.
97107

98108
```azurecli
99109
az containerapp up \
100-
--name <YOUR_CONTAINER_APP_NAME> \
101-
--resource-group <YOUR_RESOURCE_GROUP> \
102-
--subscription <YOUR_SUBSCRIPTION>\
110+
--name <CONTAINER_APP_NAME> \
111+
--resource-group <RESOURCE_GROUP> \
112+
--subscription <SUBSCRIPTION_ID>\
103113
--location <LOCATION> \
104-
--environment <YOUR_ENVIRONMENT_NAME> \
105-
--artifact <YOUR_JAR_FILE_PATH> \
114+
--environment <ENVIRONMENT_NAME> \
115+
--artifact <JAR_FILE_PATH_AND_NAME> \
106116
--ingress external \
107117
--target-port 8080 \
108118
--query properties.configuration.ingress.fqdn
109119
```
110120

111121
> [!NOTE]
112-
> The default JDK version is 17. If you need to change the JDK version for compatibility with your application, you can use the `--build-env-var BP_JVM_VERSION=<YOUR_JDK_VERSION>` argument to adjust the version number.
122+
> The default JDK version is 17. If you need to change the JDK version for compatibility with your application, you can use the `--build-env-vars BP_JVM_VERSION=<YOUR_JDK_VERSION>` argument to adjust the version number.
123+
124+
You can find more applicable build environment variables in [Java build environment variables](java-build-environment-variables.md).
113125

114-
You can find more applicable build environment variables in [Java build environment variables](java-build-environment-variables.md)
126+
::: zone-end
127+
128+
::: zone pivot="war"
115129

116-
### [WAR](#tab/war)
117130
Deploy the WAR package to Azure Container Apps.
118131

119132
Now you can deploy your WAR file with the `az containerapp up` CLI command.
120133

121134
```azurecli
122135
az containerapp up \
123-
--name <YOUR_CONTAINER_APP_NAME> \
124-
--resource-group <YOUR_RESOURCE_GROUP> \
125-
--subscription <YOUR_SUBSCRIPTION>\
136+
--name <CONTAINER_APP_NAME> \
137+
--resource-group <RESOURCE_GROUP> \
138+
--subscription <SUBSCRIPTION>\
126139
--location <LOCATION> \
127-
--environment <YOUR_ENVIRONMENT_NAME> \
128-
--artifact <YOUR_WAR_FILE_PATH> \
129-
--build-env-var BP_TOMCAT_VERSION=10.* \
140+
--environment <ENVIRONMENT_NAME> \
141+
--artifact <WAR_FILE_PATH_AND_NAME> \
142+
--build-env-vars BP_TOMCAT_VERSION=10.* \
130143
--ingress external \
131144
--target-port 8080 \
132145
--query properties.configuration.ingress.fqdn
133146
```
134147

135148
> [!NOTE]
136-
> The default Tomcat version is 9. If you need to change the Tomcat version for compatibility with your application, you can use the `--build-env-var BP_TOMCAT_VERSION=<YOUR_TOMCAT_VERSION>` argument to adjust the version number.
149+
> The default Tomcat version is 9. If you need to change the Tomcat version for compatibility with your application, you can use the `--build-env-vars BP_TOMCAT_VERSION=<YOUR_TOMCAT_VERSION>` argument to adjust the version number.
137150
138151
In this example, the Tomcat version is set to `10` (including any minor versions) by setting the `BP_TOMCAT_VERSION=10.*` environment variable.
139152

140-
You can find more applicable build environment variables in [Java build environment variables](java-build-environment-variables.md)
153+
You can find more applicable build environment variables in [Java build environment variables](java-build-environment-variables.md).
141154

142-
---
155+
::: zone-end
143156

144-
## Verify the app status.
157+
## Verify app status
145158

146159
In this example, `containerapp up` command includes the `--query properties.configuration.ingress.fqdn` argument, which returns the fully qualified domain name (FQDN), also known as the app's URL.
147160

articles/container-apps/java-overview.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ When you use Container Apps for your containerized Java applications, you get:
2424

2525
- **Build environment variables**: You can configure [custom key-value pairs](java-build-environment-variables.md) to control the Java image build from source code.
2626

27-
- **JAR deployment**: You can deploy your container app directly from a [JAR file](java-quickstart.md?tabs=jar).
27+
- **JAR deployment**: You can deploy your container app directly from a [JAR file](java-get-started.md?tabs=jar).
2828

29-
- **WAR deployment**: You can deploy your container app directly from a [WAR file](java-quickstart.md?tabs=war).
29+
- **WAR deployment**: You can deploy your container app directly from a [WAR file](java-get-started.md?tabs=war).
3030

3131
This article details the information you need to know as you build Java applications on Azure Container Apps.
3232

@@ -119,4 +119,4 @@ Azure Container Apps offers support for the following Spring Components as manag
119119
## Next steps
120120

121121
> [!div class="nextstepaction"]
122-
> [Launch your first Java app](java-quickstart.md)
122+
> [Launch your first Java app](java-get-started.md)
-6.73 KB
Loading

articles/zone-pivot-groups.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,6 +2453,15 @@ groups:
24532453
- id: aca-vnet-custom
24542454
title: Custom
24552455
# Owner: cshoe
2456+
- id: container-apps-java-artifacts
2457+
title: Artifact type
2458+
prompt: Select an artifact type
2459+
pivots:
2460+
- id: war
2461+
title: WAR file
2462+
- id: jar
2463+
title: JAR file
2464+
# Owner: cshoe
24562465
- id: container-apps-registry-types
24572466
title: Registry types
24582467
prompt: Select the type of container registry

0 commit comments

Comments
 (0)