Visit the Portal https://aka.ms/publicportal.
In the search box, without pressing enter, type “websphere” without the quotes.
In the section of suggested results labeled Marketplace select IBM WebSphere Liberty and Open Liberty on Azure Kubrenets Service.
Select Create.
In Resource group select Create new. In the dialog that appears, enter the next number to the sequence number you entered in setup.sh
, followed by the date in mmdd syntax, followed by a brief identifier, such as ol
or wls
. For example, if you entered ejb01
, you would enter ejb020317wls
.
In Region enter West Europe
.
Read warning box. This is why we had you create the UAMI and assign it the necessary roles.
Select the +Add control.
In the sidebar, select the UAMI created by script. It should be something like ejb010317u
.
In the sidebar, select Add. This should dismiss the sidebar and cause the warning box to disappear.
If the UAMI you created is not appearing, sign out of the Portal, sign back in and try again.
Scroll down and note the hyperlinks in the Report issues, get help, and share feedback section. The links will open in a new tab. We especially encourage you to take the survey about Java EE usage. this will help us create better Java EE on Azure offers.
Select Next: Configure cluster.
Leave the values at their defaults, but allow the instructor to talk about what the values do.
Select Next: Configure application.
Next to Deploy an application? select Yes.
In the UI that appears, select The Open Liberty sample image but allow the instructor to explain what the other options are.
Select Review + create.
When the green Validation passed message appears, select Create. This starts deployment.
Self-guided. How to find resource groups in the Portal.
Visit the Portal.
Select Resource groups.
In the filter, enter the first three characters of the prefix
you used in setup.sh
.
Select your resource group.
Self-guided. How to find outputs in a resource group.
In the pane under the Resource group name, in the Settings section, select Deployments.
Select the bottom most deployment in the list.
In the left pane, select Outputs.
Examine the outputs.
How to connect to cluster with kubectl
in Cloud Shell.
az aks
command reference docs.microsoft.comSelf-guided. How to visit the sample app.
Execute the cmdToGetAppService.
Fashion the EXTERNAL-IP and PORT values into a URL such as http://52.182.209.67:9080/
.
Visit the URL in your browser. Explore the sample app.
Examine appDeploymentTemplateYamlEncoded.
Copy the value of that output using the icon.
In the Cloud Shell, execute echo <paste> | base64 -d
and press enter.
This is the deployment YAML you can use to update the offer. The pipeline will revisit use this value. You do not need to save it now.
You must remove the deployment to avoid consuming more Azure resources than your pass allows.
In Cloud Shell, enter az aks delete --no-wait --name <your cluster name> --resource-group <your resource group>
.
In the Portal, find <your resource group>
and select Delete resource group.
Copy past the name of the resource group and select Delete.
Visit your fork of https://github.com/edburns/javaland-javaee.
Select Actions.
Select DB and Storage Account.
Select Run workflow and Run workflow.
Instructor will walk you through
.github/workflows/setupDBandStorage.yml
, which you have in your
repo. Briefly, this workflow uses the repository secrets you
created earlier to create an Azure Database for PostgreSQL
instance, Storage Account, and Storage Container, build the
cargotracker.war and upload it to the Storage Container.
Capture values from outputs. You will need these later.
From the Actions tab, select Setup DB and Storage Account, then select the most recent run of that workflow.
Under Jobs on the left, select deploy-db.
In the log pane on the right, expand Set Up Azure Postgresql to Test dbTemplate.
Expand Run azure/CLI. Look in the env section.
Disambiguation prefix. This value is the numeric value in the
middle of the value for resourceGroupForDB. It will be
something like 19251229631
.
Database name. This value is the dbName. It will be
something like wlsdb19251229631
.
Storage account name. This value is the storageAccountName.
It will be something like wlsdsa19251229631
.
Storage container within storage account. This value is the
storageContainerName. It will be something like
wlsdcon19251229631
.
Visit your fork of https://github.com/edburns/javaland-javaee.
Select Actions.
Select Setup OpenLiberty on AKS.
Select Run workflow.
In the drop down:
Enter the disambiguation prefix from above.
Enter your region.
Select Run workflow.
Instructor will walk you through
.github/workflows/setupOpenLibertyAks.yml
, which you have in
your repo. Briefly, this workflow uses the repository secrets you
created earlier to execute the same steps you did in the Portal,
but uses the underlying GitHub repo for Liberty on AKS to deploy
the arm template manually.
It then uses the cargotracker/cargotracker-liberty
version of
CargoTracker to create a parameters file that is used to deploy
the offer.
IMPORTANT The deployment of cargotracker is not complete at this point because we have not pushed the docker image to the Azure Container Registry.
Self-guided. After the workflow succeeds, go into the Portal
and find the resource group created by the workflow. It will start
with ol-aks-<your disambiguation suffix>
.
Self-guided. Select Overview. Observe the list of resources in the middle pane.
Self-guided. Capture the Azure Container Registry and create a repository secret with the value.
In the resource group for the AKS cluster, find the Container Registry resource and select it.
In the Settings section, select Access keys.
There are two password entries. Hover the mouse over the Copy icon to the right of the first one and single click.
Paste the value to your saved text file, labeling it accordingly.
In the Cloud Shell, type gh --repo <your github name>/javaland-javaee secret set AZURE_OPEN_LIBERTY_ACR_PASSWORD -b
and paste the saved value.
Ensure there is no space after -b
. Press enter.
Self-guided. In the Portal find the resource group for the AKS cluster.
Self-guided. As you did before, inspect the outputs.
Self-guided. Collect parameters necessary for the next step. Use the Copy icon next to each output.
clusterRGName Name of the resource group into which the AKS cluster is deployed.
clusterName The name of the AKS cluster.
acrName The name of the container registry, but you must
append .azurecr.io
when you save this value aside.
ACR user name. This is the same as acrName .
Visit your fork of https://github.com/edburns/javaland-javaee.
Select Actions.
Select Update Cargo Tracker to OpenLiberty on Aks.
Select Run workflow.
Fill in the values you captured in the preceding step.
For the database, fill in the value you saved earlier.
Select Run workflow.
Instructor will walk you through
.github/workflows/updateCargoTrackerToOpenLibertyOnAks.yml
,
which you have in your repo. Briefly, this workflow does the same
steps done above to run cargotracker on liberty locally, but
instead of running it locally, it does the following:
Inspect the workflow output and expand the Query Application
URL step. Construct a URL using the IP, such as
http://20.62.216.80:9080/
.
The Cargo Tracker main URL is the URL constructed in the preceding step.
Go to the Cargo Tracker main URL.
a. On the main page, select Public Tracking Interface in new window.
Enter ABC123 and select Track!
Observe what the next expected activity is.
b. On the main page, select Administration Interface, then, in the left navigation column select Live in a new window. This opens up a map view.
c. On the main page, select Mobile Event Logger. This opens up in a new, small, window.
d. Drop down the menu and select ABC123. Select Next.
e. Select the Location using the information in the next expected activity. Select Next.
f. Select the Event Type using the information in the next expected activity. Select Next.
g. Select the Voyage using the information in the next expected activity. Select Next.
h. Set the Completion Date a few days in the future. Select Next.
i. Review the information and verify it matches the next expected activity. If not, go back and fix it. If so, select Submit.
j. Back on the Public Tracking Interface select Tracking then enter ABC123 and select Track. Observe that a different. next expected activity is listed.
k. If desired, go back to Mobile Event Logger and continue performing the next activity.
If you want to run cargo tracker locally, you need a fully equipped Java development environment with the following requirements.
Or you could use a cloud based development environment such as GitHub Codespaces or GitPod.
If you choose to use GitHub Codespaces, simply open the repository in Codespaces.
If you choose to use GitPod, please follow the steps from the JBoss EAP afternoon exercise introduction section 1.1 only, but use your fork of the javaland-javaee repository instead of workshop-migrate-jboss-on-app-service as the project name. Introduction section 1.1
Visit the Portal
Find the resource group for your database deployment. It will be something like wlsd-db-1953611437-2
.
Within the resource group, select the resource of type Azure Database for PostgreSQL single server.
In the Settings panel, select Connection security.
In the middle of the page is the Firewall rules section. Select the most secure option you can tolerate.
If the portal has correctly determined IP address of your development environment, as in parenthesis next to + Add current client IP address, select this option.
If you know how to get the IP address of your cloud development environment, you can enter the value in the Start IP and End IP fields.
nslookup
. At the time writing, doing nslookup gitpod.io
and using the first octet from the IP address for
the Start IP and End IP values, followed by .0.0.0
and .255.255.255
, respectively, worked.If there is no more secure option, you can open the database to the entire public Internet by selecting + Add 0.0.0.0 - 255.255.255.254.
Select Save. While the configuration is updating, you may continue to the next step.
This section uses the liberty:dev
to run Open Liberty in a JVM in
your development environment. For an introduction to liberty:dev
see Open Liberty development mode. For complete reference material see the reference documentation.
In you development environment, open the server.xml
file. This
file is located at
cargotracker-liberty/src/main/liberty/config/server.xml
in your
forked repository.
find the section with the xml element <properties.postgresql>
.
Make the edits as shown in this diff, hard coding the values using the parameters collected previously.
--- a/cargotracker-liberty/src/main/liberty/config/server.xml
+++ b/cargotracker-liberty/src/main/liberty/config/server.xml
@@ -34,11 +34,11 @@
<dataSource id="CargoTrackerDB" jndiName="jdbc/CargoTrackerDB">
<jdbcDriver libraryRef="driver-library" />
<properties.postgresql
- serverName="${db.server.name}"
- portNumber="${db.port.number}"
- databaseName="${db.name}"
- user="${db.user}"
- password="${db.password}"
+ serverName="wlsdb19536114372.postgres.database.azure.com"
+ portNumber="5432"
+ databaseName="postgres"
+ user="weblogic@wlsdb19536114372"
+ password="Secret123!"
ssl="${db.ssl}" />
</dataSource>
<variable name="db.ssl" defaultValue="false"/>
In the terminal of your development environment, run cd cargotracker-liberty
.
mvn -PopenLibertyOnAks clean package
mvn -PopenLibertyOnAks liberty:dev
If you are running in a cloud development environment, you may see a pop up about port 9080, and it might give you the option to make this port public. You must say yes to this option. If you do not see this option, you will need to use your cloud development environment steps to make this port public.
When you see this output text, you know the server is running successfully.
[INFO] *******************************************************************
[INFO] *** WARNING: Apache MyFaces-2 is running in DEVELOPMENT mode. ***
[INFO] *** ^^^^^^^^^^^ ***
[INFO] *** Do NOT deploy to your live server(s) without changing this. ***
[INFO] *** See Application#getProjectStage() for more information. ***
[INFO] *******************************************************************
[INFO]
[INFO] [AUDIT ] CWWKZ0003I: The application cargo-tracker updated in 2.720 seconds.
Notice the mention about Apache MyFaces-2. Know that your instructor lead the team that developed the specification for MyFaces.
Obtain the URL for the cargotracker from your development environment.
If you are running locally, the url is simply http://localhost:9080/
.
If you are running in a cloud development environment, the instructions vary depending on your environment.
For GitPod, the following was known to work at the time of this writing.
In the lower right hand corner of the browser window is a list of ports. Select this list.
The Ports tab should open.
Hover the mouse over 9080 and options should appear. One option looks like a globe. Select the globe. A new tab should open on that URL.
If you see the Open Liberty start page, append a /
to the URL.
The Cargo Tracker main URL is the URL constructed in the preceding step.
Go to the Cargo Tracker main URL.
a. On the main page, select Public Tracking Interface in new window.
Enter ABC123 and select Track!
Observe what the next expected activity is.
b. On the main page, select Administration Interface, then, in the left navigation column select Live in a new window. This opens up a map view.
c. On the main page, select Mobile Event Logger. This opens up in a new, small, window.
d. Drop down the menu and select ABC123. Select Next.
e. Select the Location using the information in the next expected activity. Select Next.
f. Select the Event Type using the information in the next expected activity. Select Next.
g. Select the Voyage using the information in the next expected activity. Select Next.
h. Set the Completion Date a few days in the future. Select Next.
i. Review the information and verify it matches the next expected activity. If not, go back and fix it. If so, select Submit.
j. Back on the Public Tracking Interface select Tracking then enter ABC123 and select Track. Observe that a different. next expected activity is listed.
k. If desired, go back to Mobile Event Logger and continue performing the next activity.
Follow the same steps as in the section where you enabled access to the database from your development environment, but remove the firewall rule that allowed the access.
Remember to select Save.
In the terminal for your development environment, cd to the top level
of your cloned repository and run git reset --hard
.