Spec up Gerrit containers

Use production like spec for the server. Allocated 70GB of memory
for the Gerrit containers and max vCPU.

Feature: Issue 12953
Change-Id: I7dd3396fe4688f1c09ba4d443db242515cd49cd1
diff --git a/dual-master/Makefile b/dual-master/Makefile
index e0032f0..3564ccb 100644
--- a/dual-master/Makefile
+++ b/dual-master/Makefile
@@ -58,7 +58,9 @@
 		ParameterKey=GerritLogsVolume,ParameterValue=gerrit-logs-master-1 \
 		ParameterKey=PeerSubdomain,ParameterValue=$(MASTER2_SUBDOMAIN) \
 		ParameterKey=LBSubdomain,ParameterValue=$(LB_SUBDOMAIN) \
-		ParameterKey=SlaveServiceStackName,ParameterValue=$(SERVICE_SLAVE_STACK_NAME)
+		ParameterKey=SlaveServiceStackName,ParameterValue=$(SERVICE_SLAVE_STACK_NAME) \
+		ParameterKey=GerritRAM,ParameterValue=$(GERRIT_RAM) \
+		ParameterKey=GerritCPU,ParameterValue=$(GERRIT_CPU)
 
 
 service-master-2:
@@ -85,7 +87,9 @@
 		ParameterKey=PeerSubdomain,ParameterValue=$(MASTER1_SUBDOMAIN) \
 		ParameterKey=LBSubdomain,ParameterValue=$(LB_SUBDOMAIN) \
 		ParameterKey=SlaveServiceStackName,ParameterValue=$(SERVICE_SLAVE_STACK_NAME) \
-		ParameterKey=ReindexAtSartup,ParameterValue=true
+		ParameterKey=ReindexAtSartup,ParameterValue=true \
+		ParameterKey=GerritRAM,ParameterValue=$(GERRIT_RAM) \
+		ParameterKey=GerritCPU,ParameterValue=$(GERRIT_CPU)
 
 service-slave:
 	$(AWS_FC_COMMAND) create-stack \
@@ -100,7 +104,9 @@
 		ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
 		ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)\
-		ParameterKey=GerritDockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG)
+		ParameterKey=GerritDockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG) \
+		ParameterKey=GerritRAM,ParameterValue=$(GERRIT_RAM) \
+		ParameterKey=GerritCPU,ParameterValue=$(GERRIT_CPU)
 
 service-lb:
 	$(AWS_FC_COMMAND) create-stack \
diff --git a/dual-master/README.md b/dual-master/README.md
index 09fbf03..17ac253 100644
--- a/dual-master/README.md
+++ b/dual-master/README.md
@@ -77,6 +77,8 @@
 * `CLUSTER_DESIRED_CAPACITY`: Optional.  Number of EC2 instances composing the cluster. `1` by default.
 *  GERRIT_KEY_PREFIX : Optional. Secrets prefix used during the [Import into AWS Secret Manager](#import-into-aws-secret-manager).
   `gerrit_secret` by default.
+* `GERRIT_RAM`: RAM allocated (MiB) to the Gerrit container. `70000` by default.
+* `GERRIT_CPU`: vCPU units allocated to the Gerrit container. `10240` by default.
 
 ### Prerequisites
 
diff --git a/dual-master/cf-cluster.yml b/dual-master/cf-cluster.yml
index 411c369..8e49ead 100644
--- a/dual-master/cf-cluster.yml
+++ b/dual-master/cf-cluster.yml
@@ -18,7 +18,7 @@
   InstanceType:
     Description: EC2 instance type
     Type: String
-    Default: c4.xlarge
+    Default: m4.10xlarge
     AllowedValues: [t2.micro, t2.small, t2.medium, t2.large, m3.medium, m3.large,
       m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge,
       c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c3.large, c3.xlarge,
diff --git a/dual-master/cf-service-master.yml b/dual-master/cf-service-master.yml
index acbdaff..9662b62 100644
--- a/dual-master/cf-service-master.yml
+++ b/dual-master/cf-service-master.yml
@@ -105,6 +105,14 @@
       Description: Force index reindexing at startup
       Type: String
       Default: false
+  GerritRAM:
+      Description: RAM to allocate to the Gerrit container
+      Type: Number
+      Default: 70000
+  GerritCPU:
+      Description: vCPU to allocate to the Gerrit container
+      Type: Number
+      Default: 10240
 
 Resources:
     Service:
@@ -171,8 +179,8 @@
                       ContainerPath: /var/gerrit/db
                     - SourceVolume: !Ref GerritLogsVolume
                       ContainerPath: /var/gerrit/logs
-                  Cpu: 3072
-                  Memory: 9216
+                  Cpu: !Ref GerritCPU
+                  Memory: !Ref GerritRAM
                   PortMappings:
                     - ContainerPort: !Ref HTTPContainerPort
                       HostPort: !Ref HTTPHostPort
diff --git a/dual-master/cf-service-slave.yml b/dual-master/cf-service-slave.yml
index f2cfe03..64cdfc7 100644
--- a/dual-master/cf-service-slave.yml
+++ b/dual-master/cf-service-slave.yml
@@ -102,6 +102,14 @@
   GerritKeyPrefix:
       Description: Gerrit credentials keys prefix
       Type: String
+  GerritRAM:
+      Description: RAM to allocate to the Gerrit container
+      Type: Number
+      Default: 70000
+  GerritCPU:
+      Description: vCPU to allocate to the Gerrit container
+      Type: Number
+      Default: 10240
 
 Resources:
     GerritService:
@@ -164,8 +172,8 @@
                       ContainerPath: /var/gerrit/db
                     - SourceVolume: !Ref GerritLogsVolume
                       ContainerPath: /var/gerrit/logs
-                  Cpu: 3072
-                  Memory: 9216
+                  Cpu: !Ref GerritCPU
+                  Memory: !Ref GerritRAM
                   PortMappings:
                     - ContainerPort: !Ref HTTPContainePort
                       HostPort: !Ref HTTPHostPort
diff --git a/dual-master/setup.env.template b/dual-master/setup.env.template
index b299707..44376e4 100644
--- a/dual-master/setup.env.template
+++ b/dual-master/setup.env.template
@@ -16,3 +16,5 @@
 LB_SUBDOMAIN=$(AWS_PREFIX)-lb.gerrit-demo
 DOCKER_REGISTRY_URI:=<yourAccountId>.dkr.ecr.us-east-1.amazonaws.com
 SSL_CERTIFICATE_ARN=arn:aws:acm:us-east-1:<yourAccountId>:certificate/33e2c235-a4d1-42b7-b866-18d8d744975c
+GERRIT_RAM=70000
+GERRIT_CPU=10240
diff --git a/master-slave/Makefile b/master-slave/Makefile
index b4986ef..8f03194 100644
--- a/master-slave/Makefile
+++ b/master-slave/Makefile
@@ -45,7 +45,9 @@
 		ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
 		ParameterKey=SlaveServiceStackName,ParameterValue=$(SERVICE_SLAVE_STACK_NAME) \
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)\
-		ParameterKey=DockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG)
+		ParameterKey=DockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG) \
+		ParameterKey=GerritRAM,ParameterValue=$(GERRIT_RAM) \
+		ParameterKey=GerritCPU,ParameterValue=$(GERRIT_CPU)
 
 service-slave:
 	$(AWS_FC_COMMAND) create-stack \
@@ -60,7 +62,9 @@
 		ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
 		ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)\
-		ParameterKey=GerritDockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG)
+		ParameterKey=GerritDockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG) \
+		ParameterKey=GerritRAM,ParameterValue=$(GERRIT_RAM) \
+		ParameterKey=GerritCPU,ParameterValue=$(GERRIT_CPU)
 
 dns-routing:
 	$(AWS_FC_COMMAND) create-stack \
diff --git a/master-slave/README.md b/master-slave/README.md
index 59d7f80..da33ad2 100644
--- a/master-slave/README.md
+++ b/master-slave/README.md
@@ -76,6 +76,8 @@
 *  GERRIT_KEY_PREFIX : Optional. Secrets prefix used during the [Import into AWS Secret Manager](#import-into-aws-secret-manager).
   `gerrit_secret` by default.
 * `CLUSTER_DESIRED_CAPACITY`: Optional.  Number of EC2 instances composing the cluster. `1` by default.
+* `GERRIT_RAM`: RAM allocated (MiB) to the Gerrit container. `70000` by default.
+* `GERRIT_CPU`: vCPU units allocated to the Gerrit container. `10240` by default.
 
 *NOTE: if you are planning to run the monitoring stack, set the
 `CLUSTER_DESIRED_CAPACITY` value to at least 2. The resources provided by
diff --git a/master-slave/cf-cluster.yml b/master-slave/cf-cluster.yml
index 7330e9d..1f2e1e9 100644
--- a/master-slave/cf-cluster.yml
+++ b/master-slave/cf-cluster.yml
@@ -18,7 +18,7 @@
   InstanceType:
     Description: EC2 instance type
     Type: String
-    Default: c4.xlarge
+    Default: m4.10xlarge
     AllowedValues: [t2.micro, t2.small, t2.medium, t2.large, m3.medium, m3.large,
       m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge,
       c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c3.large, c3.xlarge,
diff --git a/master-slave/cf-service-master.yml b/master-slave/cf-service-master.yml
index e2a6135..a4cfab2 100644
--- a/master-slave/cf-service-master.yml
+++ b/master-slave/cf-service-master.yml
@@ -79,6 +79,14 @@
       Description: Gerrit logs volume name
       Type: String
       Default: gerrit-logs-master
+  GerritRAM:
+      Description: RAM to allocate to the Gerrit container
+      Type: Number
+      Default: 70000
+  GerritCPU:
+      Description: vCPU to allocate to the Gerrit container
+      Type: Number
+      Default: 10240
 
 Resources:
     Service:
@@ -135,8 +143,8 @@
                       ContainerPath: /var/gerrit/db
                     - SourceVolume: !Ref GerritLogsVolume
                       ContainerPath: /var/gerrit/logs
-                  Cpu: 1024
-                  Memory: 2048
+                  Cpu: !Ref GerritCPU
+                  Memory: !Ref GerritRAM
                   PortMappings:
                     - ContainerPort: !Ref HTTPPort
                       HostPort: !Ref HTTPPort
diff --git a/master-slave/cf-service-slave.yml b/master-slave/cf-service-slave.yml
index 6965e79..64cdfc7 100644
--- a/master-slave/cf-service-slave.yml
+++ b/master-slave/cf-service-slave.yml
@@ -102,6 +102,14 @@
   GerritKeyPrefix:
       Description: Gerrit credentials keys prefix
       Type: String
+  GerritRAM:
+      Description: RAM to allocate to the Gerrit container
+      Type: Number
+      Default: 70000
+  GerritCPU:
+      Description: vCPU to allocate to the Gerrit container
+      Type: Number
+      Default: 10240
 
 Resources:
     GerritService:
@@ -164,8 +172,8 @@
                       ContainerPath: /var/gerrit/db
                     - SourceVolume: !Ref GerritLogsVolume
                       ContainerPath: /var/gerrit/logs
-                  Cpu: 1024
-                  Memory: 2048
+                  Cpu: !Ref GerritCPU
+                  Memory: !Ref GerritRAM
                   PortMappings:
                     - ContainerPort: !Ref HTTPContainePort
                       HostPort: !Ref HTTPHostPort
diff --git a/master-slave/setup.env.template b/master-slave/setup.env.template
index ca36034..db00ead 100644
--- a/master-slave/setup.env.template
+++ b/master-slave/setup.env.template
@@ -14,3 +14,5 @@
 DOCKER_REGISTRY_URI:=<yourAccountId>.dkr.ecr.us-east-1.amazonaws.com
 SSL_CERTIFICATE_ARN=arn:aws:acm:us-east-1:<yourAccountId>:certificate/33e2c235-a4d1-42b7-b866-18d8d744975c
 TOKEN_VERSION:=4ibxLB
+GERRIT_RAM=70000
+GERRIT_CPU=10240
diff --git a/single-master/Makefile b/single-master/Makefile
index fca4d15..d9430d9 100644
--- a/single-master/Makefile
+++ b/single-master/Makefile
@@ -40,7 +40,9 @@
 		ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
 		ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX) \
-		ParameterKey=DockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG) \
+		ParameterKey=DockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG)\
+		ParameterKey=GerritRAM,ParameterValue=$(GERRIT_RAM) \
+		ParameterKey=GerritCPU,ParameterValue=$(GERRIT_CPU)
 
 dns-routing:
 	$(AWS_FC_COMMAND) create-stack \
diff --git a/single-master/README.md b/single-master/README.md
index 407881a..7f3da8c 100644
--- a/single-master/README.md
+++ b/single-master/README.md
@@ -72,6 +72,8 @@
 * `SUBDOMAIN`: Optional. Name of the sub domain. `gerrit-master-demo` by default.
 *  GERRIT_KEY_PREFIX : Optional. Secrets prefix used during the [Import into AWS Secret Manager](#import-into-aws-secret-manager).
   `gerrit_secret` by default.
+* `GERRIT_RAM`: RAM allocated (MiB) to the Gerrit container. `70000` by default.
+* `GERRIT_CPU`: vCPU units allocated to the Gerrit container. `10240` by default.
 
 ### Prerequisites
 
diff --git a/single-master/cf-cluster.yml b/single-master/cf-cluster.yml
index 85570e2..205da58 100644
--- a/single-master/cf-cluster.yml
+++ b/single-master/cf-cluster.yml
@@ -18,7 +18,7 @@
   InstanceType:
     Description: EC2 instance type
     Type: String
-    Default: c4.xlarge
+    Default: m4.10xlarge
     AllowedValues: [t2.micro, t2.small, t2.medium, t2.large, m3.medium, m3.large,
       m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge,
       c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c3.large, c3.xlarge,
diff --git a/single-master/cf-service.yml b/single-master/cf-service.yml
index 0f7cd92..42d4315 100644
--- a/single-master/cf-service.yml
+++ b/single-master/cf-service.yml
@@ -72,6 +72,14 @@
       Description: Gerrit db volume name
       Type: String
       Default: gerrit-db
+  GerritRAM:
+      Description: RAM to allocate to the Gerrit container
+      Type: Number
+      Default: 70000
+  GerritCPU:
+      Description: vCPU to allocate to the Gerrit container
+      Type: Number
+      Default: 10240
 
 Resources:
     Service:
@@ -126,8 +134,8 @@
                       ContainerPath: /var/gerrit/db
                     - SourceVolume: !Ref GerritLogsVolume
                       ContainerPath: /var/gerrit/logs
-                  Cpu: 1024
-                  Memory: 2048
+                  Cpu: !Ref GerritCPU
+                  Memory: !Ref GerritRAM
                   PortMappings:
                     - ContainerPort: !Ref HTTPPort
                       HostPort: !Ref HTTPPort
diff --git a/single-master/setup.env.template b/single-master/setup.env.template
index dd4ba69..93ff329 100644
--- a/single-master/setup.env.template
+++ b/single-master/setup.env.template
@@ -5,3 +5,5 @@
 SUBDOMAIN:=$(AWS_PREFIX)-master-demo
 DOCKER_REGISTRY_URI:=<your_aws_account_number>.dkr.ecr.us-east-2.amazonaws.com
 SSL_CERTIFICATE_ARN=arn:aws:acm:us-east-2:<your_aws_account_number>:certificate/41eb8e52-c82b-420e-a5b2-d79107f3e5e1
+GERRIT_RAM=70000
+GERRIT_CPU=10240