Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increased Cluster ram to 75% while initializing couchbase cluster #44

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
a5c8cb5
Custom code
Feb 24, 2018
ef859e8
Initial working version
Feb 25, 2018
5b0ddef
Setting for private network
Feb 25, 2018
656a0cb
Modified cf templates for private network
Feb 25, 2018
1c5ca2a
Merge pull request #1 from GloballogicPractices/glp-uat
liafizan Feb 25, 2018
f2441a6
Installing aws-cli
Feb 25, 2018
8140926
Merge branch 'master' of github.com:GloballogicPractices/amazon-cloud…
Feb 25, 2018
335ce5f
Assigned a public ip to instances
Feb 25, 2018
8b4a8aa
Reverting to public hostname
Feb 25, 2018
c967db9
Added tag to identify couchbase role. This will allow us to add ip ad…
Mar 23, 2018
9f3f492
Updated stack to rely on private IP and DNS
Mar 29, 2018
94d7e35
Adding debug to util.sh
Mar 29, 2018
f36ee39
Fixed bug with rallyPrivateDNS
Mar 29, 2018
f65c3b7
Fixed bug with rallyPrivateDNS
Mar 29, 2018
83f6d37
Added cloudwatch roles and updated to AMZN2 AMI for us-west-2
Mar 29, 2018
a3949db
Merge pull request #4 from GloballogicPractices/ami-update-amzn2
liafizan Mar 29, 2018
63bf7f5
Updated to prod AMI and increased EBS vloumes to 200G
Apr 1, 2018
282a04a
Update simple stack with prod AMI for us-west-2 and increased disk si…
Apr 1, 2018
2ff1e0a
Merge pull request #5 from GloballogicPractices/ami-update-amzn2
liafizan Apr 1, 2018
71bb468
Updated AMIs to couchbase provided AMIs as we do not have a requireme…
Apr 2, 2018
94d8395
Fixed bug with AMI name for singapore region
Apr 2, 2018
69078af
Tested CF templates with private IPs. Working fine
Apr 2, 2018
8ec2663
Merge branch 'master' into privateip-chng
liafizan Apr 2, 2018
de96ce2
Merge pull request #6 from GloballogicPractices/privateip-chng
liafizan Apr 2, 2018
ec786a6
Update generator.py
opscart Apr 16, 2018
5d7540b
cloudwatch-alarms.sh
opscart Apr 26, 2018
4b4a35d
Update cloudwatch-alarms.sh
opscart Apr 27, 2018
dabd367
Update cloudwatch-alarms.sh
opscart Apr 29, 2018
a8d1384
Update cloudwatch-alarms.sh
opscart Apr 29, 2018
1f1ca17
Update cloudwatch-alarms.sh
opscart Apr 29, 2018
2b2153b
Update cloudwatch-alarms.sh
opscart Apr 29, 2018
0dd53b7
Update cloudwatch-alarms.sh
opscart Apr 29, 2018
5243028
Update cloudwatch-alarms.sh
opscart Apr 29, 2018
6851a9c
Update cloudwatch-alarms.sh
opscart Apr 29, 2018
1e5df76
Update cloudwatch-alarms.sh
opscart Apr 29, 2018
22f43a1
Update cloudwatch-alarms.sh
opscart Apr 29, 2018
780ed54
Update cloudwatch-alarms.sh
opscart Apr 29, 2018
e471cec
Update cloudwatch-alarms.sh
opscart Apr 30, 2018
d3ef4ac
Update cloudwatch-alarms.sh
opscart Apr 30, 2018
ad9f28d
Update cloudwatch-alarms.sh
opscart Apr 30, 2018
01bd85c
Update cloudwatch-alarms.sh
opscart Apr 30, 2018
6caa477
Update cloudwatch-alarms.sh
opscart Apr 30, 2018
3e7662a
Update cloudwatch-alarms.sh
opscart Apr 30, 2018
cb1abbe
Update cloudwatch-alarms.sh
opscart Apr 30, 2018
77c7d69
Update cloudwatch-alarms.sh
opscart May 1, 2018
ef0cdbd
Update cloudwatch-alarms.sh
opscart May 1, 2018
a303706
Update cloudwatch-alarms.sh
opscart May 1, 2018
f804b21
Update cloudwatch-alarms.sh
opscart May 1, 2018
b488de9
Update cloudwatch-alarms.sh
opscart May 1, 2018
9c2d2fd
Update cloudwatch-alarms.sh
opscart May 1, 2018
9696c6c
Update cloudwatch-alarms.sh
opscart May 1, 2018
fc7f285
Update cloudwatch-alarms.sh
opscart May 1, 2018
7b10c7e
Update cloudwatch-alarms.sh
opscart May 1, 2018
92fde38
Update cloudwatch-alarms.sh
opscart May 1, 2018
2da545b
Added mout path and filesystem
opscart May 1, 2018
2e61e0e
Update cloudwatch-alarms.sh
opscart May 2, 2018
ac45909
Update cloudwatch-alarms.sh
opscart May 2, 2018
0d4502f
Update cloudwatch-alarms.sh
opscart May 23, 2018
5786217
Merge pull request #7 from shamsk22/master
liafizan May 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions generator/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ STACK_NAME=$2
python generator.py parameters/${PARAMETERS_FILE}.yaml

TEMPLATE_BODY="file://generated.template"
REGION=`aws configure get region`

Username="couchbase"
Password="foo123!"
KeyName="couchbase-${REGION}"
License="BYOL"

aws cloudformation create-stack \
--capabilities CAPABILITY_IAM \
--template-body ${TEMPLATE_BODY} \
--stack-name ${STACK_NAME} \
--region ${REGION} \
--parameters \
ParameterKey=Username,ParameterValue=${Username} \
ParameterKey=Password,ParameterValue=${Password} \
ParameterKey=KeyName,ParameterValue=${KeyName} \
ParameterKey=License,ParameterValue=${License}
# REGION=`aws configure get region`
#
# Username="couchbase"
# Password="foo123!"
# KeyName="couchbase-${REGION}"
# License="BYOL"
#
# aws cloudformation create-stack \
# --capabilities CAPABILITY_IAM \
# --template-body ${TEMPLATE_BODY} \
# --stack-name ${STACK_NAME} \
# --region ${REGION} \
# --parameters \
# ParameterKey=Username,ParameterValue=${Username} \
# ParameterKey=Password,ParameterValue=${Password} \
# ParameterKey=KeyName,ParameterValue=${KeyName} \
# ParameterKey=License,ParameterValue=${License}
111 changes: 71 additions & 40 deletions generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,47 +26,63 @@ def main():
"Description": "Name of an existing EC2 KeyPair",
"Type": "AWS::EC2::KeyPair::KeyName"
},
"VpcId": {
"Type": "AWS::EC2::VPC::Id",
"Description": "VpcId of your existing Virtual Private Cloud (VPC)",
"ConstraintDescription": "must be the VPC Id of an existing Virtual Private Cloud."
},
"Subnets": {
"Type": "List<AWS::EC2::Subnet::Id>",
"Description": "The list of PRIVATE SubnetIds in your Virtual Private Cloud (VPC)",
"ConstraintDescription": "must be a list of at least two existing subnets associated with at least two different availability zones. They should be residing in the selected Virtual Private Cloud."
},
"CidrIpVPC": {
"Type": "String",
"Description": "CIDR Block for existing VPC. Traffic would be allowed from this only",
"ConstraintDescription": "must be the VPC Id of an existing Virtual Private Cloud."
},
"License": {
"Description": "License model can be BYOL or HourlyPricing",
"Type": "String",
"Default": "HourlyPricing"
"Default": "BYOL",
"ConstraintDescription": "Select BYOL only for GLP as these are pre baked images"
}
},
"Mappings": {},
"Resources": {}
}

serverVersion = parameters['serverVersion']
syncGatewayVersion = parameters['syncGatewayVersion']
# syncGatewayVersion = parameters['syncGatewayVersion']
cluster = parameters['cluster']

template['Mappings'] = dict(template['Mappings'].items() + generateMappings(serverVersion, syncGatewayVersion).items())
template['Mappings'] = dict(template['Mappings'].items() + generateMappings(serverVersion).items())
template['Resources'] = dict(template['Resources'].items() + generateMiscResources().items())
template['Resources'] = dict(template['Resources'].items() + generateCluster(cluster).items())

file = open('generated.template', 'w')
file.write(json.dumps(template, sort_keys=True, indent=4, separators=(',', ': ')) + '\n')
file.close()

def generateMappings(serverVersion, syncGatewayVersion):
def generateMappings(serverVersion):
allMappings = {
"CouchbaseServer": {
"4.6.4": {
"us-east-1": { "BYOL": "ami-63af9f19", "HourlyPricing": "ami-279faf5d" },
"us-east-2": { "BYOL": "ami-d17742b4", "HourlyPricing": "ami-f4704591" },
"us-west-1": { "BYOL": "ami-018d8061", "HourlyPricing": "ami-b88d80d8" },
"us-west-2": { "BYOL": "ami-eea11e96", "HourlyPricing": "ami-b99728c1" },
"ca-central-1": { "BYOL": "ami-4723a623", "HourlyPricing": "ami-492ca92d" },
"eu-central-1": { "BYOL": "ami-82079eed", "HourlyPricing": "ami-d63ca5b9" },
"eu-west-1": { "BYOL": "ami-1c88ef65", "HourlyPricing": "ami-fc99fe85" },
"eu-west-2": { "BYOL": "ami-12445e76", "HourlyPricing": "ami-cb455faf" },
"eu-west-3": { "BYOL": "ami-86d96ffb", "HourlyPricing": "ami-d3dd6bae" },
"ap-southeast-1": { "BYOL": "ami-6fed9513", "HourlyPricing": "ami-17ed956b" },
"ap-southeast-2": { "BYOL": "ami-3b0ef059", "HourlyPricing": "ami-c30ef0a1" },
"ap-south-1": { "BYOL": "ami-83b1e0ec", "HourlyPricing": "ami-c8b0e1a7" },
"ap-northeast-1": { "BYOL": "ami-1eea8778", "HourlyPricing": "ami-75e78a13" },
"ap-northeast-2": { "BYOL": "ami-b19330df", "HourlyPricing": "ami-888e2de6" },
"sa-east-1": { "BYOL": "ami-f4551998", "HourlyPricing": "ami-d3571bbf" }
"4.6.3": {
"us-east-1": { "BYOL": "ami-a693a3dc", "HourlyPricing": "ami-ef95a595" },
"us-east-2": { "BYOL": "ami-d97441bc", "HourlyPricing": "ami-62764307" },
"us-west-1": { "BYOL": "ami-cf8c81af", "HourlyPricing": "ami-c08c81a0" },
"us-west-2": { "BYOL": "ami-380dfa40", "HourlyPricing": "ami-49a11e31" },
"ca-central-1": { "BYOL": "ami-9822a7fc", "HourlyPricing": "ami-2e22a74a" },
"eu-central-1": { "BYOL": "ami-8438a1eb", "HourlyPricing": "ami-9939a0f6" },
"eu-west-1": { "BYOL": "ami-078aed7e", "HourlyPricing": "ami-7797f00e" },
"eu-west-2": { "BYOL": "ami-dd455fb9", "HourlyPricing": "ami-be7b61da" },
"eu-west-3": { "BYOL": "ami-d5dd6ba8", "HourlyPricing": "ami-5bc77126" },
"ap-southeast-1": { "BYOL": "ami-33ec944f", "HourlyPricing": "ami-13eb936f" },
"ap-southeast-2": { "BYOL": "ami-8910eeeb", "HourlyPricing": "ami-ec11ef8e" },
"ap-south-1": { "BYOL": "aami-0d8ddc62", "HourlyPricing": "ami-5db1e032" },
"ap-northeast-1": { "BYOL": "ami-b0e489d6", "HourlyPricing": "ami-47e48921" },
"ap-northeast-2": { "BYOL": "ami-ec8d2e82", "HourlyPricing": "ami-e78c2f89" },
"sa-east-1": { "BYOL": "ami-995519f5", "HourlyPricing": "ami-f5551999" }
},
"5.0.1": {
"us-east-1": { "BYOL": "ami-a693a3dc", "HourlyPricing": "ami-ef95a595" },
Expand Down Expand Up @@ -108,7 +124,7 @@ def generateMappings(serverVersion, syncGatewayVersion):
}
mappings = {
"CouchbaseServer": allMappings["CouchbaseServer"][serverVersion],
"CouchbaseSyncGateway": allMappings["CouchbaseSyncGateway"][syncGatewayVersion]
# "CouchbaseSyncGateway": allMappings["CouchbaseSyncGateway"][syncGatewayVersion]
}
return mappings

Expand Down Expand Up @@ -136,9 +152,16 @@ def generateMiscResources():
"Statement": [{
"Effect": "Allow",
"Action": [
"ec2:CreateTags",
"ec2:DescribeInstances",
"autoscaling:DescribeAutoScalingGroups"
"ec2:CreateTags",
"ec2:Describe*",
"autoscaling:DescribeAutoScalingGroups",
"cloudwatch:PutMetricData",
"cloudwatch:PutDashboard",
"cloudwatch:PutMetricAlarm",
"cloudwatch:GetMetricStatistics",
"cloudwatch:ListMetrics",
"ec2:DescribeTags",
"autoscaling:DescribeAutoScalingGroups"
],
"Resource": "*"
}]
Expand All @@ -151,16 +174,19 @@ def generateMiscResources():
"Properties": {
"GroupDescription" : "Enable SSH and Couchbase Ports",
"SecurityGroupIngress": [
{ "IpProtocol": "tcp", "FromPort": 22, "ToPort": 22, "CidrIp": "0.0.0.0/0" },
{ "IpProtocol": "tcp", "FromPort": 4369, "ToPort": 4369, "CidrIp": "0.0.0.0/0" },
{ "IpProtocol": "tcp", "FromPort": 4984, "ToPort": 4985, "CidrIp": "0.0.0.0/0" },
{ "IpProtocol": "tcp", "FromPort": 8091, "ToPort": 8094, "CidrIp": "0.0.0.0/0" },
{ "IpProtocol": "tcp", "FromPort": 9100, "ToPort": 9105, "CidrIp": "0.0.0.0/0" },
{ "IpProtocol": "tcp", "FromPort": 9998, "ToPort": 9999, "CidrIp": "0.0.0.0/0" },
{ "IpProtocol": "tcp", "FromPort": 11207, "ToPort": 11215, "CidrIp": "0.0.0.0/0" },
{ "IpProtocol": "tcp", "FromPort": 18091, "ToPort": 18093, "CidrIp": "0.0.0.0/0" },
{ "IpProtocol": "tcp", "FromPort": 21100, "ToPort": 21299, "CidrIp": "0.0.0.0/0" }
]
{ "IpProtocol": "tcp", "FromPort": 22, "ToPort": 22, "CidrIp": { "Ref": "CidrIpVPC" } },
{ "IpProtocol": "tcp", "FromPort": 4369, "ToPort": 4369, "CidrIp": { "Ref": "CidrIpVPC" } },
{ "IpProtocol": "tcp", "FromPort": 4984, "ToPort": 4985, "CidrIp": { "Ref": "CidrIpVPC" } },
{ "IpProtocol": "tcp", "FromPort": 8091, "ToPort": 8094, "CidrIp": { "Ref": "CidrIpVPC" } },
{ "IpProtocol": "tcp", "FromPort": 9100, "ToPort": 9105, "CidrIp": { "Ref": "CidrIpVPC" } },
{ "IpProtocol": "tcp", "FromPort": 9998, "ToPort": 9999, "CidrIp": { "Ref": "CidrIpVPC" } },
{ "IpProtocol": "tcp", "FromPort": 11207, "ToPort": 11215, "CidrIp": { "Ref": "CidrIpVPC" } },
{ "IpProtocol": "tcp", "FromPort": 18091, "ToPort": 18093, "CidrIp": { "Ref": "CidrIpVPC" } },
{ "IpProtocol": "tcp", "FromPort": 21100, "ToPort": 21299, "CidrIp": { "Ref": "CidrIpVPC" } }
],
"VpcId": {
"Ref": "VpcId"
}
}
}
}
Expand Down Expand Up @@ -194,7 +220,7 @@ def generateSyncGateway(group, rallyAutoScalingGroup):
"AvailabilityZones": { "Fn::GetAZs": "" },
"LaunchConfigurationName": { "Ref": groupName + "LaunchConfiguration" },
"MinSize": 0,
"MaxSize": 100,
"MaxSize": 30,
"DesiredCapacity": nodeCount
}
},
Expand Down Expand Up @@ -222,8 +248,8 @@ def generateSyncGateway(group, rallyAutoScalingGroup):
"stackName=", { "Ref": "AWS::StackName" }, "\n",
"baseURL=https://raw.githubusercontent.com/couchbase-partners/amazon-cloud-formation-couchbase/master/scripts/\n",
"wget ${baseURL}syncGateway.sh\n",
"chmod +x *.sh\n",
"./syncGateway.sh ${stackName}\n"
"chmod +x *.sh\n"
# "./syncGateway.sh ${stackName}\n"
]]
}
}
Expand All @@ -247,11 +273,13 @@ def generateServer(group, rallyAutoScalingGroup):
command = [
"#!/bin/bash\n",
"echo 'Running startup script...'\n",
"echo 'Install aws-cli...'\n"
"yum install -y aws-cli \n"
"adminUsername=", { "Ref": "Username" }, "\n",
"adminPassword=", { "Ref": "Password" }, "\n",
"services=" + servicesParameter + "\n",
"stackName=", { "Ref": "AWS::StackName" }, "\n",
"baseURL=https://raw.githubusercontent.com/couchbase-partners/amazon-cloud-formation-couchbase/master/scripts/\n",
"baseURL=https://raw.githubusercontent.com/GloballogicPractices/amazon-cloud-formation-couchbase/master/scripts/\n",
"wget ${baseURL}server.sh\n",
"wget ${baseURL}util.sh\n",
"chmod +x *.sh\n",
Expand All @@ -268,10 +296,12 @@ def generateServer(group, rallyAutoScalingGroup):
groupName + "AutoScalingGroup": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"AvailabilityZones": { "Fn::GetAZs": "" },
# "VpcId" : { "Ref" : "vpcId" },
# "AvailabilityZones": { "Fn::GetAZs": { "Ref" : "AWS::Region" }},
"VPCZoneIdentifier": { "Ref": "Subnets" },
"LaunchConfigurationName": { "Ref": groupName + "LaunchConfiguration" },
"MinSize": 1,
"MaxSize": 100,
"MaxSize": 30,
"DesiredCapacity": nodeCount
}
},
Expand All @@ -280,6 +310,7 @@ def generateServer(group, rallyAutoScalingGroup):
"Properties": {
"ImageId": { "Fn::FindInMap": [ "CouchbaseServer", { "Ref": "AWS::Region" }, { "Ref": "License" } ] },
"InstanceType": nodeType,
"AssociatePublicIpAddress": False,
"SecurityGroups": [ { "Ref": "CouchbaseSecurityGroup" } ],
"KeyName": { "Ref": "KeyName" },
"EbsOptimized": True,
Expand Down
32 changes: 16 additions & 16 deletions generator/parameters/granular.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
serverVersion: 5.0.1
syncGatewayVersion: 1.5.1
#syncGatewayVersion: 1.5.1
cluster:
- group: data
nodeCount: 2
nodeType: m4.4xlarge
dataDiskSize: 100
dataDiskSize: 200
services:
- data
- group: query
nodeCount: 2
nodeCount: 1
nodeType: m4.4xlarge
dataDiskSize: 100
dataDiskSize: 5
services:
- query
- group: index
nodeCount: 2
nodeType: m4.4xlarge
dataDiskSize: 100
dataDiskSize: 200
services:
- index
- group: fts
nodeCount: 2
nodeType: m4.4xlarge
dataDiskSize: 100
services:
- fts
- group: syncgateway
nodeCount: 2
nodeType: m4.4xlarge
services:
- syncGateway
# - group: fts
# nodeCount: 2
# nodeType: m4.4xlarge
# dataDiskSize: 100
# services:
# - fts
# - group: syncgateway
# nodeCount: 2
# nodeType: m4.4xlarge
# services:
# - syncGateway
8 changes: 4 additions & 4 deletions generator/parameters/simple.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
serverVersion: 5.0.1
syncGatewayVersion: 1.5.1
# syncGatewayVersion: 1.5.1
cluster:
- group: group1
nodeCount: 5
nodeCount: 1
nodeType: m4.4xlarge
dataDiskSize: 100
dataDiskSize: 200
services:
- data
- query
- index
- fts
# - fts
Loading