Skip to content

Commit

Permalink
WMS ID 11632- first version (#562)
Browse files Browse the repository at this point in the history
* global-microservices-springdata-nosql v0

* adding sandbox - using the latest template

* Update manifest.json

* Update movie-stream-demo.md

doing a test to see if Dario can see it.

* QA - First Review

* wording changes on Intro.md

changes to lab1 intro and lab 2

* wording changes on Intro.md (#2)

changes to lab1 intro and lab 2

* Restructure LiveLab after DryRun

* Minor modification after reorg.

* wording change review

many small changes across files

* Preparing for final version

* Update link doc GAT

---------

Co-authored-by: Michael Brey <48066113+mikebrey@users.noreply.github.com>
  • Loading branch information
dario-vega and mikebrey authored Jul 4, 2024
1 parent 6461ae1 commit a87d505
Show file tree
Hide file tree
Showing 86 changed files with 2,218 additions and 0 deletions.
82 changes: 82 additions & 0 deletions global-microservices-springdata-nosql/clean-up/clean-up.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Clean Up

## Introduction

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

_Estimated Time:_ 5 minutes

## Task 1: Delete resources created using Cloud Shell

In this task we will deleted 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.

```
<copy>
source ~/global-microservices-springdata-nosql/env.sh
oci nosql table delete --compartment-id "$OCI_NOSQL_COMPID" --table-name-or-id Movie \
--wait-for-state SUCCEEDED --wait-for-state FAILED
</copy>
```
```
<copy>
cd $HOME
rm -rf global-microservices-springdata-nosql
rm -rf global-microservices-springdata-nosql.zip
</copy>
```
3. Exit from Cloud Shell.
## Task 2: Delete resources created using Console
This task deletes the resources that got created.
1. On the top left, go to menu, then 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. Hit 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 tables will get changed to deleted.
2. On the top left, go to menu, then Developer Services and then Containers & Artifacts - Container Instances.
In the Container instance screen, click on the container with the name `Creating Scalable, Global Microservices with OCI, Spring Data, 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 that screen hit 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 task will show Succeeded, return to the stack page.
5. Click on more actions and delete stack.
![Delete Stack](./images/destroy-stack-2.png)
## Acknowledgements
* **Author** - Dario Vega, Product Manager, NoSQL Product Management and Michael Brey, Director, NoSQL Product Development
* **Last Updated By/Date** - Dario Vega, Product Manager, NoSQL Product Management, Michael Brey, Director, NoSQL Product Development July 2024
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,160 @@
# Setup 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 multi-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 `movie` table.

1. From the hamburger menu, 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. 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 second 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 Movie Stream 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. Let's get back into the Cloud Shell. We will execute in the tab on the remote 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 OCI_obo_token=$(cat $OCI_obo_token_path)
source ~/global-microservices-springdata-nosql/env.sh
</copy>
```
![Cloud Shell](./images/cloud-shell-result.png)

3. List the installed JDKs using the `csruntimectl java list` command. Select GraalVM for JDK 17 as the current JDK.

```shell
<copy>
csruntimectl java list
</copy>
```

```shell
<copy>
csruntimectl java set graalvmjdk-17
</copy>
```

## Task 3: Start the Movie Stream 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 ~/global-microservices-springdata-nosql/code-nosql-spring-sdk/
nohup ./mvnw spring-boot:run &
</copy>
```
**Note:** This will start the "movie" 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. Lets review the data created in the prior Labs. Execute in the Cloud Shell.

```shell
<copy>
curl http://localhost:8080/api/movie | 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>
```
NB: 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 standing up the application in that region is a straight forward process. You could use the same process to extend to even more regions. You can also use the application to insert new data into your replicated region and look to see that it got properly transmitted to the other region.

## Task 4: Delete a remote region


This task deletes the resources that got created.

1. From the hamburger menu, 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, Michael Brey, Director, NoSQL Product Development
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 a87d505

Please sign in to comment.