Skip to content

Commit

Permalink
WMS ID 11778 - new Lab - initial version (#751)
Browse files Browse the repository at this point in the history
* global-microservices-jakartadata-nosql

* feat: start update the introduction

Signed-off-by: Otavio Santana <[email protected]>

* feat: update introduction

Signed-off-by: Otavio Santana <[email protected]>

* feat: update movie-stream.md

Signed-off-by: Otavio Santana <[email protected]>

* docs: update movie-stream

Signed-off-by: Otavio Santana <[email protected]>

* docs: update run-nosql-app

Signed-off-by: Otavio Santana <[email protected]>

* docs: update documentation

Signed-off-by: Otavio Santana <[email protected]>

* feat: create section of Eclipse JNoSQL, Jakarta NoSQL Jakarta data

Signed-off-by: Otavio Santana <[email protected]>

* docs: include introduction to Eclipse JNosql

Signed-off-by: Otavio Santana <[email protected]>

* chore: define an option to gitignore

Signed-off-by: Otavio Santana <[email protected]>

* feat: update query table

Signed-off-by: Otavio Santana <[email protected]>

* feat: update the authors documentation

Signed-off-by: Otavio Santana <[email protected]>

* docs: update populate table

Signed-off-by: Otavio Santana <[email protected]>

* chore: update structure

Signed-off-by: Otavio Santana <[email protected]>

* feat: update book structure

Signed-off-by: Otavio Santana <[email protected]>

* feat: update sql properties

Signed-off-by: Otavio Santana <[email protected]>

* feat: update run-nosql app

Signed-off-by: Otavio Santana <[email protected]>

* docs: explain about the entity

Signed-off-by: Otavio Santana <[email protected]>

* docs: description of repository

Signed-off-by: Otavio Santana <[email protected]>

* V0 for discussion

* V0 reviewed

* V1

* Update setup-environment.md

* QA - excluding Grammar Review

* Update introduction.md

* QA grammar

* Update run-nosql-app-container.md

* QA - title modification

---------

Signed-off-by: Otavio Santana <[email protected]>
Co-authored-by: Otavio Santana <[email protected]>
  • Loading branch information
dario-vega and otaviojava authored Jan 23, 2025
1 parent 0b09740 commit 4c8d235
Show file tree
Hide file tree
Showing 82 changed files with 1,639 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
**/*.bin
*.patch
env.sh
.vscode
.vscode
.idea
96 changes: 96 additions & 0 deletions global-microservices-jakartadata-nosql/clean-up/clean-up.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Clean Up

## Introduction

This lab is completed. We will delete all resources created.

_Estimated Time:_ 5 minutes

## Task 1: Delete resources created using Cloud Shell

In this task we will delete the resource created using the Cloud Shell.

1. Open the **Cloud Shell** in the top-right menu to get the Cloud Shell started.

![Cloud Shell](https://oracle-livelabs.github.io/common/images/console/cloud-shell.png)

2. Execute the following in your Cloud Shell. This is issuing a **table delete** command to delete the Movie table.

```
<copy>
source ~/books-management/env.sh
oci nosql table delete --compartment-id "$OCI_NOSQL_COMPID" --table-name-or-id books \
--wait-for-state SUCCEEDED --wait-for-state FAILED
</copy>
```
```
<copy>
cd $HOME
rm -rf books-management
rm -rf books-management.zip
rm -rf jdk-21.0.5
</copy>
```
3. Exit from Cloud Shell.
## Task 2: Delete resources created using Console
This task deletes the resources that got created.
1. On the Oracle Cloud Infrastructure menu drop-down on the top left corner, go to **Databases**, then under Oracle NoSQL Database, hit 'Tables',
set your compartment to 'demonosql', click on the Test table, which will bring up the table details screen. Click Delete.
![Table](./images/delete-test-table.png)
Deleting tables is an async operation, so you will not immediately see the results on the OCI console. Eventually the status of the table will get changed to deleted.
2. On the Oracle Cloud Infrastructure menu drop-down on the top left corner, go to **Developer Services** and then Containers & Artifacts - Container Instances.
In the Container instance screen, click on the container with the name `Book Management Catalog with OCI and NoSQL`. Under 'More actions' click on Delete.
![Delete Container Instance](./images/delete-ci.png)
Wait until the status changed from 'Deleting' to 'Deleted'.
![Delete Container Instance](./images/delete-ci-2.png)
## Task 3: Delete resources created using Resource Manager - Terraform
1. Clean up from the deployment. In the top left corner, hit the OCI drop-down menu, then go to 'Developer Services' and then Stacks under Resource manager.
![Select Resource Manager Stacks](https://oracle-livelabs.github.io/common/images/console/developer-resmgr-stacks.png)
2. In the Stacks screen, click on the stack with the name global-microservices-springdata-nosql.zip-xxxxxx.
![Stack](./images/main-zip.png)
3. This will bring you to the stacks detail page. On this screen, click the 'Destroy' button. This will then pop up another window where you will have to hit 'Destroy' again. This process takes 1-2 minutes to run and clean everything up.
![Destroy Stack](./images/destroy-stack.png)
4. When the "destroy-job" task shows Succeeded, return to the stack page.
5. Click on more actions and delete stack.
![Delete Stack](./images/destroy-stack-2.png)
## Task 4: Delete the compartment created
1. Remove the 'demonosql' compartment. On the Oracle Cloud Infrastructure menu drop-down on the top left corner, go to **Identity and Security** then **Compartments** under 'Identity.'
![Delete Compartment](https://oracle-livelabs.github.io/common/images/console/id-compartment.png)
2. The 'Compartments' screen appears. Click the **demonosql** compartment
![Select demo NoSQL table](./images/select-demonosql.png)
3. Press the **Delete** button. This will fire off a job that runs asynchronously. It takes a while.
![Delete NoSQL Table](./images/delete-demonosql.png)
## Acknowledgements
* **Author** - Dario Vega, Product Manager, NoSQL Product Management
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.
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Set Up Global Active Tables

## Introduction

This lab picks up where Lab 4 left off. You are going to setup a GAT configuration,
and deploy your application in multiple regions. Oracle NoSQL Global Active Tables
provide active-active replication of table data between geographically separated regions.

_Estimated Time:_ 20 minutes

### Objectives

* GAT Offers low-latency local access to data irrespective of where the data originated.

### Prerequisites

* An Oracle Free Tier, Paid Account or Green Button.
* Connection to the Oracle NoSQL Database Cloud Service.
* Working knowledge of bash shell.


## Task 1: Create a GAT

Before deploying the application in multiple regions, we will create replicas for the `book` table.

1. On the Oracle Cloud Infrastructure menu drop-down on the top left corner, go to **Databases**. Under Oracle NoSQL Databases, click **Tables**.
Click the **books** table. Under **Resources**, click **Replicas**.
The list of replicas already created in the table is listed. In our case, the list start empty
![list-replicas](./images/list-replicas.png)

2. Click on `Add replica` button.

3. Choose a Replication region from the list. It does not matter which one is selected. Other information does not need to be changed for this LiveLab. Click **Add Replica**.

![add-replica](./images/add-replica.png)

4. Wait few seconds until the deployment is created - Status will change from Updating to Active. Any data that was in the originating table (the table created in Lab 2) will be immediately pushed to the newly created replica.

![list-replicas](./images/list-replicas-with-new.png)

Click on the link for the `replica` added. It will open a new Tab with the information for the region selected.

5. You can query the table created as we learned in lab 3. You will have exactly the same data in both regions.

![ashburn-replica](./images/ashburn-replica-table.png)

6. Modify a row in a region and query in the other region to verify that the changes got pushed to the other region.


## Task 2: Set up the Book Management Catalog Microservice in the New Region

We are going to set up the Movie Stream Microservice in the new region and follow similar steps to what we used in **Lab 3 - Run the Movie Stream Catalog Microservice.**

1. Make sure you are in the region where you added your replica. Let's get into the Cloud Shell from that region.

![Cloud Shell](https://oracle-livelabs.github.io/common/images/console/cloud-shell.png)

2. Execute the following environment setup shell script in the Cloud Shell to
set up your environment. If you close/open the Cloud Shell Console, please re-execute it.

```shell
<copy>
export NOSQL_DEPLOYMENT=CLOUD_INSTANCE_OBO_USER
source ~/books-management/env.sh
</copy>
```
![Cloud Shell Result](./images/cloud-shell-result.png)

3. Set the JAVA HOME to use JDK 21 as the current JDK.

```shell
<copy>
export JAVA_HOME=`pwd`/jdk-21.0.5
</copy>
```

## Task 3: Start the Book Management Catalog Microservice and look at data

1. Use the following maven wrapper command to start the Spring application. Execute in the Cloud Shell.

```shell
<copy>
cd ~/books-management/
nohup $JAVA_HOME/bin/java -jar target/books.jar &
</copy>
```
**Note:** This will start the "book" application in the background.

2. After you complete step 1, you can use the command tail to see the startup for the application.

![appl-running](./images/appl-running.png)

```shell
<copy>
tail nohup.out
</copy>
```
The `mvnw` command will compile and start the application, please wait for the message *Started DemoApplication in xx seconds*

3. Let us review the data created in the prior Labs. Execute in the Cloud Shell.

```shell
<copy>
curl http://localhost:8080/books | jq
</copy>
```

4. Stop the application and delete temporary files

execute the linux command `fg` followed by CTRL-C and enter to stop the application.
```shell
<copy>
fg
</copy>
```
Note: you can rexecute the command `fg` to validate that there are not jobs running in background.

Delete the temporary files created.
```shell
<copy>
rm nohup.out result-test.txt
</copy>
```

5. Close the tab for the remote region.


Adding a new region and starting up the application in that region is a straight forward process. You can use the same process to extend to more regions. You can also use the application to insert new data into your replicated region and verify that data got properly transmitted to the other region.

## Task 4: Delete a remote region


This task deletes the resources that got created. Ensure you are back in your original region.

1. On the Oracle Cloud Infrastructure menu drop-down on the top left corner, go to click **Databases**. Under Oracle NoSQL Databases, click Tables. Click the Movie table. Under Resources, click Replicas.
The list of replicas already created in the table is listed. Click on delete

![Delete Region](./images/delete-region-table.png)

Deleting tables is an async operation, the status will get changed to deleting. Wait for the end of this operation.



You may now **proceed to the next lab.**

## Learn More


* [Oracle NoSQL Database Cloud Service page](https://www.oracle.com/database/nosql-cloud.html)
* [Global Active Tables in NDCS](https://docs.oracle.com/en/cloud/paas/nosql-cloud/gasnd/)


## Acknowledgements
* **Author** - Dario Vega, Product Manager, NoSQL Product Management
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.
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

0 comments on commit 4c8d235

Please sign in to comment.