forked from oracle-livelabs/oci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72f542a
commit 8004124
Showing
46 changed files
with
1,813 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Introduction | ||
|
||
## About this Workshop | ||
|
||
This workshop takes you step by step through the process of building a Java application with the Graal Development Kit for Micronaut (GDK), Oracle Cloud Infrastructure (OCI) MySQL HeatWave Database service and Secrets in OCI Vault. | ||
You'll use GraalVM Native Image to package and run the application as a native executable. | ||
|
||
It is aimed at application developers and DevOps engineers with an intermediate knowledge of Java. | ||
|
||
Estimated Workshop Time: 75 minutes | ||
|
||
### What is Graal Development Kit for Micronaut? | ||
|
||
The [Graal Development Kit for Micronaut (GDK)](https://graal.cloud/gdk) is an Oracle build of the open source Micronaut® framework. The GDK provides a curated set of Micronaut framework modules that simplify cloud application development, are designed for ahead-of-time compilation with GraalVM Native Image, and are fully supported by Oracle. The GDK also provides project creation utilities, VS Code and IntelliJ extensions to simplify application development and deployment. | ||
|
||
### What is Micronaut? | ||
|
||
The [Micronaut® framework](https://micronaut.io/) is a modern, JVM-based framework to build modular, easily testable microservice and serverless applications. By avoiding runtime reflection in favor of annotation processing, Micronaut improves the Java-based development experience by detecting errors at compile time instead of runtime, and improves Java-based application startup time and memory footprint. Micronaut includes a persistence framework called Micronaut Data that precomputes your SQL queries at compilation time making it a great fit for working with databases like MySQL, Oracle Autonomous Database, etc. | ||
|
||
> Micronaut® is a registered trademark of Object Computing, Inc. Use is for referential purposes and does not imply any endorsement or affiliation with any third-party product. | ||
### What is GraalVM Native Image? | ||
|
||
[GraalVM Native Image](https://www.graalvm.org/) technology compiles Java applications ahead-of-time into self-contained native executables that are small in size, start almost instantaneously, provide peak performance with no warmup, and require less memory and CPU. Only the code that is required at run time by the application gets added into the executable file. Native Image is perfect for containerized workloads and microservices — which is why it has been embraced by Micronaut, Spring Boot, Helidon, and Quarkus. | ||
|
||
The GDK modules are designed for ahead-of-time compilation with GraalVM Native Image to produce native executables that are ideal for microservices: they have a small memory footprint, start instantly, and provide peak performance with no warmup. | ||
|
||
> Graal Development Kit for Micronaut, and Oracle GraalVM are available at no additional cost on Oracle Cloud Infrastructure (OCI). | ||
### Objectives | ||
|
||
In this workshop, you will: | ||
|
||
* Create a new OCI MySQL HeatWave Database instance and a Vault | ||
* Use Visual Studio Code (VS Code) from a remote desktop running in an OCI Compute Instance | ||
* Review the application source code developed with the Graal Development Kit for Micronaut | ||
* Build and run the application against a local MySQL database in a container | ||
* Build and run a native executable and connect to the local MySQL database | ||
* Configure the MySQL HeatWave Database instance and the Vault | ||
* Configure the application to use the MySQL HeatWave Database instance and the Vault | ||
* Build a native executable for the application using GraalVM Native Image and connect to the MySQL HeatWave Database instance | ||
|
||
### Prerequisites | ||
|
||
This workshop assumes you have: | ||
|
||
* Some familiarity with Oracle Cloud Infrastructure (OCI) | ||
* Understanding of the Java programming language | ||
* Oracle GraalVM for JDK 17 | ||
* Visual Studio Code (VS Code) | ||
* A browser with access to the internet | ||
* An Oracle Cloud Infrastructure (OCI) account with adequate permissions | ||
|
||
## Learn More | ||
|
||
* [Graal Development Kit for Micronaut](https://graal.cloud/gdk/) | ||
|
||
## Acknowledgements | ||
|
||
* **Author** - [](var:author) | ||
* **Contributors** - [](var:contributors) | ||
* **Last Updated By/Date** - [](var:last_updated) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Prepare Setup | ||
|
||
## Introduction | ||
|
||
This lab will show you how to download the Oracle Resource Manager (ORM) stack zip file needed to set up the resources needed to run this workshop. | ||
|
||
*Estimated Lab Time:* 5 minutes | ||
|
||
### Objectives | ||
|
||
* Download ORM stack | ||
* (*Optional*) Configure an existing Virtual Cloud Network (VCN) | ||
* Select a Compartment for the workshop | ||
|
||
### Prerequisites | ||
|
||
This lab assumes you have: | ||
|
||
* An Oracle Cloud account | ||
|
||
## Task 1: Download Oracle Resource Manager (ORM) stack zip file | ||
|
||
1. Click on the link below to download the Resource Manager zip file you need to build your environment: | ||
|
||
* [gdk-oci-mysql-ll-orm.zip](https://c4u04.objectstorage.us-ashburn-1.oci.customer-oci.com/p/EcTjWk2IuZPZeNnD_fYMcgUhdNDIDA6rt9gaFj_WZMiL7VvxPBNMY60837hu5hga/n/c4u04/b/livelabsfiles/o/oci-library/gdk-oci-mysql-ll-orm.zip) | ||
|
||
2. Save it in your downloads folder. | ||
|
||
3. (*Recommended*) We strongly recommend using this stack to create a new self-contained/dedicated VCN along with your instance. Skip to **Task 3** to follow the recommendation. | ||
|
||
4. Alternatively, if you would rather use an existing VCN then proceed to the next task to update your existing VCN with the required network security rules. | ||
|
||
## Task 2: Add Network Security Rules to an Existing VCN | ||
|
||
This workshop requires a certain number of ports to be available, a requirement that is automatically met by using the default ORM stack execution that creates a new dedicated VCN. | ||
|
||
However, if you would rather use an existing VCN/subnet, follow these steps to add the following rules to the network security list. | ||
|
||
1. From the Oracle Cloud Console navigation menu, go to **Networking >> Virtual Cloud Networks**. | ||
2. Choose your network. | ||
3. Under **Resources**, select **Security Lists**. | ||
4. Click on **Default Security Lists** under the **Create Security List** button. | ||
5. Click **Add Ingress Rules** button. | ||
6. Create a rule for each row in the *Ingress* table below: | ||
|
||
| Stateless | Source Type | Source CIDR | IP Protocol | Source Port Range | Destination Port Range | Description | | ||
| :------------- | :---------: | :---------: | :---------: | :---------------: | :--------------------: | :------------------------- | | ||
| No (unchecked) | CIDR | 0.0.0.0/0 | TCP | All | 80 | Remote Desktop using noVNC | | ||
| No (unchecked) | CIDR | 0.0.0.0/0 | TCP | All | 6080 | Remote Desktop using noVNC | | ||
{: title="Network Ingress Security Rules"} | ||
|
||
7. Select **Egress Rule** from the left panel. | ||
8. Click **Add Egress Rule** button | ||
9. Create a rule for each row in the *Egress* table below: | ||
|
||
| Stateless | Source Type | Destination CIDR | IP Protocol | Source Port Range | Destination Port Range | Description | | ||
| :------------- | :---------: | :--------------: | :---------: | :---------------: | :--------------------: | :-------------------- | | ||
| No (unchecked) | CIDR | 0.0.0.0/0 | TCP | All | 80 | Outbound HTTP access | | ||
| No (unchecked) | CIDR | 0.0.0.0/0 | TCP | All | 443 | Outbound HTTPS access | | ||
{: title="Network Egress Security Rules"} | ||
|
||
## Task 3: Select a Compartment for the Workshop | ||
|
||
We recommend you use a single compartment for the workshop. We will refer to this as your workshop compartment. This is the compartment where you will provision all the resources - Oracle Resource Manager (ORM) Stack, Compute Instance, VCN/Subnet, Instance Principals, Policies, MySQL HeatWave Database, Vault - needed for the workshop. | ||
|
||
1. From the Oracle Cloud Console navigation menu, go to **Identity & Security >> Identity >> Compartments**. | ||
2. Go to your workshop compartment. | ||
3. Make a note of the compartment name and OCID. You will need this information in subsequent labs. | ||
|
||
## Task 4: Setup Compute | ||
|
||
Using the details from the above Tasks, proceed to the **Environment Setup** lab to set up your workshop environment using Oracle Resource Manager (ORM) with one of the following options: | ||
|
||
* (*Recommended*) Create Stack: **Compute + Networking** | ||
* Create Stack: **Compute only** with an existing VCN where security lists have been updated as per **Task 2** above | ||
|
||
The ORM stack will provision a compute instance with 4 OCPUs, 64 GB RAM and a Remote Desktop environment. | ||
|
||
You may now **proceed to the next lab**. | ||
|
||
## Acknowledgements | ||
|
||
* **Author** - [](var:author) | ||
* **Contributors** - [](var:contributors) | ||
* **Last Updated By/Date** - [](var:last_updated) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Clone the Sample Application Source Code | ||
|
||
## Introduction | ||
|
||
This lab describes the steps to download the sample application source code used in the workshop. | ||
|
||
Estimated Lab Time: 5 minutes | ||
|
||
### Objectives | ||
|
||
In this lab, you will: | ||
|
||
* Clone the sample application source code | ||
|
||
## Task 1: Clone the Sample Application Source Code | ||
|
||
1. From the **Activities** menu, start a new **Terminal** window. | ||
|
||
2. Clone the sample application source code. | ||
|
||
``` bash | ||
<copy> | ||
git init lab | ||
cd lab | ||
git remote add origin https://github.com/oracle-samples/gdk-micronaut-samples.git | ||
git config core.sparsecheckout true | ||
echo "gdk-oci-mysql-mvn/*">>.git/info/sparse-checkout | ||
git pull --depth=1 origin main | ||
</copy> | ||
``` | ||
|
||
3. Open the sample application source code from the _gdk-oci-mysql-mvn_ directory in **Visual Studio Code**. | ||
|
||
``` bash | ||
<copy> | ||
code gdk-oci-mysql-mvn | ||
</copy> | ||
``` | ||
|
||
4. VS Code may show a dialog box with the message "Do you trust the authors of the files in this folder?". Select **Trust the authors of all files in the parent folder 'oracle'** and click **Yes, I trust the authors**. | ||
|
||
5. VS Code may ask you to choose a password for new keyring. Press **Cancel** twice to close the prompt. | ||
|
||
6. VS Code may show a dialog box with the message "A git repository was found in the parent folders of the workspace or the open file(s). Would you like to open the repository?". Click **Never**. | ||
|
||
![VS Code Question Icon](images/vs-code-question-icon.jpg#input) | ||
|
||
You may now **proceed to the next lab**. | ||
|
||
## Acknowledgements | ||
|
||
* **Author** - [](var:author) | ||
* **Contributors** - [](var:contributors) | ||
* **Last Updated By/Date** - [](var:last_updated) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+785 KB
gdk-oci-mysql/03-provision-mysql-db/images/heatwave-mysql-landing-page.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+232 KB
gdk-oci-mysql/03-provision-mysql-db/images/mysql-network-placement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Provision an OCI MySQL HeatWave Database | ||
|
||
## Introduction | ||
|
||
This lab describes the steps to create a new OCI MySQL HeatWave Database instance. | ||
|
||
Estimated Lab Time: 10 minutes | ||
|
||
### Objectives | ||
|
||
In this lab, you will: | ||
|
||
* Create MySQL HeatWave Database instance | ||
|
||
## Task 1: Create MySQL HeatWave Database instance | ||
|
||
1. From the Oracle Cloud Console, open the navigation menu, click **Databases**. Under **HeatWave MySQL**, click **DB Systems** | ||
|
||
![Oracle Databases menu](https://oracle-livelabs.github.io/common/images/console/database-mysql.png) | ||
|
||
2. Select your workshop compartment from the **Compartment** drop down list on the left | ||
|
||
![HeatWave MySQL Landing Page](images/heatwave-mysql-landing-page.jpg#input) | ||
|
||
3. Click **Create DB System**. | ||
|
||
![Create DB System Button](images/create-db-system.jpg#input) | ||
|
||
4. You will see the **Create DB System** screen. Select **Development or testing**. | ||
|
||
![Create DB System Screen](images/mysql-db-system-form.png#input) | ||
|
||
5. Under the **Create administrator credentials** section, enter the username as "mysqladmin" and a password of your choice. | ||
|
||
![Create MySQL Admin User](images/mysql-admin-user.jpg#input) | ||
|
||
6. Ensure **Standalone** is selected. | ||
|
||
![MySQL Standalone or HA](images/mysql-standalone-ha.jpg#input) | ||
|
||
7. Leave the default values in the **Network** and **Placement** sections unchanged. | ||
|
||
![MySQL Network and Placement](images/mysql-network-placement.png#input) | ||
|
||
8. Under the **Configure hardware** section, deselect **Enable HeatWave cluster**. Leave the other default values unchanged. | ||
|
||
![MySQL Configure Hardware](images/mysql-configure-hw.jpg#input) | ||
|
||
9. Under the **Configure backup plan** section, deselect **Enable automatic backups**. Click **Create**. | ||
|
||
![Disable MySQL Automatic Backup and Create](images/mysql-backup-create.png) | ||
|
||
It takes about 10 minutes to provision an OCI MySQL DB System instance. Meanwhile, proceed to the next step. | ||
|
||
Congratulations! In this lab, you created a new OCI MySQL HeatWave Database instance in your workshop compartment. | ||
|
||
You may now **proceed to the next lab**. | ||
|
||
## Acknowledgements | ||
|
||
* **Author** - [](var:author) | ||
* **Contributors** - [](var:contributors) | ||
* **Last Updated By/Date** - [](var:last_updated) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Provision an OCI Vault | ||
|
||
## Introduction | ||
|
||
This lab describes the steps to create a new OCI Vault. | ||
|
||
Estimated Lab Time: 10 minutes | ||
|
||
### Objectives | ||
|
||
In this lab, you will: | ||
|
||
* Create an OCI Vault | ||
* Create OCI Vault Master Encryption Key | ||
|
||
## Task 1: Create an OCI Vault | ||
|
||
1. From the Oracle Cloud Console, open the navigation menu, click **Identity & Security**, and then click **Vault** under **Key Management & Secret Management**. | ||
|
||
![Vault menu](https://oracle-livelabs.github.io/common/images/console/id-vault.png) | ||
|
||
2. Select your workshop compartment from the **Compartment** drop down list on the left. | ||
|
||
![Select Compartment Button](images/select-compartment-field.png) | ||
|
||
3. Click **Create Vault**. | ||
|
||
![Create Vault Button](images/create-vault-button.png) | ||
|
||
4. In the **Create Vault** dialog box, provide the following details: | ||
|
||
``` | ||
Create in Compartment: <your workshop compartment> | ||
Name: shared-vault | ||
Make it a virtual private vault: NO (LEAVE THE BOX UNCHECKED) | ||
``` | ||
![Create Vault Details](images/create-vault-details.png) | ||
>Note: You cannot change the vault type after the vault is created. | ||
5. Click **Create Vault** | ||
## Task 2: Create OCI Vault Master Encryption Key | ||
1. In the **Vault** you created, navigate to **Master Encryption Key**, click **Create Key**. | ||
2. Provide the following details: | ||
```text | ||
Protection Mode: Software | ||
Name: master-key | ||
Key Shape Algorithm: AES (Symmetric key for Encrypt and Decrypt) | ||
Key Shape Length: 256 bits | ||
Import External key: NO (LEAVE THE BOX UNCHECKED) | ||
``` | ||
![Create Key Details](images/create-key-details.png) | ||
3. Click **Create Key**. | ||
Congratulations! In this lab, you created a new OCI Vault with a Master Encryption Key in your workshop compartment. | ||
You may now **proceed to the next lab**. | ||
## Acknowledgements | ||
* **Author** - [](var:author) | ||
* **Contributors** - [](var:contributors) | ||
* **Last Updated By/Date** - [](var:last_updated) |
Oops, something went wrong.