Skip to content

Commit

Permalink
442 for MLH hackathon p5 (#116)
Browse files Browse the repository at this point in the history
* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops

* init for graalvm workshops
  • Loading branch information
paulparkinson authored Oct 2, 2024
1 parent 745d709 commit 3935025
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 56 deletions.
24 changes: 20 additions & 4 deletions microservices-with-converged-db/helidon/helidon.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,31 @@ This lab assumes you have:
- Provisioned environment with Git and Maven (Cloud Shell).


## Task 1: Clone the repos
## Task 1: Install GraalVM 22 and dd to project dir

1. Clone the following repos:
1. Open Cloud Shell and make sure you're using X86_64 as your target architecture as was done during the setup lab

2. Cd to the following directory of the repos you cloned during setup. For example, if you cloned to your user's $HOME directory:

```
<copy>
git clone https://github.com/paulparkinson/microservices-datadriven-devrel.git
sdk list java
sdk install java 22.0.2-graal
sdk use java 22.0.2-graal
sdk current
csruntimectl java list
csruntimectl java set graalvmjdk-17
</copy>
```
3. Cd to the following directory of the repos you cloned during setup. For example, if you cloned to your user's $HOME directory:
```
<copy>
cd $HOME/microservices-datadriven/graalvm-nativeimage/helidon
</copy>
```
## Task 2: Build and run
Expand All @@ -42,7 +58,7 @@ This lab assumes you have:
```properties
javax.sql.DataSource.example.connectionFactoryClassName=oracle.jdbc.pool.OracleDataSource
javax.sql.DataSource.example.URL=jdbc:oracle:thin:@<tnsServiceName>?TNS_ADMIN=/path/to/wallet
javax.sql.DataSource.example.URL=jdbc:oracle:thin:@<tnsServiceName>_high?TNS_ADMIN=/home/<myhomedir>/myatpwallet
javax.sql.DataSource.example.user=ADMIN
javax.sql.DataSource.example.password=<password>
```
Expand Down
21 changes: 12 additions & 9 deletions microservices-with-converged-db/micronaut/micronaut.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ This lab assumes you have:

## Task 1: Download and install the Micronaut CLI

1. To install the Micronaut CLI on Linux, you can use SDKMAN!. Open a terminal and run:
1. Open Cloud Shell and make sure you're using X86_64 as your target architecture as was done during the setup lab

![Cloud Shell Architecture](../setup/images/cloud-shell-architecture.png "cloud shell architecture")

2. To install the Micronaut CLI on Linux, you can use SDKMAN!. Open a terminal and run:

```
<copy>
Expand All @@ -52,15 +56,13 @@ This lab assumes you have:
You should see `Micronaut Version: 4.6.2` as the installed Micronaut CLI version.
## Task 2: Clone and build the project
## Task 2: Cd to project dir and build the project
1. Create a new directory of your choice, then clone the workshop code into it. As an example, the new directory below will be created at the root of your user's $HOME directory:
1. Cd to the following directory of the repos you cloned during setup. For example, if you cloned to your user's $HOME directory:
```
<copy>
mkdir micronaut-graalvm-oracledb
cd micronaut-graalvm-oracledb
git clone https://github.com/juarezjuniorgithub/micronaut-guide.git
cd $HOME/microservices-datadriven/graalvm-nativeimage/micronaut
</copy>
```
Expand Down Expand Up @@ -103,7 +105,7 @@ This lab assumes you have:
sdk use java 22.0.2-graal
</copy>
```
You have to end your current Cloud Shell session, and start a new session to have it reflected after running the commands above. Then, run the commands below to confirm Java 22 as your current version.
**Note: You must end your current Cloud Shell session, and start a new session to have it reflected after running the commands above. You can do this by selecting `Actions` in the upper left of the Cloud Shell and `Restart`. Then, run the commands below to confirm Java 22 as your current version.
```
<copy>
Expand Down Expand Up @@ -131,6 +133,7 @@ This lab assumes you have:
![project build success](images/project-build-success.png)
## Task 3: Configure Micronaut Data with your Oracle ADB instance details
1. We’ll use an application properties file. Below is an example with the relevant details you must provide. Navigate to your `application.properties` file under `$HOME//micronaut-graalvm-oracledb/micronaut-guide/src/main/resources`:
Expand Down Expand Up @@ -178,9 +181,9 @@ This lab assumes you have:
Nevertheless, the related SQL script can be found under the `$HOME//micronaut-graalvm-oracledb/micronaut-guide/src/main/resources/db/migration` directory, as shown below.
![sql script flyway](images/sql-script-flyway.png =50%x*)
![sql script flyway](images/sql-script-flyway.png)
## Task 4: A first run with VS Code only and the JIT (C2) compiler
## Task 4: A first run with Java
1. The Micronaut application is now finished and ready to be executed. So, you can compile, build, and run it with Maven from the command-line.
Expand Down
15 changes: 6 additions & 9 deletions microservices-with-converged-db/quarkus/quarkus.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@ This lab assumes you have:

## Task 1: Clone the repos

1. Clone the following repos:
## Task 1: Cd to project dir and build the project

```
<copy>
git clone https://github.com/juarezjuniorgithub/jdbc-driver-graalvm-nativeimage.git
</copy>
```
1. Open Cloud Shell and make sure you're using X86_64 as your target architecture as was done during the setup lab

2. Cd to the following directory of the repos you cloned during setup. For example, if you cloned to your user's $HOME directory:

And cd into the directory...
```
<copy>
cd jdbc-driver-graalvm-nativeimage
cd $HOME/microservices-datadriven/graalvm-nativeimage/quarkus
</copy>
```
```
## Task 2: Build and run
Expand Down
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.
56 changes: 46 additions & 10 deletions microservices-with-converged-db/setup/setup-graalvm-workshop.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Your own Oracle Cloud Infrastructure compartment for running this workshop has b

![Copy Comp Name](images/copy-comp-name.png " ")

2. Select the navigation menu from the top left corner of the Oracle Cloud Console and navigate to the ATP page in the Oracle Database section.
2. Select the navigation menu from the top left corner of the Oracle Cloud Console and navigate to "Oracle Database" and then, on the right, click "Autonomous Transaction Processing" (ATP) .

![Select component instances](images/select-compute-instances.png " ")
![Select component instances](images/oracledatabase-ociconsole.png " ")

3. Search for compartment using the compartment name from step#1 in the "Compartment" field under "List Scope".

Expand All @@ -35,34 +35,70 @@ Your own Oracle Cloud Infrastructure compartment for running this workshop has b

![Enter correct component name](images/correct-comp-name.png " ")

5. Select your database from the list and explore!
5. Select your pre-provisioned database from the list and explore!



## Task 2: Launch the Cloud Shell

Cloud Shell is a small virtual machine running a "bash" shell which you access through the Oracle Cloud Console. Cloud Shell comes with a pre-authenticated command line interface connected to the tenancy. It also provides up-to-date tools and utilities.

1. Click the Cloud Shell icon in the top-right corner of the Console.
1. Verify you are in the correct compartment (this was done as part of Task 1).

2. Click the Cloud Shell icon in the top-right corner of the Console.

![Open Cloud Shell](images/open-cloud-shell.png =50%x*)

3. Make sure you're using X86_64 as your target architecture. Click Actions, then click Architecture.

![Cloud Shell Architecture](../setup/images/cloud-shell-architecture.png "cloud shell architecture")

4. Select the *X86_64* radio button, then click the *Confirm* button if it was not already selected as the default architecture.

![Cloud Shell Confirmation](../setup/images/cloud-shell-confirmation.png "cloud shell confirmation")

>**Note**: Cloud Shell uses websockets to communicate between your browser and the service. If your browser has websockets disabled or uses a corporate proxy that has websockets disabled you will see an error message ("An unexpected error occurred") when attempting to start Cloud Shell from the console. You also can change the browser cookies settings for a specific site to allow the traffic from *.oracle.com
## Task 3: Download the wallet of your pre-provisioned ATP instance
## Task 3: Download the wallet of your pre-provisioned ATP instance (used to make connections in the Java/GraalVM app)

1. Create a directory to hold the wallet files...

1. Copy the compartment-id and database name from the workshop reservation page described in the "Get Started" lab and issue the following command in the Cloud Shell using those values.
```
<copy>
mkdir ~/myatpwallet
</copy>
```
oci db autonomous-database list --compartment-id <your-compartment-ocid> --display-name "<ATP_NAME>"
2. This command should return the ocid of the database which you can use, along with an arbitrary `wallet-password` to run the following command to download the database wallet to the file location provided.
2. Copy the database ocid from the workshop reservation page described in the "Get Started" lab and issue the following command in the Cloud Shell. Use the ocid as the `autonomous-database-id` and arbitrary values for the `file` and (wallet) `password`.
oci db autonomous-database generate-wallet --autonomous-database-id <ATP_OCID> --file ~/myatpwallet.zip --password <wallet-password>
```
<copy>
oci db autonomous-database generate-wallet --autonomous-database-id <ATP_OCID> --file ~/myatpwallet/myatpwallet.zip --password <wallet-password>
</copy>
```
2. Finally, unzip it the wallet file to a directory such as ~/myatpwallet (this wallet/directory will be used to make connections in the Java/GraalVM app)
3. Finally, unzip it the wallet file to a directory such as...
```
<copy>
cd ~/myatpwallet ; unzip myatpwallet.zip ; cd ~
</copy>
```
> **Note:** Cloud Shell sessions have a maximum length of 24 hours, and time out after 20 minutes of inactivity.
## Task 4: Clone the GitHub source code repos
1. Clone the src...
```
<copy>
git clone https://github.com/oracle-devrel/microservices-datadriven.git
</copy>
```
You may now proceed to the next lab.
Expand Down
42 changes: 18 additions & 24 deletions microservices-with-converged-db/springboot/springboot.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,38 @@ This lab assumes you have:
- Provisioned environment with Git and Maven (Cloud Shell).


## Task 1: Clone the repos
## Task 1: Cd to project dir and build the project

1. Clone the following repos:
1. Open Cloud Shell and make sure you're using X86_64 as your target architecture as was done during the setup lab

```
<copy>
git clone https://github.com/juarezjuniorgithub/jdbc-driver-graalvm-nativeimage.git
</copy>
```
2. Cd to the following directory of the repos you cloned during setup. For example, if you cloned to your user's $HOME directory:

And cd into the directory...
```
<copy>
cd jdbc-driver-graalvm-nativeimage
cd $HOME/microservices-datadriven/graalvm-nativeimage/springboot
</copy>
```
```
## Task 2: Build and run
1. To ensure that the sample application is configured to talk to the
Oracle ATP database running in OCI, verify that the
following lines (among others) are set to correct values in
`src/main/resources/META-INF/microprofile-config.properties`:
1. Edit src/main/java/com/oracle/jdbc/graalvm/GraalVMNativeImageJDBCDriver.java to include appropriate values for URL, user, and password such as the following.
Replace values with those found in the workshop `Reservation Information` page and the explicit home directory path as appropriate...
```properties
javax.sql.DataSource.example.connectionFactoryClassName=oracle.jdbc.pool.OracleDataSource
javax.sql.DataSource.example.URL=jdbc:oracle:thin:@<tnsServiceName>?TNS_ADMIN=/path/to/wallet
javax.sql.DataSource.example.user=ADMIN
javax.sql.DataSource.example.password=<password>
```java
//notice the servicename suffix appended, which can be _high, _low, ...
ods.setURL("jdbc:oracle:thin:@${ATP Name}_high?TNS_ADMIN=/home/${MY_HOME_DIR}/myatpwallet");
ods.setUser("ADMIN");
ods.setPassword("[ATP Admin Password]");
```

*Note that the values of the password and path to wallet are those that were collected during setup.
*Again note that the values of the password and path to wallet are those that were collected during setup.

2. Build and run
2. Build and run the following and notice the `Hello World!` output after startup, indicating a connection has been made to the ATP instance

```
<copy>
mvn clean package exec:java -Dexec.mainClass="com.oracle.jdbc.graalvm.App"
mvn clean package exec:java -Dexec.mainClass="com.oracle.jdbc.graalvm.GraalVMNativeImageJDBCDriver"
</copy>
```
Expand All @@ -62,10 +56,10 @@ This lab assumes you have:
```
<copy>
mvn -Pnative packagemvn -Pnative package
mvn -Pnative package
</copy>
```
This will take a bit of time to complete. On the order of 10 or 15 minutes. When complete, run the native image generated...
```
<copy>
Expand Down

0 comments on commit 3935025

Please sign in to comment.