Skip to content

Commit

Permalink
many updates to support google cloud.
Browse files Browse the repository at this point in the history
  • Loading branch information
martygubar committed Dec 11, 2024
1 parent dfaaa64 commit 574ed2a
Show file tree
Hide file tree
Showing 19 changed files with 267 additions and 85 deletions.
6 changes: 5 additions & 1 deletion multicloud/azure-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Oracle Database@Azure: Create an Autonomous Database
There are different ways that you can deploy a new Oracle Autonomous Database:
* [Using the Azure Portal](https://youtu.be/QOCvRr5CfeQ)
* [Using Terraform scripts](https://github.com/oci-landing-zones/terraform-oci-multicloud-azure/tree/main)
* [Using Terraform scripts](https://github.com/oci-landing-zones/terraform-oci-multicloud-azure)
* Using the Azure CLI

The steps below show how to create an Autonomous Database using the Azure CLI.
Expand Down Expand Up @@ -29,6 +29,8 @@ You can run the scripts independently or run `create-all-resources.sh`. Simply u
|[create-all-resources.sh](create-all-resources.sh)|Creates your resource group, network, ADB and VM|
|[create-data-lake-storage.sh](create-data-lake-storage.sh)|Creates an Azure Data Lake Gen 2 storage account, a container and uploads sample data into that container|
|[delete-all-resources.sh](delete-all-resources.sh)|Deletes your resource group, network, ADB and VM|
|[show-adb-info.sh](show-adb-info.sh)|Shows information about your ADB - including you JDBC connection details to the HIGH service|
|[show-data-lake-storage-info.sh](show-data-lake-storage-info.sh)|Shows information about your data lake storage - including the storage endpoint URL|

### Configuration file
The Azure cli deployment scripts rely on settings found in the config file. These resources **will be created** by the scripts. Update the config file prior to running any of the scripts.
Expand Down Expand Up @@ -80,6 +82,8 @@ Connect to your Autonomous Database!
* Use these great VS Code extensions that help you develop and debug your database apps:
* SQL Developer for VS Code ([Learn More](https://www.oracle.com/database/sqldeveloper/vscode/) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.sql-developer))
* Oracle Developer Tools for VS Code ([Learn More](https://docs.oracle.com/en/database/oracle/developer-tools-for-vscode/getting-started/gettingstarted.html) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.oracledevtools))
* [Use the sample scripts](../../sql/README.md) to learn how to use different features - like Select AI, data lake integration, JSON, and more.


#### JDBC Example:
JDBC is a common way to connect to Autonomous Database. For example, you can use the **Custom JDBC URL** in the VS Code SQL Developer Extension:
Expand Down
33 changes: 22 additions & 11 deletions multicloud/azure-cli/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,49 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

# update the values below to match your requirements
LOCATION="eastus"
RESOURCE_GROUP="development"
# Region and resource groupwhere resources are deployed
# example: eastus
LOCATION=""
RESOURCE_GROUP=""
ADB_NAME="quickstart"

## NETWORKING
# database
VNET_NAME="dev-vnet"
VNET_PREFIX="19x.xxx.0.0/16"
# example: dev-vnet
VNET_NAME=""
# example: 192.168.0.0/16
VNET_PREFIX=""

# subnet for the database
SUBNET_NAME="dev-sn-db"
SUBNET_PREFIX="19x.xxx.1.0/24"
# example: dev-sn-db
SUBNET_NAME=""
# example: 192.168.1.0/24
SUBNET_PREFIX=""

# client subnet
SUBNET2_NAME="dev-sn-client"
SUBNET2_PREFIX="19x.xxx.2.0/24"
# example: dev-sn-client
SUBNET2_NAME=""
# example: 192.168.2.0/24
SUBNET2_PREFIX=""

#network security group
NSG_NAME=$SUBNET2_NAME-nsg

## COMPUTE VM
VM_NAME="adb-vm-client"
# example: adb-vm-client
VM_NAME=""
VM_PREFERRED_SIZES=( "Standard_DS3_v2" "Standard_DC1s_v2" "Standard_DC2s_v2" "Standard_DC2ads_v5" "Standard_L4s" )
VM_IMAGE="MicrosoftWindowsDesktop:Windows-11:win11-22h2-pro:latest"

## CLOUD STORAGE
# Storage accounts require a unique name across azure. Enter your unique name below.
STORAGE_ACCOUNT_NAME="your-storage-account"
# example: devadbstorageacct
STORAGE_ACCOUNT_NAME=""
STORAGE_CONTAINER_NAME="adb-sample"

## IDENTITIES
# This identity will be used for your VM. The password will also be used for the database ADMIN user
USER_NAME="adb"
--The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
# The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
# example: watchS0meMovies#
USER_PASSWORD=""
33 changes: 22 additions & 11 deletions multicloud/azure-cli/config.default
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,49 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

# update the values below to match your requirements
LOCATION="eastus"
RESOURCE_GROUP="development"
# Region and resource groupwhere resources are deployed
# example: eastus
LOCATION=""
RESOURCE_GROUP=""
ADB_NAME="quickstart"

## NETWORKING
# database
VNET_NAME="dev-vnet"
VNET_PREFIX="19x.xxx.0.0/16"
# example: dev-vnet
VNET_NAME=""
# example: 192.168.0.0/16
VNET_PREFIX=""

# subnet for the database
SUBNET_NAME="dev-sn-db"
SUBNET_PREFIX="19x.xxx.1.0/24"
# example: dev-sn-db
SUBNET_NAME=""
# example: 192.168.1.0/24
SUBNET_PREFIX=""

# client subnet
SUBNET2_NAME="dev-sn-client"
SUBNET2_PREFIX="19x.xxx.2.0/24"
# example: dev-sn-client
SUBNET2_NAME=""
# example: 192.168.2.0/24
SUBNET2_PREFIX=""

#network security group
NSG_NAME=$SUBNET2_NAME-nsg

## COMPUTE VM
VM_NAME="adb-vm-client"
# example: adb-vm-client
VM_NAME=""
VM_PREFERRED_SIZES=( "Standard_DS3_v2" "Standard_DC1s_v2" "Standard_DC2s_v2" "Standard_DC2ads_v5" "Standard_L4s" )
VM_IMAGE="MicrosoftWindowsDesktop:Windows-11:win11-22h2-pro:latest"

## CLOUD STORAGE
# Storage accounts require a unique name across azure. Enter your unique name below.
STORAGE_ACCOUNT_NAME="your-storage-account"
# example: devadbstorageacct
STORAGE_ACCOUNT_NAME=""
STORAGE_CONTAINER_NAME="adb-sample"

## IDENTITIES
# This identity will be used for your VM. The password will also be used for the database ADMIN user
USER_NAME="adb"
--The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
# The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
# example: watchS0meMovies#
USER_PASSWORD=""
6 changes: 4 additions & 2 deletions multicloud/azure-cli/create-data-lake-storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ az storage account keys list \
--resource-group $RESOURCE_GROUP --query "[0].value" -o tsv

echo "Storage URL:"
az storage account show \
STORAGE_URL=$(az storage account show \
--name $STORAGE_ACCOUNT_NAME \
--query primaryEndpoints.blob \
--output tsv
--output tsv)
echo $STORAGE_URL$STORAGE_CONTAINER_NAME

echo ""
5 changes: 3 additions & 2 deletions multicloud/azure-cli/show-data-lake-storage-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ az storage account keys list \
--account-name $STORAGE_ACCOUNT_NAME \
--resource-group $RESOURCE_GROUP --query "[0].value" -o tsv
echo "Storage URL:"
az storage account show \
STORAGE_URL=$(az storage account show \
--name $STORAGE_ACCOUNT_NAME \
--query primaryEndpoints.blob \
--output tsv
--output tsv)
echo $STORAGE_URL$STORAGE_CONTAINER_NAME
echo ""

77 changes: 43 additions & 34 deletions multicloud/gcloud-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,44 @@
# Oracle Database@Google Cloud: Create an Autonomous Database
There are different ways that you can deploy a new Oracle Autonomous Database:
* [Using the Google Cloud Portal](https://youtu.be/QOCvRr5CfeQ)
* [Using Terraform scripts](https://github.com/oci-landing-zones/terraform-oci-multicloud-azure/tree/main)
* Using the Azure CLI
* [Using the Google Cloud Portal](https://docs.oracle.com/en-us/iaas/ogadb/ogadb-provisioning-autonomous-database.html)
* [Using Terraform scripts](https://github.com/oci-landing-zones/terraform-oci-multicloud-azure)
* Using the Google Command Line Interace (gcloud CLI)

The steps below show how to create an Autonomous Database using the Azure CLI.

The steps below show how to create an Autonomous Database using the gcloud CLI.

## Prerequisites:
* [Install the Azure CLI](https://learn.microsoft.com/en-us/cli/azure/)
* [Subscribe to Oracle Database@Azure](https://www.youtube.com/watch?v=MEB8kB_TI2I)
* Ensure you have the appropriate user groups and privileges. See [details for onboarding Autonomous Database](https://learn.microsoft.com/en-us/azure/oracle/oracle-db/onboard-oracle-database)
* [Install the gcloud CLI](https://cloud.google.com/sdk/docs/install)
* [Onboard Oracle Database@Google Cloud](https://docs.oracle.com/en-us/iaas/Content/database-at-gcp/oagcp-onboard.htm#oagcp_onboard). Onboarding includes subscribing to the service using a Pay as You Go or private offer, setting up permissions, and more.

## Deploy your Autonomous Database and your infrastructure
Use the following scripts to deploy your infrastructure and Autonomous Database:
The gcloud CLI scripts will deploy the following infrastructure:
* A VPC Network with a client subnet
* An Oracle Autonomous Database. It is deployed to a private subnet on that VPC Network. That private subnet is managed by Oracle Database@Google Cloud.
* A Windows-based Virtual Machine is deployed to the client subnet. You can RDP to that VM to develop your apps and access Autonomous Database.
* A Cloud Storage bucket with sample data
* Sample code will use Google Gemini. Ensure the API is enabled.


![deployment](../images/gcloud-deployment.png)

![deployment](../images/azure-deployment.png)
**Note:** Gemini is used by the samples - but the scripts do not set up access to the resource. See the [Generative AI on Vertex Quickstart](https://cloud.google.com/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal?authuser=1)

**Note:** Azure OpenAI is used by the samples - but the scripts do not deploy the resource.
f
You can run the scripts independently or run `create-all-resources.sh`. Simply update the [`config`](#configuration-file) prior to running the scripts:

|Script|Description|
|----|---|
|[create-resource-group.sh](create-resource-group.sh)|Create a resource group|
|[create-network.sh](create-network.sh)|Create virtual cloud network. <br><br>ADB must be deployed to a delegated subnet. In addition, ADB access is thru a private endpoint. This means it must be accessed from either the same VCN or another privileged network.|
|[create-network.sh](create-network.sh)|Creates a VPC Network and subnet with required firewall rules. ADB is accessed thru a private endpoint on this network. The VM is deployed to this network and can be used to work with ADB.|
|[create-adb.sh](create-adb.sh)|Create an Autonomous Database|
|[create-compute-vm.sh](create-compute-vm.sh)|Create a VM in that VCN|
|[create-all-resources.sh](create-all-resources.sh)|Creates your resource group, network, ADB and VM|
|[create-data-lake-storage.sh](create-data-lake-storage.sh)|Creates an Azure Data Lake Gen 2 storage account, a container and uploads sample data into that container|
|[create-compute-vm.sh](create-compute-vm.sh)|Create a VM in that VPC. By default, a Windows VM is created and can be accessed via RDP. After running this script, you can set up the password by running: <br>`source config`<br>`gcloud compute reset-windows-password $VM_NAME --zone=$REGION-a`|
|[create-all-resources.sh](create-all-resources.sh)|Creates your network, ADB, VM and Cloud Storage bucket.|
|[create-data-lake-storage.sh](create-data-lake-storage.sh)|Creates a bucket on Cloud Storage and uploads sample data into that bucket|
|[delete-all-resources.sh](delete-all-resources.sh)|Deletes your resource group, network, ADB and VM|
|[show-adb-info.sh](show-adb-info.sh)|Shows information about your ADB - including you JDBC connection details to the HIGH service|
|[show-data-lake-storage-info.sh](show-data-lake-storage-info.sh)|Shows information about your data lake storage - including the storage endpoint URL|

### Configuration file
The Azure cli deployment scripts rely on settings found in the config file. These resources **will be created** by the scripts. Update the config file prior to running any of the scripts.
The gcloud CLI deployment scripts rely on settings found in the config file. These resources **will be created** by the scripts. Update the config file prior to running any of the scripts.

>**IMPORTANT:** This file will contain a password that is used to connect to Autonomous Database and the virtual machine. Set the file's permissions so that only the file's owner can view its contents:
```bash
Expand All @@ -40,30 +47,30 @@ chmod 600 config

|Setting|Description|Example|
|----|----|----|
|LOCATION|Region where resources will be deployed. [See documentation](https://docs.oracle.com/en-us/iaas/Content/database-at-azure/oaa_regions.htm) for regions where Oracle Database 23ai is available|"eastus"|
|RESOURCE_GROUP|Target resource group for new resources|"development"|
|REGION|Region where resources will be deployed. [See documentation](https://docs.oracle.com/en-us/iaas/Content/database-at-gcp/oagcp-regions.htm) for region availability|"us-east4"|
|PROJECT|Target Google Cloud project for new resources|"development"|
|USER_PASSWORD|The password for the Autonomous Database admin user|"watchS0meMovies#"|
|ADB_NAME|Autonomous Database name. This name must be unique within a region location|"quickstart"|
|VNET_NAME|Virtual network|"dev-vnet"|
|SUBNET_DB_IP_RANGE|IP address range used for ADB. It can not overlap with the client subnet range. It can overlap with other ADB instances.|"192.168.11.0/24"|
|VPC_NETWORK_NAME|Name of the VPC Network|"dev-network"|
|VNET_PREFIX|CIDR range for the virtual network|"192.168.0.0/16"|
|SUBNET_NAME|Delegated subnet where the database will be deployed|"dev-sn-db"|
|SUBNET_PREFIX|CIDR range for the delegated subnet|"192.168.1.0/24"|
|SUBNET2_NAME|Client subnet. The VM will be deployed to this subnet|"dev-sn-client"|
|SUBNET2_PREFIX|CIDR range for the client subnet|"192.168.2.0/24"|
|NSG_NAME|Name of the network security group used by the client subnet|$SUBNET2_NAME-nsg|
|VM_NAME|Name of the virtual machine|"adb-vm-client"|
|VM_PREFERRED_SIZES|A list of VM sizes. Change these values based on region availability. The script will attempt to create a VM based on the order listed|( "Standard_GS1" "Standard_DC1s_v2" "Standard_DC2s_v2" "Standard_DC2ads_v5" "Standard_L4s" )|
|VM_IMAGE|The image used by the VM|"MicrosoftWindowsDesktop:Windows-11:win11-22h2-pro:latest"|
|STORAGE_ACCOUNT_NAME|The name of an Azure Data Lake Storage Gen 2 account. This name must be unique across Azure. Sample data files will be uploaded into this storage account.|"mytenancysamplestorageaccount"|
|STORAGE_CONTAINER_NAME|The name of the container where files will be uploaded|"adb-sample"|
|USER_NAME|The name of the user for the virtual machine|"adb"|
|USER_PASSWORD|The password for both the VM and the Autonomous Database admin user|"Welcome1234#abcd"|
|SUBNET_CLIENT_NAME|Name of the client subnet where the VM is deployed|"dev-sn-client"|
|SUBNET_CLIENT_IP_RANGE|CIDR range for the client subnet|"192.168.10.0/24"|
|VM_NAME|Name of the virtual machine|"dev-vm-client"|
|VM_IMAGE_FAMILY|The image deployed to the VM |"windows-2022"|
|VM_MACHINE_TYPE|The type of VM deployed|"e2-standard-4"|
|BUCKET_NAME|The name of the cloud storage bucket where sample files will be uploaded.|"adb-sample-quickstart"|


### Using the scripts
Log into azure: after updating the config file:
Make sure that you have enabled APIs for your project. [See the documentation](https://cloud.google.com/endpoints/docs/openapi/enable-api) for details.

Log into Google Cloud from the CLI:
```bash
az login
gcloud auth login
```

Update the config file
Then, run your scripts. The following will deploy a complete environment, but you can also install independent components. Just make sure you install dependencies (e.g. a VCN prior to Autonomous Database):

Creating all of the resources will take approximately 15-20 minutes.
Expand All @@ -80,6 +87,8 @@ Connect to your Autonomous Database!
* Use these great VS Code extensions that help you develop and debug your database apps:
* SQL Developer for VS Code ([Learn More](https://www.oracle.com/database/sqldeveloper/vscode/) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.sql-developer))
* Oracle Developer Tools for VS Code ([Learn More](https://docs.oracle.com/en/database/oracle/developer-tools-for-vscode/getting-started/gettingstarted.html) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.oracledevtools))
* [Use the sample scripts](../../sql/README.md) to learn how to use different features - like Select AI, data lake integration, JSON, and more.


#### JDBC Example:
JDBC is a common way to connect to Autonomous Database. For example, you can use the **Custom JDBC URL** in the VS Code SQL Developer Extension:
Expand Down
46 changes: 46 additions & 0 deletions multicloud/gcloud-cli/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (c) 2024 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

# update the values below to match your requirements
# example: us-east4
REGION=""
PROJECT=""

## IDENTITIES
# The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
# example: watchS0meMovies#
USER_PASSWORD=""

## ADB properties
# Database name. This will be used for the display name as well.
ADB_NAME="quickstart"

# ADB IP range. It can not overlap with the client subnet range
# example: 192.168.11.0/24
SUBNET_DB_IP_RANGE=""

## NETWORKING
# public client network
# example: dev-network
VPC_NETWORK_NAME=""

# names firewall rules
VPC_FIREWALL_INGRESS_NAME="allow-common-ingress-ports"
VPC_FIREWALL_EGRESS_NAME="allow-client-egress-ports"

# client subnet
# example: dev-sn-client
SUBNET_CLIENT_NAME=""
# example: 192.168.10.0/24
SUBNET_CLIENT_IP_RANGE=""

## COMPUTE VM
# example: dev-vm-client
VM_NAME=""
VM_IMAGE_FAMILY="windows-2022"
VM_MACHINE_TYPE="e2-standard-4"

## CLOUD STORAGE
# Storage bucket require a unique name across google. Enter your unique name below.
# example: adb-sample-quickstart
BUCKET_NAME=""
46 changes: 46 additions & 0 deletions multicloud/gcloud-cli/config.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (c) 2024 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

# update the values below to match your requirements
# example: us-east4
REGION=""
PROJECT=""

## IDENTITIES
# The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
# example: watchS0meMovies#
USER_PASSWORD=""

## ADB properties
# Database name. This will be used for the display name as well.
ADB_NAME="quickstart"

# ADB IP range. It can not overlap with the client subnet range
# example: 192.168.11.0/24
SUBNET_DB_IP_RANGE=""

## NETWORKING
# public client network
# example: dev-network
VPC_NETWORK_NAME=""

# names firewall rules
VPC_FIREWALL_INGRESS_NAME="allow-common-ingress-ports"
VPC_FIREWALL_EGRESS_NAME="allow-client-egress-ports"

# client subnet
# example: dev-sn-client
SUBNET_CLIENT_NAME=""
# example: 192.168.10.0/24
SUBNET_CLIENT_IP_RANGE=""

## COMPUTE VM
# example: dev-vm-client
VM_NAME=""
VM_IMAGE_FAMILY="windows-2022"
VM_MACHINE_TYPE="e2-standard-4"

## CLOUD STORAGE
# Storage accounts require a unique name across google. Enter your unique name below.
# example: adb-sample-quickstart
BUCKET_NAME=""
1 change: 1 addition & 0 deletions multicloud/gcloud-cli/create-data-lake-storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ gcloud storage ls --long --recursive gs://$BUCKET_NAME

echo ""
echo "Bucket Name: $BUCKET_NAME"
gcloud storage hmac list
echo "Storage URL:"
echo "https://storage.googleapis.com/$BUCKET_NAME"
Loading

0 comments on commit 574ed2a

Please sign in to comment.