This set of Templates provide all the components to deploy a single Gerrit primary and a single Gerrit replica in ECS
Five templates are provided in this example:
cf-cluster
: define the ECS cluster and the networking stackcf-service-primary
: define the service stack running Gerrit primarycf-service-replica
: define the service stack running Gerrit replicacf-dns-route
: define the DNS routing for the servicecf-dashboard
: define the CloudWatch dashboard for the serviceserror_log
is exported in a Log Group in CloudWatchFollow the steps described in the Prerequisites section
Please refer to the configuration docs to understand how to set up the configuration and what common configuration values are needed. On top of that, you might set the additional parameters, specific for this recipe.
Configuration values affecting deployment environment and cluster properties
SERVICE_PRIMARY_STACK_NAME
: Optional. Name of the primary service stack. gerrit-service-primary
by default.SERVICE_REPLICA_STACK_NAME
: Optional. Name of the replica service stack. gerrit-service-replica
by default.DASHBOARD_STACK_NAME
: Optional. Name of the dashboard stack. gerrit-dashboard
by default.PRIMARY_SUBDOMAIN
: Optional. Name of the primary sub domain. gerrit-primary-demo
by default.REPLICA_SUBDOMAIN
: Optional. Name of the replica sub domain. gerrit-replica-demo
by default.GERRIT_PRIMARY_INSTANCE_ID
: Optional. Identifier for the Gerrit primary instance. “gerrit-primary-replica-PRIMARY” by default.GERRIT_REPLICA_INSTANCE_ID
: Optional. Identifier for the Gerrit replica instance. “gerrit-primary-replica-REPLICA” by default.GERRIT_VOLUME_ID
: Optional. Id of an extisting EBS volume. If empty, a new volume for Gerrit data will be createdGERRIT_VOLUME_SNAPSHOT_ID
: Optional. Ignored if GERRIT_VOLUME_ID is not empty. Id of the EBS volume snapshot used to create new EBS volume for Gerrit data.GERRIT_VOLUME_SIZE_IN_GIB
: Optional. The size of the Gerrit data volume, in GiBs. 10
by default.NOTE: if you are planning to run the monitoring stack, set the PRIMARY_MAX_COUNT
value to at least 2. The resources provided by a single EC2 instance won't be enough for all the services that will be ran*
PROMETHEUS_SUBDOMAIN
: Optional. Prometheus subdomain. For example: <AWS_PREFIX>-prometheus
GRAFANA_SUBDOMAIN
: Optional. Grafana subdomain. For example: <AWS_PREFIX>-grafana
make [AWS_REGION=a-valid-aws-region] [AWS_PREFIX=some-cluster-prefix] create-all
The optional AWS_REGION
and AWS_REFIX
allow you to define where it will be deployed and what it will be named.
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 [AWS_REGION=a-valid-aws-region] [AWS_PREFIX=some-cluster-prefix] delete-all
The optional AWS_REGION
and AWS_REFIX
allow you to specify exactly which stack you target for deletion.
Note that this will not delete:
Blue/green deployment of the primary-replica recipe requires that the blue and the green stacks are deployed within the same VPC.
In order to preserve the VPC, the IGW and the subnet upon deletion of the blue stack, the nested network cloudformation template needs to be protected from deletion.
Note that you can completely delete the stack, including explicitly retained resources such as the EFS Git filesystem, VPC and subnets, by issuing the more aggressive command:
make [AWS_REGION=a-valid-aws-region] [AWS_PREFIX=some-cluster-prefix] delete-all-including-retained-stack
Note that this will execute a prompt to confirm your choice:
* * * * WARNING * * * * this is going to completely destroy the stack, including git data. Are you sure you want to continue? [y/N]
If you want to automate this programmatically you can just pipe the yes
command to the make:
yes | make [AWS_REGION=a-valid-aws-region] [AWS_PREFIX=some-cluster-prefix] delete-all-including-retained-stack
Get the URL of your Gerrit primary instance this way:
aws cloudformation describe-stacks \ --stack-name <SERVICE_PRIMARY_STACK_NAME> \ | grep -A1 '"OutputKey": "CanonicalWebUrl"' \ | grep OutputValue \ | cut -d'"' -f 4
Similarly for the replica:
aws cloudformation describe-stacks \ --stack-name <SERVICE_REPLICA_STACK_NAME> \ | grep -A1 '"OutputKey": "CanonicalWebUrl"' \ | grep OutputValue \ | cut -d'"' -f 4
Gerrit primary instance ports:
8080
29418
Gerrit replica instance ports:
9080
39418
Refer to the Docker section for information on how to setup docker or how to publish images