Skip to content

Commit 9ec32be

Browse files
committed
Updated Cloud Deployment Scripts to next version
1 parent d157202 commit 9ec32be

File tree

29 files changed

+1141
-803
lines changed

29 files changed

+1141
-803
lines changed

LICENSE.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
You may not use the identified files except in compliance with the Universal Permissive License, Version 1.0 (the License.)
2+
3+
You may obtain a copy of the License at https://oss.oracle.com/licenses/upl. A copy of the license is also reproduced below.
4+
5+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6+
7+
See the License for the specific language governing permissions and limitations under the License.
8+
9+
Copyright (c) 2018 Oracle and/or its affiliates.
10+
11+
The Universal Permissive License (UPL), Version 1.0
12+
13+
Subject to the condition set forth below, permission is hereby granted to any person obtaining a copy of this software, associated documentation and/or data (collectively the Software), free of charge and under any and all copyright rights in the Software, and any and all patent rights owned or freely licensable by each licensor hereunder covering either (i) the unmodified Software as contributed to or provided by such licensor, or (ii) the Larger Works (as defined below), to deal in both
14+
15+
(a) the Software, and
16+
17+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if one is included with the Software (each a “Larger Work” to which the Software is contributed by such licensors),
18+
19+
without restriction, including without limitation the rights to copy, create derivative works of, display, perform, and distribute the Software and make, use, sell, offer for sale, import, export, have made, and have sold the Software and the Larger Work(s), and to sublicense the foregoing rights on either these or other terms.
20+
21+
This license is subject to the following condition:
22+
23+
The above copyright notice and either this complete permission notice or at a minimum a reference to the UPL must be included in all copies or substantial portions of the Software.
24+
25+
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cloud/ottscaleout/.checksum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
31f307103a0b52a4b679aee2ad9e314e

cloud/ottscaleout/LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
Terraform and Ansible may be installed from the Development and EPEL repositories available on Oracle's Yum servers.
4+
The repositories contain the following note:
5+
Packages For Test and Development
6+
Note: The contents in the following repositories are for development purposes only. Oracle suggests these not be used in production.
7+
(http://yum.oracle.com/oracle-linux-7.html)
8+
9+
Terraform:
10+
(https://github.com/hashicorp/terraform/blob/master/LICENSE)
11+
12+
Ansible:
13+
(https://github.com/ansible/ansible/blob/devel/COPYING)
14+
15+
Terraform Provider OCI:
16+
(https://docs.cloud.oracle.com/iaas/Content/API/SDKDocs/terraform.htm?Highlight=license)
17+
18+
provisionScaloutOCI, underlying Terraform and Ansible scripts for TimesTen Scaleout:
19+
Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
20+
Licensed under the Universal Permissive License v 1.0 as shown at (http://oss.oracle.com/licenses/upl)
21+

cloud/ottscaleout/README.md

Lines changed: 59 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
###### Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
22
###### Licensed under the Universal Permissive License v 1.0 as shown at <http://oss.oracle.com/licenses/upl>
3-
###### Version v3_180412_18.1.2.0.0
3+
###### Version v4_190716_18.1.0.0.0
44
# ___ ____ _ ____ _ _____
55
# / _ \| _ \ / \ / ___| | | ____|
66
# | | | | |_) | / _ \| | | | | _|
@@ -12,16 +12,16 @@ Ansible scripts are provided to rollout a database across the provisioned infras
1212
This is a bring-your-own-license (BYOL) solution for Oracle TimesTen Scaleout.
1313
Please see the whitepaper, [Deploying Oracle TimesTen Scaleout Database on OCI](https://www.oracle.com/technetwork/database/database-technologies/timesten/overview/wp-deployingtimestenscaleoutonoci-5069015.pdf "whitepaper")
1414

15-
The example creates a VCN with one or more public subnets running bastion hosts.
16-
Private subnets are created to run the hosts needed for TimesTen Scaleout.
15+
The example creates a VCN with one or more regional public subnets running bastion hosts.
16+
A regional private subnet is created to run the hosts needed for TimesTen Scaleout.
1717

1818
***
1919
Deployment diagram. The dark boxes indicate the default configuration created by the Terraform and Ansible scripts.
20-
![Deployment diagram](./images/oci-deployment.png "TimesTen Scaleout Deployment Diagram")
20+
![Deployment diagram](./images/oci-deployment.jpg "TimesTen Scaleout Deployment Diagram")
2121

2222
***
2323

24-
This distribution provides an utility, _provisionScaleoutOCI_, that automates many provisioning tasks discussed in this README and the associated whitepaper. If you already have a compute instance provisioned in the OCI cloud, please see the [QUICKSTART.md](./QUICKSTART.md) file.
24+
This distribution provides an utility, _provisionScaleoutOCI_, that automates many prerequisite tasks discussed in the associated whitepaper. If you already have an Oracle Linux compute instance provisioned in the OCI cloud, you can use that as a bootstrap instance. Please see the [QUICKSTART.md](./QUICKSTART.md) file.
2525

2626
***
2727

@@ -39,39 +39,45 @@ This example uses the same set of environment variables as other terraform examp
3939
To destroy all the resources created
4040
* terraform destroy -force
4141

42-
The route table used for the private subnets is configured to use a NAT gateway as the default route target.
43-
Bastion host instances are configured as NAT instances, by enabling forwarding and configuring firewall to do forwarding/masquerading, but routing occurs through the NAT gateway, not through the private IP addresses of the Bastion hosts.
42+
The route table used for the private subnet is configured to use a NAT gateway as the default route target.
43+
Bastion host instances are configured as NAT instances, by enabling forwarding and configuring firewall to do forwarding/masquerading. For high availability purposes routing occurs through the NAT gateway, but can optionally be configured through the private IP addresses of the Bastion hosts.
4444
See [Using a Private IP as a Route Target](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm#privateip) for more details if you wish to use the private IP routing feature.
4545

46-
Once the environment is built, the compute instances on the private network have Internet connectivity.
47-
A private instance doesn't have a public IP address and it's subnet's route table doesn't contain Internet gateway.
48-
You can login into the private instance via ssh from the Bastion host.
49-
To verify connectivity, you can then run a command like 'ping oracle.com'
46+
Once the environment is built, the compute instances on the regional private subnets have Internet connectivity. A private instance doesn't have a public IP address and it's subnet route table doesn't contain Internet gateway. You can login into the private instance via ssh from the Bastion host.
5047

5148
### Files in the configuration
5249

53-
#### `env-vars`
50+
### `provisionScaleoutOCI`
51+
Utility can be used from an OCI Oracle Linux compute instance to provision TimesTen Scaleout in lieu of manually invoking Terraform and Ansible. Also aids with meeting prerequisites such as creating ssh credentials and/or using the OCI CLI to create an API Signing key. See [QUICKSTART.md](./QUICKSTART.md) for more details. While the utility needs to run on an OCI compute instance, the underlying Terraform and Ansible scripts can be manually invoked from Oracle Linux or macOS systems that can reach the OCI public IP addresses.
52+
53+
### `env-vars`
5454
Is used to export the environmental variables used in the configuration.
5555
These variables include references to private key file information for access to the OCI infrastructure.
5656

5757
Before you plan, apply, or destroy the configuration source the file -
58-
`$ . env-vars`
58+
`$ . env-vars`
59+
60+
### `oci.tf`
61+
Configures terraform provisioner for oci.
5962

60-
#### `variables.tf`
63+
### `variables.tf`
6164
Defines variables for TimesTen Scaleout configuration.
6265
Modify this to change the default TimesTen Scaleout 2x2 configuration created.
6366

64-
### `public.tf`
65-
Creates the VCN, the public subnets, and the compute instances used as bastion hosts.
67+
### `network.tf`
68+
Creates the VCN, IG and NAT gateways, route tables, security lists, regional public and private subnets.
6669

67-
### `private.tf`
68-
Creates the private subnets, and the compute instances used as zookeeper servers, management instances, or database instances.
70+
### `compute.tf`
71+
Creates the compute instances used as bastion hosts, zookeeper servers, management instances, or database instances.
6972

7073
### `system-config.tf`
7174
Contains terraform resources for initial configuration of the compute instances.
72-
Installs ansible on 1 bastion host.
75+
Installs ansible on bastion hosts.
7376
Variables and configuration files for ansible are set up as well.
7477

78+
### `blkvol.tf`
79+
Optionally creates block volumes.
80+
7581
### `service` directory
7682
* ansible - Ansible playbooks and task yaml.
7783
* packages - Required BYOL software: Timesten Scaleout distribution, JDK
@@ -131,8 +137,8 @@ For example, if K==2 and initialAD==2, one data space will be located in AD-2, t
131137
To use only a single AD for data and management instances
132138
* Set singleAD == "true" in variables.tf
133139

134-
Bastion hosts are created in AD-1 by default.
135-
* Set bsInstanceInitialAD=={2|3} to place the bastion host in another AD.
140+
Bastion hosts are created starting in AD-1 by default.
141+
* Set bsInstanceInitialAD=={2|3} to start placing bastion hosts in AD-2 or AD-3.
136142
This may be useful for trial or pay as you go accounts.
137143
For trial or pay-as-you-go accounts set:
138144
* initialAD=(bsInitialInstanceAD % 3) + 1
@@ -142,5 +148,37 @@ For trial or pay-as-you-go accounts set:
142148
To change dbDef (sys.odbc.ini) settings _NOT_ listed in variables.tf, modify the
143149
service/ansible/roles/mgmtinstances/templates/attributes.dbdef.j2 file.
144150

151+
### Troubleshooting:
145152

153+
Errors encountered during provisioning may be transient ones, such as ssh connectivity or port in use errors.
154+
Rather than destroying the configuration, Terraform or Ansible can often be rerun to correct such errors.
155+
Check the output from terraform apply and or ansible for the specific error.
156+
157+
Assuming the (TF_VAR_)service name is 'ttimdb1':
158+
159+
Setup the environment
160+
* `. ./env-vars`
161+
If Terraform failed during apply, to rerun Terraform:
162+
* `terraform apply --auto-approve`
163+
If Terraform succeeds but Ansible failed:
164+
Determine the address of the bastion host by running:
165+
* `terraform output`
166+
Login to the bastion host
167+
* `ssh opc@1.2.3.4`
168+
Move to ansible directory
169+
* `cd service/ansible`
170+
Destroy a potentially partially created database, ignoring errors.
171+
* `ansible-playbook -i hosts dbdestroy.yaml`
172+
Retry Database rollout
173+
* `ansible-playbook -i hosts rollout.yaml 2>&1 | tee rollout.out`
174+
Check Status
175+
* `ansible-playbook -i hosts status.yaml`
176+
To view a failed rollout, log into host running mgmt instance.
177+
* `ssh -tt [ttimdb1-mg-001|ttimdb1-di-001] sudo su - oracle`
178+
* `cat ttimdb1/ttgridrollout.plan`
179+
* `cat ttimdb1/ttgridrollout.out`
180+
To view database instances
181+
* `/u10/TimesTen/ttimdb1/iron_mgmt/bin/ttenv ttGridAdmin instancelist`
182+
183+
Continued failure at this point requires deeper examination of the log files.
146184

cloud/ottscaleout/blkvol.tf

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
2+
#
3+
# Licensed under the Universal Permissive License v 1.0 as shown
4+
# at http://oss.oracle.com/licenses/upl
5+
#
6+
# Block volumes, if requested, are allocated here
7+
# Block volumes are attached to Standard shapes.
8+
# A single block volume is allocated per data instance
9+
# The minimum block volume size is 50GB.
10+
# Block volumes should minimally be 3X RAM; not checked
11+
# Commands for {a|de}ttaching volumes via iscsi are generated here
12+
#
13+
14+
locals {
15+
16+
# block volumes
17+
standard = "${substr(var.diInstanceShape,3,8)}"
18+
bvcount1 = "${(local.standard == "Standard") ? 1 : 0}"
19+
# validate min/max OCI block volume storage limits or error out
20+
bvcount2 = "${(var.diBlockVolumeSizeGB >= 50 &&
21+
var.diBlockVolumeSizeGB <= 32768) ?
22+
local.dicount1 : 0}"
23+
# set to indicate error condition if no block volume and Standard shape or size out of range
24+
bvcheck1 = "${(local.bvcount2 == 0 && local.bvcount1 == 1) ? 1 : 0}"
25+
# mdraid with block volume not supported
26+
bvcheck2 = "${(local.bvcount2 == 0 && var.system["storage"] == "MD-RAID-10") ? 1 : 0}"
27+
28+
}
29+
30+
# workaround for error checking
31+
# prevent use of standard shape without block volume or size out of range
32+
resource "null_resource" "bv_check_1" {
33+
count = "${local.bvcheck1}"
34+
provisioner "local-exec" {
35+
command = "echo -e '\nERROR: No block volumes or invalid GB specified with Standard shape\nRerun terraform with nonzero value for diBlockVolumeSizeGB\n' && false"
36+
}
37+
}
38+
39+
resource "null_resource" "bv_check_2" {
40+
count = "${local.bvcheck2}"
41+
provisioner "local-exec" {
42+
command = "echo -e '\nERROR: MD-RAID-10 storage not permitted with block volume\nRerun terraform with var.system[\"storage\"] == LVM-READ-0\n' && false"
43+
}
44+
}
45+
46+
# Optional block volume attachments
47+
# May only used with Standard shape
48+
49+
resource "oci_core_volume" "di_volume" {
50+
count = "${local.bvcount2}"
51+
#Required
52+
availability_domain = "${local.adlist[((count.index % local.numADs) + local.firstAD) % 3]}"
53+
compartment_id = "${var.compartment_ocid}"
54+
55+
#Optional
56+
display_name = "${format("%s-bv-%03d", var.service_name, count.index + 1)}"
57+
size_in_gbs = "${var.diBlockVolumeSizeGB}"
58+
freeform_tags = "${map(var.opc["tagkey"],var.service_name)}"
59+
}
60+
61+
resource "oci_core_volume_attachment" "di_volume_attachments" {
62+
count = "${local.bvcount2 }"
63+
#Required
64+
instance_id = "${oci_core_instance.di_instance.*.id[count.index]}"
65+
attachment_type = "iscsi"
66+
volume_id = "${oci_core_volume.di_volume.*.id[count.index]}"
67+
68+
#Optional
69+
display_name = "${format("%s-bvat-%03d", var.service_name, count.index + 1)}"
70+
71+
provisioner "local-exec" {
72+
when = "destroy"
73+
command = "rm -rf ${var.opc["scriptdir"]}/iscsi/iscsi-??tach.${self.display_name}"
74+
}
75+
76+
# attach; write iscsi attach commands
77+
provisioner "local-exec" {
78+
command = "echo iscsiadm -m node -o new -T ${self.iqn} -p ${self.ipv4}:${self.port} >> ${var.opc["scriptdir"]}/iscsi/iscsi-attach.${self.display_name}"
79+
}
80+
provisioner "local-exec" {
81+
command = "echo iscsiadm -m node -o update -n node.startup -v automatic -T ${self.iqn} >> ${var.opc["scriptdir"]}/iscsi/iscsi-attach.${self.display_name}"
82+
}
83+
provisioner "local-exec" {
84+
command = "echo iscsiadm -m node -l -T ${self.iqn} -p ${self.ipv4}:${self.port} >> ${var.opc["scriptdir"]}/iscsi/iscsi-attach.${self.display_name}"
85+
}
86+
87+
# detach; write iscsi detach commands
88+
provisioner "local-exec" {
89+
command = "echo iscsiadm -m node -u -T ${self.iqn} -p ${self.ipv4}:${self.port} >> ${var.opc["scriptdir"]}/iscsi/iscsi-detach.${self.display_name}"
90+
}
91+
provisioner "local-exec" {
92+
command = "echo iscsiadm -m node -o delete -T ${self.iqn} -p ${self.ipv4}:${self.port} >> ${var.opc["scriptdir"]}/iscsi/iscsi-detach.${self.display_name}"
93+
}
94+
95+
}
96+

0 commit comments

Comments
 (0)