This set of templates provides all the components to deploy a Gerrit dual-master in HA in ECS. The 2 masters will share the Git repositories via NFS, using EFS.
The following templates are provided in this example:
cf-cluster
: define the ECS cluster and the networking stackcf-service-master
: define the service stack running the gerrit mastercf-dns-route
: define the DNS routing for the servicecf-service-slave
: define the service stack running the gerrit replicacf-service-lb
: define the LBs in front of gerrit masters (this includes haproxy as well as NLB)NOTE: This stack uses EFS in provisioned mode, which is a better setting for large repos (> 1GB uncompressed) since it provides a lower latency compared to the burst mode. However, it has some costs associated. If you are dealing with small repos, you can switch to burst mode.
The setup.env.template
is an example of setup file for the creation of the stacks.
Before creating the stacks, create a setup.env
in the Makefile
directory and set the correct values of the environment variables.
This is the list of available parameters:
DOCKER_REGISTRY_URI
: Mandatory. URI of the Docker registry. See the prerequisites section for more details.SSL_CERTIFICATE_ARN
: Mandatory. ARN of the wildcard SSL Certificate, covering both master nodes.CLUSTER_STACK_NAME
: Optional. Name of the cluster stack. gerrit-cluster
by default.SERVICE_MASTER1_STACK_NAME
: Optional. Name of the master 1 service stack. gerrit-service-master-1
by default.SERVICE_MASTER2_STACK_NAME
: Optional. Name of the master 2 service stack. gerrit-service-master-2
by default.DNS_ROUTING_STACK_NAME
: Optional. Name of the DNS routing stack. gerrit-dns-routing
by default.HOSTED_ZONE_NAME
: Optional. Name of the hosted zone. mycompany.com
by default.MASTER1_SUBDOMAIN
: Optional. Name of the master 1 sub domain. gerrit-master-1-demo
by default.MASTER2_SUBDOMAIN
: Optional. Name of the master 2 sub domain. gerrit-master-2-demo
by default.CLUSTER_DESIRED_CAPACITY
: Optional. Number of EC2 instances composing the cluster. 1
by default.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.GERRIT_HEAP_LIMIT
: Maximum heap size of the Java process running Gerrit, in bytes. See Gerrit documentation 35g
by default.JGIT_CACHE_SIZE
: Maximum number of bytes to load and cache in memory from pack files. See Gerrit documentation for more details. 12g
by default.Follow the steps described in the Prerequisites section
make create-all
It might take several minutes to build the stack. You can monitor the creations of the stacks in CloudFormation
pem
file on the current directory. To use when ssh-ing into your instances as follow: ssh -i cluster-keys.pem ec2-user@<ec2_instance_ip>
make delete-all
Get the URL of your Gerrit master instances this way:
aws cloudformation describe-stacks \ --stack-name <SERVICE_MASTER1_STACK_NAME> \ | grep -A1 '"OutputKey": "CanonicalWebUrl"' \ | grep OutputValue \ | cut -d'"' -f 4 aws cloudformation describe-stacks \ --stack-name <SERVICE_MASTER2_STACK_NAME> \ | grep -A1 '"OutputKey": "CanonicalWebUrl"' \ | grep OutputValue \ | cut -d'"' -f 4
Gerrit master instance ports:
8080
29418
If you need to setup some external services (maybe for testing purposes, such as SMTP or LDAP), you can follow the instructions here
Refer to the Docker section for information on how to setup docker or how to publish images