Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a7ac76d

Browse files
Zheng Changedburns
authored andcommittedJan 18, 2022
polish wording
Signed-off-by: Zheng Chang <[email protected]>
1 parent d32c1d5 commit a7ac76d

File tree

2 files changed

+32
-31
lines changed

2 files changed

+32
-31
lines changed
 

‎articles/openshift/howto-deploy-java-liberty-app.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ms.custom: devx-track-java, devx-track-javaee, devx-track-javaee-liberty, devx-t
1313

1414
# Deploy a Java application with Open Liberty/WebSphere Liberty on an Azure Red Hat OpenShift 4 cluster
1515

16-
This guide demonstrates how to run your Java, Java EE, [Jakarta EE](https://jakarta.ee/), or [MicroProfile](https://microprofile.io/) application on the Open Liberty/WebSphere Liberty runtime and then deploy the containerized application to an Azure Red Hat OpenShift (ARO) 4 cluster using the Open Liberty Operator. This article will walk you through preparing a Liberty application, building the application Docker image and running the containerized application on an ARO 4 cluster. For more information on Open Liberty, see [the Open Liberty project page](https://openliberty.io/).For more information on WebSphere Liberty, see [the WebSphere Liberty product page](https://www.ibm.com/cloud/websphere-liberty).
16+
This guide demonstrates how to run your Java, Java EE, [Jakarta EE](https://jakarta.ee/), or [MicroProfile](https://microprofile.io/) application on the Open Liberty/WebSphere Liberty runtime and then deploy the containerized application to an Azure Red Hat OpenShift (ARO) 4 cluster using the Open Liberty Operator. This article will walk you through preparing a Liberty application, building the application Docker image and running the containerized application on an ARO 4 cluster. For more information on Open Liberty, see [the Open Liberty project page](https://openliberty.io/).For more information on WebSphere Liberty, see [the WebSphere Liberty product page](https://www.ibm.com/cloud/websphere-liberty).
1717

1818
[!INCLUDE [aro-support](includes/aro-support.md)]
1919

@@ -33,7 +33,7 @@ Complete the following prerequisites to successfully walk through this guide.
3333
1. Clone the code for this sample on your local system. The sample is on [GitHub](https://github.com/Azure-Samples/open-liberty-on-aro).
3434
1. Follow the instructions in [Create an Azure Red Hat OpenShift 4 cluster](./tutorial-create-cluster.md).
3535

36-
Though the "Get a Red Hat pull secret" step is labeled as optional, **it is required for this article**. The pull secret enables your Azure Red Hat OpenShift cluster to find the Open Liberty Operator.
36+
Though the "Get a Red Hat pull secret" step is labeled as optional, **it is required for this article**. The pull secret enables your Azure Red Hat OpenShift cluster to find the Open Liberty Operator.
3737

3838
If you plan to run memory-intensive applications on the cluster, specify the proper virtual machine size for the worker nodes using the `--worker-vm-size` parameter. For example, `Standard_E4s_v3` is the minimum virtual machine size to install the Elasticsearch Operator on a cluster. For more information, see:
3939

@@ -53,7 +53,7 @@ Complete the following prerequisites to successfully walk through this guide.
5353
The steps in this tutorial create a Docker image which must be pushed to a container registry accessible to OpenShift. The simplest option is to use the built-in registry provided by OpenShift. To enable the built-in container registry, follow the steps in [Configure built-in container registry for Azure Red Hat OpenShift 4](built-in-container-registry.md). Three items from those steps are used in this article.
5454

5555
* The username and password of the Azure AD user for signing in to the OpenShift web console.
56-
* The output of `oc whoami` after following the steps for signing in to the OpenShift CLI. This value is called **aad-user** for discussion.
56+
* The output of `oc whoami` after following the steps for signing in to the OpenShift CLI. This value is called **aad-user** for discussion.
5757
* The container registry URL.
5858

5959
Note these items down as you complete the steps to enable the built-in container registry.
@@ -68,7 +68,7 @@ Note these items down as you complete the steps to enable the built-in container
6868

6969
### Create an administrator for the demo project
7070

71-
Besides image management, the **aad-user** will also be granted administrative permissions for managing resources in the demo project of the ARO 4 cluster. Sign in to the OpenShift CLI and grant the **aad-user** the necessary privileges by following these steps.
71+
Besides image management, the **aad-user** will also be granted administrative permissions for managing resources in the demo project of the ARO 4 cluster. Sign in to the OpenShift CLI and grant the **aad-user** the necessary privileges by following these steps.
7272

7373
1. Sign in to the OpenShift web console from your browser using the `kubeadmin` credentials.
7474
1. At the right-top of the web console, expand the context menu of the signed-in user, then select **Copy Login Command**.
@@ -89,7 +89,7 @@ Besides image management, the **aad-user** will also be granted administrative p
8989

9090
### Install the Open Liberty OpenShift Operator
9191

92-
After creating and connecting to the cluster, install the Open Liberty Operator. The main starting page for the Open Liberty Operator is on [GitHub](https://github.com/OpenLiberty/open-liberty-operator).
92+
After creating and connecting to the cluster, install the Open Liberty Operator. The main starting page for the Open Liberty Operator is on [GitHub](https://github.com/OpenLiberty/open-liberty-operator).
9393

9494
1. Sign in to the OpenShift web console from your browser using the `kubeadmin` credentials.
9595
2. Navigate to **Operators** > **OperatorHub** and search for **Open Liberty**.
@@ -99,22 +99,23 @@ After creating and connecting to the cluster, install the Open Liberty Operator.
9999

100100
![create operator subscription for Open Liberty Operator](./media/howto-deploy-java-liberty-app/install-operator.png)
101101
6. Select **Install** and wait a minute or two until the installation completes.
102-
7. Observe the Open Liberty Operator is successfully installed and ready for use. If you don't, diagnose and resolve the problem before continuing.
102+
7. Observe the Open Liberty Operator is successfully installed and ready for use. If you don't, diagnose and resolve the problem before continuing.
103+
103104
:::image type="content" source="media/howto-deploy-java-liberty-app/open-liberty-operator-installed.png" alt-text="Installed Operators showing Open Liberty is installed.":::
104105

105-
### Create an Azure Database for MySQL(Only if required by your application)
106+
### Create an Azure Database for MySQL
106107

107-
Follow the instructions below to set up an Azure Database for MySQL for use with your app.
108+
Follow the instructions below to set up an Azure Database for MySQL for use with your app. If your application doesn't require a database, you can skip this section.
108109

109110
1. Create a single database in Azure SQL Database by following the steps in: [Quickstart: Create an Azure Database for MySQL server by using the Azure portal](/azure/mysql/quickstart-create-mysql-server-database-using-azure-portal). Return to this document after creating the database.
110111
> [!NOTE]
111112
>
112-
> * At **Basics** step, write down ***Server name**.mysql.database.azure.com*, **Server admin login** and **Password**.
113+
> * At the **Basics** step, write down the ***Server name**.mysql.database.azure.com*, **Server admin login** and **Password**.
113114
114115
2. Once your database is created, open **your SQL server** > **Connection security** and complete the following settings:
115-
* Set **Allow access to Azure services** to **Yes**.
116-
* Select **Add current client IP address**.
117-
* Set **Minimal TLS Version** to **>1.0** > Select **Save**.
116+
1. Set **Allow access to Azure services** to **Yes**.
117+
2. Select **Add current client IP address**.
118+
3. Set **Minimal TLS Version** to **>1.0** and select **Save**.
118119

119120
![configure mysql database connection security rule](./media/howto-deploy-java-liberty-app/configure-mysql-database-connection-security.png)
120121

@@ -127,24 +128,24 @@ Follow the instructions below to set up an Azure Database for MySQL for use with
127128
4. If you didn't create a database in above steps, follow the steps in [Quickstart: Create an Azure Database for MySQL server by using the Azure portal#connect-to-the-server-by-using-mysqlexe](/azure/mysql/quickstart-create-mysql-server-database-using-azure-portal#connect-to-the-server-by-using-mysqlexe) to create one. Return to this document after creating the database.
128129
> [!NOTE]
129130
>
130-
> * Write down **Database name** you created.
131+
> * Write down the **Database name** you created.
131132
132133
## Prepare the Liberty application
133134

134-
We'll use a Java EE 8 application as our example in this guide. Open Liberty is a [Java EE 8 full profile](https://javaee.github.io/javaee-spec/javadocs/) compatible server, so it can easily run the application. Open Liberty is also [Jakarta EE 8 full profile compatible](https://jakarta.ee/specifications/platform/8/apidocs/).
135+
We'll use a Java EE 8 application as our example in this guide. Open Liberty is a [Java EE 8 full profile](https://javaee.github.io/javaee-spec/javadocs/) compatible server, so it can easily run the application. Open Liberty is also [Jakarta EE 8 full profile compatible](https://jakarta.ee/specifications/platform/8/apidocs/).
135136

136137
### Run the application on Open Liberty
137138

138-
To run the application on Open Liberty, you need to create an Open Liberty server configuration file so that the [Liberty Maven plugin](https://github.com/OpenLiberty/ci.maven#liberty-maven-plugin) can package the application for deployment. The Liberty Maven plugin is not required to deploy the application to OpenShift. However, we'll use it in this example with Open Liberty’s developer (dev) mode. Developer mode lets you easily run the application locally. Complete the following steps on your local computer.
139+
To run the application on Open Liberty, you need to create an Open Liberty server configuration file so that the [Liberty Maven plugin](https://github.com/OpenLiberty/ci.maven#liberty-maven-plugin) can package the application for deployment. The Liberty Maven plugin is not required to deploy the application to OpenShift. However, we'll use it in this example with Open Liberty’s developer (dev) mode. Developer mode lets you easily run the application locally. Complete the following steps on your local computer.
139140

140141
# [with DB connection](#tab/with-mysql-devc)
141142

142-
Follow the steps in this section to prepare the sample application for later use in this article. These steps use Maven and the `liberty-maven-plugin`. To learn more about the `liberty-maven-plugin` see [Building a web application with Maven](https://openliberty.io/guides/maven-intro.html).
143+
Follow the steps in this section to prepare the sample application for later use in this article. These steps use Maven and the `liberty-maven-plugin`. To learn more about the `liberty-maven-plugin`, see [Building a web application with Maven](https://openliberty.io/guides/maven-intro.html).
143144

144145
#### Check out the application
145146

146147
Clone the sample code for this guide. The sample is on [GitHub](https://github.com/Azure-Samples/open-liberty-on-aro).
147-
There are three samples in the repository. We will use *open-liberty-on-aro/3-integration/connect-db/mysqls*. Here is the file structure of the application.
148+
There are three samples in the repository. We will use *open-liberty-on-aro/3-integration/connect-db/mysql*. Here is the file structure of the application.
148149

149150
```
150151
open-liberty-on-aro/3-integration/connect-db/mysql
@@ -167,15 +168,15 @@ open-liberty-on-aro/3-integration/connect-db/mysql
167168

168169
The directories *java*, *resources*, and *webapp* contain the source code of the sample application. The code declares and uses a data source named `jdbc/JavaEECafeDB`.
169170

170-
In directory *aro* we placed two deployment files. *db-secret.xml* is used to create [Secrets](https://docs.openshift.com/container-platform/4.6/nodes/pods/nodes-pods-secrets.html) with DB connection credentials. The file *openlibertyapplication.yaml* is used to deploy the application image.
171+
In the *aro* directory, we placed two deployment files. *db-secret.xml* is used to create [Secrets](https://docs.openshift.com/container-platform/4.6/nodes/pods/nodes-pods-secrets.html) with DB connection credentials. The file *openlibertyapplication.yaml* is used to deploy the application image.
171172

172-
In directory *docker*, we place four Dockerfiles. *Dockerfile-local* is used for local debug and *Dockerfile* is used to build image for ARO deployment. They all work with Open Liberty. *Dockerfile-wlp-local* is used for local debug and *Dockerfile-wlp* is used to build image for ARO deployment, they all work with WebSphere Liberty.
173+
In the *docker* directory, we placed four Dockerfiles. *Dockerfile-local* is used for local debugging, and *Dockerfile* is used to build the image for an ARO deployment. These two files work with Open Liberty. *Dockerfile-wlp-local* and *Dockerfile-wlp* are also used for local debugging and to build the image for an ARO deployment respectively, but instead work with WebSphere Liberty.
173174

174-
In directory *liberty/config*, the *server.xml* is used to configure the DB connection for the Open Liberty and WebSphere Liberty cluster.
175+
In the *liberty/config* directory, the *server.xml* is used to configure the DB connection for the Open Liberty and WebSphere Liberty cluster.
175176

176177
#### Build project
177178

178-
Now that you have gathered the necessary properties, you can build the application. The POM file for the project reads many properties from the environment.
179+
Now that you have gathered the necessary properties, you can build the application. The POM file for the project reads many properties from the environment.
179180

180181
```bash
181182
cd <path-to-your-repo>/open-liberty-on-aro/3-integration/connect-db/mysql
@@ -193,8 +194,8 @@ mvn clean install
193194

194195
#### Test your application locally
195196

196-
Use the `liberty:devc` to run and test it locally before dealing with any Azure complexity. For more information on `liberty:devc`, see the [Liberty Plugin documentation](https://github.com/OpenLiberty/ci.maven/blob/main/docs/dev.md#devc-container-mode).
197-
We've prepared the *Dockerfile-local* and *Dockerfile-wlp-local* for it in the sample application.
197+
Use the `liberty:devc` command to run and test the project locally before dealing with any Azure complexity. For more information on `liberty:devc`, see the [Liberty Plugin documentation](https://github.com/OpenLiberty/ci.maven/blob/main/docs/dev.md#devc-container-mode).
198+
In the sample application, we've prepared Dockerfile-local and Dockerfile-wlp-local for use with `liberty:devc`.
198199

199200
1. Start your local docker environment if you haven't done so already. The instructions for doing this vary depending on the host operating system.
200201

@@ -217,7 +218,7 @@ We've prepared the *Dockerfile-local* and *Dockerfile-wlp-local* for it in the s
217218
# [without DB connection](#tab/without-mysql-dev)
218219

219220
1. Copy `2-simple/src/main/liberty/config/server.xml` to `1-start/src/main/liberty/config`, overwriting the existing zero-length file. This `server.xml` configures the Open Liberty server with Java EE features.
220-
1. Copy `2-simple/pom.xml` to `1-start/pom.xml`. This step adds the `liberty-maven-plugin` to the POM.
221+
1. Copy `2-simple/pom.xml` to `1-start/pom.xml`. This step adds the `liberty-maven-plugin` to the POM.
221222
1. Change directory to `1-start` of your local clone.
222223
1. Run `mvn clean package` in a console to generate a war package `javaee-cafe.war` in the directory `./target`.
223224
1. Run `mvn liberty:dev` to start Open Liberty in dev mode.
@@ -277,7 +278,7 @@ When you're satisfied with the state of the application, push it to the built-in
277278

278279
> [!NOTE]
279280
> Take note of the username and password you use to sign in here. This username and password will function as an administrator for other actions in this and other articles.
280-
1. Sign in with the OpenShift CLI by using the following steps. For discussion, this process is known as `oc login`.
281+
1. Sign in with the OpenShift CLI by using the following steps. For discussion, this process is known as `oc login`.
281282
1. At the right-top of the web console, expand the context menu of the signed-in user, then select **Copy Login Command**.
282283
1. Sign in to a new tab window with the same user if necessary.
283284
1. Select **Display Token**.
@@ -361,7 +362,7 @@ When you're satisfied with the state of the application, push it to the built-in
361362
362363
> [!NOTE]
363364
> Take note of the username and password you use to sign in here. This username and password will function as an administrator for other actions in this and other articles.
364-
1. Sign in with the OpenShift CLI by using the following steps. For discussion, this process is known as `oc login`.
365+
1. Sign in with the OpenShift CLI by using the following steps. For discussion, this process is known as `oc login`.
365366
1. At the right-top of the web console, expand the context menu of the signed-in user, then select **Copy Login Command**.
366367
1. Sign in to a new tab window with the same user if necessary.
367368
1. Select **Display Token**.
@@ -421,7 +422,7 @@ Because we use the Open Liberty Operator to manage Liberty applications, we need
421422
1. Expand **Home**, Select **Projects** > **open-liberty-demo**.
422423
1. Navigate to **Operators** > **Installed Operators**.
423424
1. In the middle of the page, select **Open Liberty Operator**.
424-
1. In the middle of the page, select **Open Liberty Application**. The navigation of items in the user interface mirrors the actual containment hierarchy of technologies in use.
425+
1. In the middle of the page, select **Open Liberty Application**. The navigation of items in the user interface mirrors the actual containment hierarchy of technologies in use.
425426
<!-- Diagram source https://github.com/Azure-Samples/open-liberty-on-aro/blob/master/diagrams/aro-java-containment.vsdx -->
426427
![ARO Java Containment](./media/howto-deploy-java-liberty-app/aro-java-containment.png)
427428
1. Select **Create OpenLibertyApplication**
@@ -455,7 +456,7 @@ Now you can deploy the sample Liberty application to the ARO 4 cluster with the
455456
cd <path-to-repo>/3-integration/connect-db/mysql
456457
457458
# Change project to "open-liberty-demo"
458-
oc project open-liberty-demo
459+
oc project open-liberty-demo
459460
460461
# Create DB secret
461462
oc create -f db-secret.yaml
@@ -486,7 +487,7 @@ Because we use the Open Liberty Operator to manage Liberty applications, we need
486487
1. Expand **Home**, Select **Projects** > **open-liberty-demo**.
487488
1. Navigate to **Operators** > **Installed Operators**.
488489
1. In the middle of the page, select **Open Liberty Operator**.
489-
1. In the middle of the page, select **Open Liberty Application**. The navigation of items in the user interface mirrors the actual containment hierarchy of technologies in use.
490+
1. In the middle of the page, select **Open Liberty Application**. The navigation of items in the user interface mirrors the actual containment hierarchy of technologies in use.
490491
<!-- Diagram source https://github.com/Azure-Samples/open-liberty-on-aro/blob/master/diagrams/aro-java-containment.vsdx -->
491492
![ARO Java Containment](./media/howto-deploy-java-liberty-app/aro-java-containment.png)
492493
1. Select **Create OpenLibertyApplication**
@@ -517,7 +518,7 @@ Instead of using the web console GUI, you can deploy the application from the CL
517518
518519
1. Sign in to the OpenShift web console from your browser using the credentials of the Azure AD user.
519520
2. Sign in to the OpenShift CLI with the token for the Azure AD user.
520-
3. Change directory to `2-simple` of your local clone, and run the following commands to deploy your Liberty application to the ARO 4 cluster. Command output is also shown inline.
521+
3. Change directory to `2-simple` of your local clone, and run the following commands to deploy your Liberty application to the ARO 4 cluster. Command output is also shown inline.
521522
522523
```bash
523524
# Switch to namespace "open-liberty-demo" where resources of demo app will belong to
@@ -543,7 +544,7 @@ Instead of using the web console GUI, you can deploy the application from the CL
543544
javaee-cafe-simple 1/1 1 0 102s
544545
```
545546
546-
4. Check to see `1/1` under the `READY` column before you continue. If not, investigate and resolve the problem before continuing.
547+
4. Check to see `1/1` under the `READY` column before you continue. If not, investigate and resolve the problem before continuing.
547548
5. Discover the host of route to the application with the `oc get route` command, as shown here.
548549
549550
```bash

0 commit comments

Comments
 (0)
Please sign in to comment.