Skip to content

Edburns msft rh 205 quarkus learn path public #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### YamlMime:AchievementDetail
achievementUid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.badge
metadata:
title: >-
Microsoft Badge: Deploy a Quarkus application to Azure Red Hat OpenShift was
issued by Microsoft
socialImageUrl: /training/achievements/generic-badge-social.png
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### YamlMime:ModuleUnit
uid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.1-introduction
title: Introduction
metadata:
title: Introduction
description: Introduction
ms.date: 10/18/2024
author: danieloh
ms.author: edburns
ms.topic: unit
ms.custom:
- team=devdiv
- devx-track-extended-java
ms.contributors: edburns
durationInMinutes: 3
content: |
[!include[](includes/1-introduction.md)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### YamlMime:ModuleUnit
uid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.10-summary
title: Summary
metadata:
title: Summary
description: Summary
ms.date: 10/18/2024
author: danieloh
ms.author: edburns
ms.topic: unit
ms.custom:
- team=devdiv
- devx-track-extended-java
ms.contributors: edburns
durationInMinutes: 2
content: |
[!include[](includes/10-summary.md)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### YamlMime:ModuleUnit
uid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.2-create-quarkus-todo-app
title: Create a new ToDo application using Quarkus
metadata:
title: Create a new ToDo application using Quarkus
description: Create a new ToDo application using Quarkus
ms.date: 10/18/2024
author: danieloh
ms.author: edburns
ms.topic: unit
ms.custom:
- team=devdiv
- devx-track-extended-java
ms.contributors: edburns
durationInMinutes: 5
content: |
[!include[](includes/2-create-quarkus-todo-app.md)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### YamlMime:ModuleUnit
uid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.3-exercise-create-quarkus-todo-app
title: Exercise - Create a new ToDo application using Quarkus
metadata:
title: Exercise - Create a new ToDo application using Quarkus
description: In this exercise, follow the steps to create a new ToDo application using Quarkus
ms.date: 10/18/2024
author: danieloh
ms.author: edburns
ms.topic: unit
ms.custom:
- team=devdiv
- devx-track-extended-java
ms.contributors: edburns
durationInMinutes: 10
content: |
[!include[](includes/3-exercise-create-quarkus-todo-app.md)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### YamlMime:ModuleUnit
uid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.4-package-run-locally
title: Package and Run Locally
metadata:
title: Package and Run Locally
description: Package and Run the Todo Application with PostgreSQL locally
ms.date: 10/18/2024
author: danieloh
ms.author: edburns
ms.topic: unit
ms.custom:
- team=devdiv
- devx-track-extended-java
ms.contributors: danieloh
durationInMinutes: 3
content: |
[!include[](includes/4-package-run-locally.md)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### YamlMime:ModuleUnit
uid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.5-exercise-package-run-locally
title: Exercise - Package and Run Locally
metadata:
title: Exercise - Package and Run Locally
description: In this exercise, follow the steps to package and run the Todo Application with PostgreSQL locally
ms.date: 10/18/2024
author: danieloh
ms.author: edburns
ms.topic: unit
ms.custom:
- team=devdiv
- devx-track-extended-java
ms.contributors: danieloh
durationInMinutes: 3
content: |
[!include[](includes/5-exercise-package-run-locally.md)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### YamlMime:ModuleUnit
uid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.6-deploy-aro-postgresql
title: Deploy the Todo Application to Azure Red Hat OpenShift with Azure Database for PostgreSQL
metadata:
title: Deploy the Todo Application to Azure Red Hat OpenShift with Azure Database for PostgreSQL
description: Deploy the Todo Application to Azure Red Hat OpenShift with Azure Database for PostgreSQL
ms.date: 10/18/2024
author: danieloh
ms.author: edburns
ms.topic: unit
ms.custom:
- team=devdiv
- devx-track-extended-java
ms.contributors: edburns
durationInMinutes: 8
content: |
[!include[](includes/6-deploy-aro-postgresql.md)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### YamlMime:ModuleUnit
uid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.7-exercise-deploy-aro-postgresql
title: Exercise - Deploy the Todo Application to Azure Red Hat OpenShift with Azure Database for PostgreSQL
metadata:
title: Exercise - Deploy the Todo Application to Azure Red Hat OpenShift with Azure Database for PostgreSQL
description: In this exercise, follow the steps to deploy the Todo Application to Azure Red Hat OpenShift with Azure Database for PostgreSQL
ms.date: 10/18/2024
author: danieloh
ms.author: edburns
ms.topic: unit
ms.custom:
- team=devdiv
- devx-track-extended-java
ms.contributors: edburns
durationInMinutes: 10
content: |
[!include[](includes/7-exercise-deploy-aro-postgresql.md)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### YamlMime:ModuleUnit
uid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.8-evolve-openshift-serverless
title: Evolve the ToDo application to OpenShift Serverless
metadata:
title: Evolve the ToDo application to OpenShift Serverless
description: Evolve the ToDo application to OpenShift Serverless
ms.date: 10/18/2024
author: danieloh
ms.author: edburns
ms.topic: unit
ms.custom: team=devdiv, devx-track-extended-java, devx-track-azurecli
ms.contributors: edburns
durationInMinutes: 7
content: |
[!include[](includes/8-evolve-openshift-serverless.md)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### YamlMime:ModuleUnit
uid: learn.azure.deploy-java-quarkus-red-hat-openshift-postgres.9-exercise-evolve-openshift-serverless
title: Exercise - Evolve the ToDo application to OpenShift Serverless
metadata:
title: Exercise - Evolve the ToDo application to OpenShift Serverless
description: In this exercise, follow the steps to evolve the ToDo application to OpenShift Serverless
ms.date: 10/18/2024
author: danieloh
ms.author: edburns
ms.topic: unit
ms.custom: team=devdiv, devx-track-extended-java, devx-track-azurecli
ms.contributors: edburns
durationInMinutes: 7
content: |
[!include[](includes/9-exercise-evolve-openshift-serverless.md)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
As a Java developer working for a company seeking to expand its Azure cloud services, you're tasked with creating a new web-based ToDo list application. The application's data will be stored in a relational Azure database.

Your company has a history of successfully deploying business services on Red Hat OpenShift, leveraging its scalability, elasticity, resilience, and rapid time-to-market benefits.

To align with this established architecture, your team has chosen [Quarkus, a Kubernetes-native Java framework](https://quarkus.io/), for developing the ToDo service since Quarkus focuses on developer productivity, containerization, and seamless OpenShift integration makes it an ideal fit for this project.

This module guides you through creating a new Java project using the Quarkus CLI. The generated project includes sample code, a Maven wrapper, Dockerfile, and unit tests.

Next, you'll develop the business logic to store ToDo items in a relational database, such as PostgreSQL. This will involve implementing methods to retrieve specific ToDo items (entities) from the database.

Once you've thoroughly tested your ToDo list application locally, we'll move on to the deployment phase on the [Azure Red Hat OpenShift (ARO)](hhttps://azure.microsoft.com/en-us/products/openshift) platform.

As an optional challenge, we can explore the possibility of transforming your ToDo application into a serverless function. Serverless functions offer several advantages, including cost-efficiency, reliability, flexibility, and enhanced security. If you're interested in this option, we'll guide you through the process of deploying your application on [Red Hat OpenShift Serverless](https://www.redhat.com/en/technologies/cloud-computing/openshift/serverless).

By the end of this module, you'll not only have a well-functioning ToDo application deployed on ARO with [Azure Database for PostgreSQL](https://azure.microsoft.com/en-us/products/postgresql), but you'll also gain the knowledge and skills to potentially evolve it into a serverless function on Red Hat OpenShift Serverless.

This module requires you to deploy resources to your Azure subscription. If you haven't already, create a free Azure account using the following link: [Free Azure Account](https://azure.microsoft.com/free/java/?azure-portal=true).

> ⚠️ **IMPORTANT**:
> To avoid incurring unnecessary charges in your Azure subscription, remember to deprovision (clean up) the resources you create once you've finished working with them in this module.

## Learning objectives

By the end of this module, you'll be able to:

- Create a new ToDo application using Quarkus.
- Package and Run Locally to verify the functionalities.
- Deploy the Todo application to Azure Red Hat OpenShift with Azure Database for PostgreSQL.
- Evolve the ToDo application to OpenShift Serverless.

## Prerequisites

As a Java developer, you're already familiar with the fundamentals of Java applications. We'll guide you through Quarkus as we progress. For the exercises in this module, you'll need a personal Azure account. Ensure you have the following resources ready:

- An Azure subscription
- JDK 17+ installed with JAVA_HOME configured appropriately
- Apache Maven 3.9.8
- Azure CLI 2.64.0+
- Podman or Docker
- Quarkus CLI
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Congratulations! You've deployed a Quarkus application to Azure Red Hat OpenShift.

Your company wanted to learn how to deploy a Quarkus application to the Azure Red Hat OpenShift with Azure PostgreSQL. You followed these steps:

1. Create a sample Quarkus application, execute and test it locally using Quarkus Dev Services and Dev mode.

1. Build and package the Quarkus application to create a JAR file. Run it locally with a standload PostgreSQL database locally.

1. Create an Azure for PostgreSQL database, and create a TODO table in the database.

1. Install a new Azure Red Hat OpenShift cluster and Configure the Quarkus application to connect to the Azure PostgreSQL database.

1. Deploy the Quarkus application container.

1. Install OpenShift serverless and configure the native serverless function deployment with Quarkus.

You're now confident that you can recommend executing your Quarkus application to Azure Red Hat OpenShift.

## Clean up resources

If you don't need these resources later, delete the resources from the Azure portal.

### Delete Azure Red Hat OpenShift cluster

* [Tutorial: Delete an Azure Red Hat OpenShift 4 cluster](https://docs.microsoft.com/en-us/azure/openshift/tutorial-delete-cluster)

### Delete resource group

```shell
az group delete --name YOUR_RESOURCE_GROUP --yes
```

This command might take a minute to run.

## Additional resources

For more information about Quarkus, see [Quarkus guides](https://quarkus.io/guides).

For more information about[Azure Red Hat OpenShift](https://azure.microsoft.com/en-us/products/openshift).

For more information about PostgreSQL servers on Azure, see [Azure Database for PostgreSQL documentation](/azure/postgresql/).

For more information about Hibernate ORM with Panache, see [Hibernate ORM with Panache](https://quarkus.io/guides/hibernate-orm-panache).

For more information about using Azure with Java, see [Azure for Java developers](/azure/developer/java).

For more information about Quarkus Azure extensions, see [Quarkus Azure extensions](https://quarkus.io/extensions/?search-regex=azure).
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
In this module, you'll embark on a new learning journey to scaffold a new Todo application using Quarkus. You'll also seamlessly implement the entitiy class to map Java beans with the relational database. In the end, you'll create REST services to retrieve the Todo items from the database and store a new Todo item to the database.

Here is a summary of the key developer tools you'll learn in this module.

## Quarkus, Supersonic Subatomic Java

[Quarkus](https://quarkus.io) is a modern Java framework designed to build fast, efficient, and container-native applications. It is optimized for GraalVM, a high-performance Java virtual machine, which can compile Java code into native executables. This results in significantly reduced startup times and memory consumption compared to traditional Java applications.

Key features of Quarkus include:

* **Fast startup**: Quarkus applications start up in milliseconds, making them ideal for microservices architectures and serverless environments.
* **Low memory footprint**: Quarkus is designed to have a small memory footprint, allowing you to run more applications on a given hardware configuration.
* **Developer-friendly**: Quarkus provides a familiar development experience for Java developers, with support for popular frameworks and tools.
* **Container-native**: Quarkus is optimized for deployment in containers, making it easy to build and deploy cloud-native applications.
* **Extensible**: Quarkus is highly extensible, allowing you to add new features and functionality using extensions.

## Quarkus CLI

Quarkus offers multiple options for project creation, including _Maven_, _Gradle_, the [online project generator](https://code.quarkus.io/), and the _Quarkus CLI_. In this lab, we'll focus on the **Quarkus CLI**, a convenient tool easily installable as a JAR using [JBang](https://jbang.dev/). JBang allows us to execute the CLI directly without prior installation.

Run the following commands based on your operation system.

* On Linux, macOS, and Windows (using WSL or bash compatible shell like Cygwin or MinGW)

```bash
curl -Ls https://sh.jbang.dev | bash -s - trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio
```

* On Windows using Powershell:

```bash
iex "& { $(iwr https://ps.jbang.dev) } trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/"
iex "& { $(iwr https://ps.jbang.dev) } app install --fresh --force quarkus@quarkusio"
```

If JBang has already been installed, you can directly use it:

```bash
jbang app install --fresh --force quarkus@quarkusio
```

Once installed *quarkus* will be in your *$PATH* and if you run *quarkus --version* it will print the installed version:

```bash
quarkus --version
3.14.4
```

The version might be different when you run the command.

Let's see all these developer tools in action by creating the Todo application using Quarkus CLI.
Loading