blob: 90bb14872a4fc8fa4171bebe7856018043db408e [file] [log] [blame]
AWSTemplateFormatVersion: '2010-09-09'
Description: Deploy Gerrit primary to ECS cluster
Parameters:
GerritServiceName:
Type: String
Default: gerrit-primary
ClusterStackName:
Description: Stack name of the ECS cluster to deply the serivces
Type: String
Default: gerrit-cluster
TemplateBucketName:
Description: S3 bucket containing cloudformation templates
Type: String
EnvironmentName:
Description: An environment name that will be prefixed to resource names
Type: String
Default: test
DockerImage:
Description: Gerrit official Docker image
Type: String
Default: aws-gerrit/gerrit:latest
DockerRegistryUrl:
Description: Docker registry URL
Type: String
DesiredCount:
Description: How many instances of this task should we run across our cluster?
Type: Number
Default: 1
HTTPPort:
Description: Gerrit HTTP port
Type: Number
Default: 8080
HTTPSPort:
Description: Gerrit HTTPS port
Type: Number
Default: 443
SSHPort:
Description: Gerrit SSH port
Type: Number
Default: 29418
CertificateArn:
Description: SSL Certificates ARN
Type: String
HostedZoneName:
Description: The route53 HostedZoneName.
Type: String
HttpSubdomain:
Description: The HTTP subdomain of the Gerrit cluster
Type: String
Default: gerrit-http-primary-demo
SshSubdomain:
Description: The SSH subdomain of the Gerrit cluster
Type: String
Default: gerrit-ssh-primary-demo
LoadBalancerScheme:
Description: Load Balancer schema, The nodes of an Internet-facing load balancer have public IP addresses.
Type: String
Default: internet-facing
AllowedValues: [internal, internet-facing]
GerritKeyPrefix:
Description: Gerrit credentials keys prefix
Type: String
GerritRAM:
Description: RAM to allocate to the Gerrit container
Type: Number
Default: 6000
GerritCPU:
Description: vCPU to allocate to the Gerrit container
Type: Number
Default: 1024
FileDescriptorsSoftLimit:
Description: The soft limit for file descriptors allowed in the Gerrit container
Type: Number
Default: 1024
FileDescriptorsHardLimit:
Description: The hard limit for file descriptors allowed in the Gerrit container
Type: Number
Default: 1024
GerritHeapLimit:
Description: Gerrit Heap limit
Type: String
Default: 6g
JgitCacheSize:
Description: JGit cache size
Type: String
Default: 3g
JgitOpenFiles:
Description: Maximum number of pack files to have open at once
Type: Number
Default: 128
LDAPServer:
Description: LDAP server URL
Type: String
LDAPUsername:
Description: Username to bind to the LDAP server with
Type: String
LDAPAccountBase:
Description: Root of the tree containing all user accounts
Type: String
LDAPGroupBase:
Description: Root of the tree containing all group objects
Type: String
LDAPAccountPattern:
Description: Query pattern to use when searching for a user account
Type: String
Default: (&(objectClass=person)(uid=${username}))
SMTPServer:
Description: SMTP server URL
Type: String
SMTPServerPort:
Description: SMTP server port
Type: Number
Default: 465
SMTPUser:
Description: User name to authenticate with, if required for relay
Type: String
SMTPDomain:
Description: Domain to be used in the From field
Type: String
SMTPEncryption:
Description: Encryption to be used
Type: String
Default: ssl
AllowedValues: ['ssl', 'tls', 'none']
SMTPSslVerify:
Description: If false and SMTPEncryption is 'ssl' or 'tls', Gerrit will not verify the server certificate when it connects to send an email message.
Type: String
Default: true
AllowedValues: [true, false]
InstanceId:
Description: Optional identifier for the Gerrit instance
Type: String
Default: gerrit-single-primary
MetricsCloudwatchEnabled:
Description: Whether gerrit metrics should be published to cloudwatch
Type: String
Default: false
AllowedValues: [true, false]
MetricsCloudwatchNamespace:
Description: The CloudWatch namespace for Gerrit metrics
Type: String
Default: gerrit
MetricsCloudwatchRate:
Description: The rate at which metrics should be fired to AWS
Type: String
Default: 60s
MetricsCloudwatchInitialDelay:
Description: The time to delay the first reporting execution
Type: String
Default: 0
MetricsCloudwatchJVMEnabled:
Description: Whether JVM metrics shoiuld be published to cloudwatch
Type: String
Default: false
AllowedValues: [true, false]
MetricsCloudwatchDryRun:
Description: The reporter will log.DEBUG the metrics, instead of doing a real POST to CloudWatch
Type: String
Default: false
AllowedValues: [true, false]
MetricsCloudwatchExcludeMetrics:
Description: Comma separated list of regex patterns to exclude metrics reported to CloudWatch
Type: CommaDelimitedList
Default: '^(?!.*(sshd\\/sessions\\/connected|proc\\/cpu\\/usage|jgit\\/block_cache\\/cache_used|jvm\\.memory\\.total.used|proc\\/cpu\\/system_load|jvm\\.gc\\.G1-Old-Generation\\.time|proc\\/jvm\\/thread\\/num_live|git\\/upload-pack\\/request_count_total|http\\/server\\/rest_api\\/server_latency_total|http\\/server\\/success_count_total|http\\/server\\/error_count_total|queue\\/index_batch\\/total_scheduled_tasks_count|queue\\/receive_commits\\/total_scheduled_tasks_count|queue\\/work_queue\\/total_scheduled_tasks_count|queue\\/ssh_command_start\\/total_scheduled_tasks_count|queue\\/send_email\\/scheduled_tasks|jgit\\/block_cache\\/open_files|jgit\\/block_cache\\/cache_used)).*'
EnableXray:
Description: Whether to enable X-Ray tracing for Gerrit
Type: String
Default: false
AllowedValues: [true, false]
Mappings:
XRay:
Info:
ContainerName: xray-daemon
Port: 2000
Gerrit:
Volume:
Git: gerrit-git
Data: gerrit-data
Index: gerrit-index
Cache: gerrit-cache
Db: gerrit-db
Logs: gerrit-logs
Conditions:
CreateCloudwatchDashboard: !Equals [!Ref MetricsCloudwatchEnabled, true]
ShouldEnableXRay: !Equals [!Ref EnableXray, true]
Resources:
Service:
Type: AWS::ECS::Service
DependsOn:
- HTTPListener
- SSHListener
Properties:
Cluster:
Fn::ImportValue:
!Join [':', [!Ref 'ClusterStackName', 'ClusterName']]
DesiredCount: !Ref DesiredCount
TaskDefinition: !Ref TaskDefinition
LoadBalancers:
- ContainerName: !Ref GerritServiceName
ContainerPort: !Ref HTTPPort
TargetGroupArn: !Ref HTTPTargetGroup
- ContainerName: !Ref GerritServiceName
ContainerPort: !Ref SSHPort
TargetGroupArn: !Ref SSHTargetGroup
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: !Join ['', [!Ref GerritServiceName, TaskDefinition]]
TaskRoleArn: !GetAtt ECSTaskExecutionRoleStack.Outputs.TaskExecutionRoleRef
ExecutionRoleArn: !GetAtt ECSTaskExecutionRoleStack.Outputs.TaskExecutionRoleRef
NetworkMode: bridge
PlacementConstraints:
- Expression: !Sub 'attribute:target_group == primary'
Type: "memberOf"
ContainerDefinitions:
- Name: !Ref GerritServiceName
Essential: true
Image: !Sub '${DockerRegistryUrl}/${DockerImage}'
Environment:
- Name: XRAY_ENABLED
Value: !Ref EnableXray
- Name: AWS_XRAY_TRACING_NAME
Value: !Ref InstanceId
- Name: AWS_XRAY_DAEMON_ADDRESS
Value: !Join [':', [!FindInMap ['XRay', 'Info', 'ContainerName'], !FindInMap ['XRay', 'Info', 'Port']]]
- Name: CANONICAL_WEB_URL
Value: !Sub 'https://${HttpSubdomain}.${HostedZoneName}'
- Name: SSHD_ADVERTISED_ADDRESS
Value: !Sub '${SshSubdomain}.${HostedZoneName}:${SSHPort}'
- Name: HTTPD_LISTEN_URL
Value: !Sub 'proxy-https://*:${HTTPPort}/'
- Name: AWS_REGION
Value: !Ref AWS::Region
- Name: GERRIT_KEY_PREFIX
Value: !Ref GerritKeyPrefix
- Name: REINDEX_AT_STARTUP
Value: false
- Name: GERRIT_HEAP_LIMIT
Value: !Ref GerritHeapLimit
- Name: JGIT_CACHE_SIZE
Value: !Ref JgitCacheSize
- Name: JGIT_OPEN_FILES
Value: !Ref JgitOpenFiles
- Name: LDAP_SERVER
Value: !Ref LDAPServer
- Name: LDAP_USERNAME
Value: !Ref LDAPUsername
- Name: LDAP_ACCOUNT_BASE
Value: !Ref LDAPAccountBase
- Name: LDAP_ACCOUNT_PATTERN
Value: !Ref LDAPAccountPattern
- Name: LDAP_GROUP_BASE
Value: !Ref LDAPGroupBase
- Name: SMTP_SERVER
Value: !Ref SMTPServer
- Name: SMTP_SERVER_PORT
Value: !Ref SMTPServerPort
- Name: SMTP_ENCRYPTION
Value: !Ref SMTPEncryption
- Name: SMTP_SSL_VERIFY
Value: !Ref SMTPSslVerify
- Name: SMTP_USER
Value: !Ref SMTPUser
- Name: SMTP_DOMAIN
Value: !Ref SMTPDomain
- Name: GERRIT_INSTANCE_ID
Value: !Ref InstanceId
- Name: METRICS_CLOUDWATCH_ENABLED
Value: !Ref MetricsCloudwatchEnabled
- Name: METRICS_CLOUDWATCH_NAMESPACE
Value: !Ref MetricsCloudwatchNamespace
- Name: METRICS_CLOUDWATCH_RATE
Value: !Ref MetricsCloudwatchRate
- Name: METRICS_CLOUDWATCH_INITIAL_DELAY
Value: !Ref MetricsCloudwatchInitialDelay
- Name: METRICS_CLOUDWATCH_JVM_ENABLED
Value: !Ref MetricsCloudwatchJVMEnabled
- Name: METRICS_CLOUDWATCH_DRY_RUN
Value: !Ref MetricsCloudwatchDryRun
- Name: METRICS_CLOUDWATCH_EXCLUDE_METRICS_LIST
Value: !Join [',', !Ref MetricsCloudwatchExcludeMetrics]
MountPoints:
- SourceVolume: !FindInMap ['Gerrit', 'Volume', 'Git']
ContainerPath: /var/gerrit/git
- SourceVolume: !FindInMap ['Gerrit', 'Volume', 'Data']
ContainerPath: /var/gerrit/data
- SourceVolume: !FindInMap ['Gerrit', 'Volume', 'Index']
ContainerPath: /var/gerrit/index
- SourceVolume: !FindInMap ['Gerrit', 'Volume', 'Cache']
ContainerPath: /var/gerrit/cache
- SourceVolume: !FindInMap ['Gerrit', 'Volume', 'Db']
ContainerPath: /var/gerrit/db
- SourceVolume: !FindInMap ['Gerrit', 'Volume', 'Logs']
ContainerPath: /var/gerrit/logs
Ulimits:
- Name: nofile
HardLimit: !Ref FileDescriptorsHardLimit
SoftLimit: !Ref FileDescriptorsSoftLimit
Cpu: !Ref GerritCPU
Memory: !Ref GerritRAM
PortMappings:
- ContainerPort: !Ref HTTPPort
HostPort: !Ref HTTPPort
Protocol: tcp
- ContainerPort: !Ref SSHPort
HostPort: !Ref SSHPort
Protocol: tcp
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group: !Ref ClusterStackName
awslogs-region: !Ref AWS::Region
awslogs-stream-prefix: !Ref EnvironmentName
Links:
Fn::If:
- ShouldEnableXRay
-
- !FindInMap ['XRay', 'Info', 'ContainerName']
- !Ref "AWS::NoValue"
- Fn::If:
- ShouldEnableXRay
- Name: !FindInMap ['XRay', 'Info', 'ContainerName']
Essential: false
Image: "amazon/aws-xray-daemon"
Cpu: 32
MemoryReservation: 256
PortMappings:
- HostPort: 2000
ContainerPort: 2000
Protocol: "udp"
- !Ref "AWS::NoValue"
Volumes:
- Name: !FindInMap ['Gerrit', 'Volume', 'Db']
Host:
SourcePath: !Join ['/', ["/gerrit-mount-point", !FindInMap ['Gerrit', 'Volume', 'Db']]]
- Name: !FindInMap ['Gerrit', 'Volume', 'Git']
Host:
SourcePath: !Join ['/', ["/gerrit-mount-point", !FindInMap ['Gerrit', 'Volume', 'Git']]]
- Name: !FindInMap ['Gerrit', 'Volume', 'Data']
Host:
SourcePath: !Join ['/', ["/gerrit-mount-point", !FindInMap ['Gerrit', 'Volume', 'Data']]]
- Name: !FindInMap ['Gerrit', 'Volume', 'Cache']
Host:
SourcePath: !Join ['/', ["/gerrit-mount-point", !FindInMap ['Gerrit', 'Volume', 'Cache']]]
- Name: !FindInMap ['Gerrit', 'Volume', 'Index']
Host:
SourcePath: !Join ['/', ["/gerrit-mount-point", !FindInMap ['Gerrit', 'Volume', 'Index']]]
- Name: !FindInMap ['Gerrit', 'Volume', 'Logs']
Host:
SourcePath: !Join ['/', ["/gerrit-mount-point", !FindInMap ['Gerrit', 'Volume', 'Logs']]]
GerritHTTPLoadBalancerSG:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId:
Fn::ImportValue:
!Join [':', [!Ref 'ClusterStackName', 'VPCId']]
GroupDescription: "Allow public HTTPS traffic"
GroupName: !Sub '${ClusterStackName}-P-H'
SecurityGroupIngress:
- IpProtocol: 'tcp'
FromPort: !Ref HTTPSPort
ToPort: !Ref HTTPSPort
CidrIp: '0.0.0.0/0'
Description: "HTTPS connections from everywhere (IPv4)"
- IpProtocol: 'tcp'
FromPort: !Ref HTTPSPort
ToPort: !Ref HTTPSPort
CidrIpv6: '::/0'
Description: "HTTPS connections from everywhere (IPv6)"
GerritHTTPLoadBalancer:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Name: !Sub '${ClusterStackName}-P-H'
Type: application
Scheme: !Ref 'LoadBalancerScheme'
SecurityGroups:
- !Ref GerritHTTPLoadBalancerSG
Subnets:
- Fn::ImportValue:
!Join [':', [!Ref 'ClusterStackName', 'PublicSubnetOne']]
- Fn::ImportValue:
!Join [':', [!Ref 'ClusterStackName', 'PublicSubnetTwo']]
Tags:
- Key: Name
Value: !Join ['-', [!Ref 'EnvironmentName', !Ref 'GerritServiceName', 'alb']]
GerritSSHLoadBalancer:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Name: !Sub '${ClusterStackName}-P-S'
Type: network
Scheme: !Ref 'LoadBalancerScheme'
LoadBalancerAttributes:
- Key: 'load_balancing.cross_zone.enabled'
Value: true
Subnets:
- Fn::ImportValue:
!Join [':', [!Ref 'ClusterStackName', 'PublicSubnetOne']]
- Fn::ImportValue:
!Join [':', [!Ref 'ClusterStackName', 'PublicSubnetTwo']]
Tags:
- Key: Name
Value: !Join ['-', [!Ref 'EnvironmentName', !Ref 'GerritServiceName', 'nlb']]
HTTPTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
DependsOn: GerritHTTPLoadBalancer
Properties:
VpcId:
Fn::ImportValue:
!Join [':', [!Ref 'ClusterStackName', 'VPCId']]
Port: !Ref HTTPPort
Protocol: HTTP
HealthCheckProtocol: HTTP
HealthCheckPort: !Ref HTTPPort
HealthCheckPath: '/config/server/healthcheck~status'
Name: !Sub '${ClusterStackName}-P-H'
HTTPListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
Certificates:
- CertificateArn: !Ref CertificateArn
DefaultActions:
- Type: forward
TargetGroupArn: !Ref HTTPTargetGroup
LoadBalancerArn: !Ref GerritHTTPLoadBalancer
Port: !Ref HTTPSPort
Protocol: HTTPS
SSHTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
DependsOn: GerritSSHLoadBalancer
Properties:
VpcId:
Fn::ImportValue:
!Join [':', [!Ref 'ClusterStackName', 'VPCId']]
Port: !Ref SSHPort
Protocol: TCP
HealthCheckProtocol: HTTP
HealthCheckPort: !Ref HTTPPort
HealthCheckPath: '/config/server/healthcheck~status'
Name: !Sub '${ClusterStackName}-P-S'
SSHListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- Type: forward
TargetGroupArn: !Ref SSHTargetGroup
LoadBalancerArn: !Ref GerritSSHLoadBalancer
Port: !Ref SSHPort
Protocol: TCP
ECSTaskExecutionRoleStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Join [ '', ['https://', !Ref TemplateBucketName, '.s3.amazonaws.com/cf-gerrit-task-execution-role.yml'] ]
TimeoutInMinutes: '5'
CloudWatchDashboard:
Type: AWS::CloudWatch::Dashboard
Condition: CreateCloudwatchDashboard
Properties:
DashboardName: !Ref AWS::StackName
DashboardBody: !Sub |
{
"start": "-PT6H",
"periodOverride": "auto",
"widgets": [
{
"type": "metric",
"x": 0,
"y": 0,
"width": 24,
"height": 3,
"properties": {
"metrics": [
[ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${InstanceId}", "Type", "gauge" ]
],
"view": "singleValue",
"region": "${AWS::Region}",
"stat": "Maximum",
"period": 60,
"title": "SSH Connection",
"stacked": false
}
},
{
"type": "metric",
"x": 6,
"y": 3,
"width": 6,
"height": 6,
"properties": {
"metrics": [
[ { "expression": "RATE(METRICS())", "label": "Expression1", "id": "e1", "region": "${AWS::Region}" } ],
[ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${InstanceId}", "Type", "gauge", { "id": "m1", "visible": false } ]
],
"view": "timeSeries",
"stacked": true,
"region": "${AWS::Region}",
"stat": "Average",
"period": 60,
"title": "Gerrit Cpu Load",
"yAxis": {
"right": {
"showUnits": true
},
"left": {
"showUnits": false,
"min": 0
}
}
}
},
{
"type": "metric",
"x": 12,
"y": 33,
"width": 12,
"height": 6,
"properties": {
"metrics": [
[ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${InstanceId}", "Type", "gauge", { "id": "m1" } ]
],
"view": "timeSeries",
"stacked": true,
"region": "${AWS::Region}",
"yAxis": {
"left": {
"showUnits": false,
"label": ""
}
},
"title": "JGit Cache",
"period": 60,
"stat": "Average"
}
},
{
"type": "metric",
"x": 18,
"y": 3,
"width": 6,
"height": 6,
"properties": {
"metrics": [
[ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${InstanceId}", "Type", "gauge" ]
],
"view": "timeSeries",
"stacked": true,
"region": "${AWS::Region}",
"yAxis": {
"left": {
"showUnits": false
}
},
"stat": "Average",
"period": 60,
"title": "Gerrit Used memory"
}
},
{
"type": "metric",
"x": 12,
"y": 3,
"width": 6,
"height": 6,
"properties": {
"metrics": [
[ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${InstanceId}", "Type", "gauge" ]
],
"view": "timeSeries",
"stacked": true,
"title": "Gerrit System Load",
"region": "${AWS::Region}",
"yAxis": {
"left": {
"showUnits": false
}
},
"stat": "Average",
"period": 60
}
},
{
"type": "metric",
"x": 0,
"y": 9,
"width": 6,
"height": 6,
"properties": {
"metrics": [
[ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time", "InstanceId", "${InstanceId}", "Type", "gauge" ]
],
"view": "timeSeries",
"stacked": true,
"title": "GC Time",
"region": "${AWS::Region}",
"stat": "Average",
"period": 60,
"yAxis": {
"left": {
"showUnits": false
}
}
}
},
{
"type": "metric",
"x": 6,
"y": 9,
"width": 6,
"height": 6,
"properties": {
"metrics": [
[ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live", "InstanceId", "${InstanceId}", "Type", "gauge" ]
],
"view": "timeSeries",
"stacked": true,
"title": "Active Threads",
"region": "${AWS::Region}",
"period": 60,
"stat": "Average",
"yAxis": {
"left": {
"showUnits": false
}
}
}
},
{
"type": "metric",
"x": 0,
"y": 15,
"width": 6,
"height": 6,
"properties": {
"metrics": [
[ "${MetricsCloudwatchNamespace}", "http/server/rest_api/server_latency_total", "InstanceId", "${InstanceId}", "Type", "99.9%", { "id": "m2" } ]
],
"view": "timeSeries",
"stacked": true,
"region": "${AWS::Region}",
"stat": "Average",
"period": 60,
"title": "HTTP requests latency",
"yAxis": {
"left": {
"showUnits": false,
"label": "ms"
}
}
}
},
{
"type": "metric",
"x": 6,
"y": 15,
"width": 6,
"height": 6,
"properties": {
"metrics": [
[ { "expression": "RATE(m1+m2)", "label": "HTTP hits per second", "id": "e2", "region": "${AWS::Region}" } ],
[ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${InstanceId}", "Type", "count", { "id": "m2", "visible": false } ],
[ ".", "http/server/error_count_total", ".", ".", ".", ".", { "id": "m1", "visible": false } ]
],
"view": "timeSeries",
"stacked": true,
"title": "HTTP hits per second",
"region": "${AWS::Region}",
"stat": "Sum",
"period": 60,
"yAxis": {
"left": {
"showUnits": false,
"label": "ops",
"min": 0
}
}
}
},
{
"type": "metric",
"x": 12,
"y": 15,
"width": 6,
"height": 6,
"properties": {
"metrics": [
[ { "expression": "(m1/(m1+m2))*100", "label": "% of HTTP Errors", "id": "e1", "region": "${AWS::Region}" } ],
[ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${InstanceId}", "Type", "count", { "id": "m1", "visible": false } ],
[ ".", "http/server/success_count_total", ".", ".", ".", ".", { "id": "m2", "visible": false } ]
],
"view": "timeSeries",
"stacked": true,
"region": "${AWS::Region}",
"stat": "Sum",
"period": 60,
"title": "% of HTTP Errors",
"yAxis": {
"left": {
"showUnits": false,
"max": 100,
"min": 0
}
}
}
},
{
"type": "metric",
"x": 12,
"y": 9,
"width": 6,
"height": 6,
"properties": {
"metrics": [
[ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${InstanceId}", "Type", "count", { "id": "m1" } ]
],
"view": "timeSeries",
"stacked": true,
"region": "${AWS::Region}",
"title": "Git upload pack - count",
"stat": "Sum",
"period": 60,
"yAxis": {
"left": {
"showUnits": false,
"min": 0
}
}
}
},
{
"type": "metric",
"x": 0,
"y": 21,
"width": 24,
"height": 6,
"properties": {
"metrics": [
[ { "expression": "RATE(METRICS())*PERIOD(m1)", "label": "Expression1", "id": "e1" } ],
[ "${MetricsCloudwatchNamespace}", "queue/index_batch/total_scheduled_tasks_count", "InstanceId", "${InstanceId}", "Type", "gauge", { "id": "m1", "visible": false } ],
[ ".", "queue/receive_commits/total_scheduled_tasks_count", ".", ".", ".", ".", { "id": "m2", "visible": false } ],
[ ".", "queue/work_queue/total_scheduled_tasks_count", ".", ".", ".", ".", { "id": "m3", "visible": false } ],
[ ".", "queue/ssh_command_start/total_scheduled_tasks_count", ".", ".", ".", ".", { "id": "m4", "visible": false } ]
],
"view": "timeSeries",
"stacked": true,
"title": "Scheduled Tasks Queues",
"region": "${AWS::Region}",
"stat": "Sum",
"period": 60,
"yAxis": {
"left": {
"showUnits": false,
"min": 0
}
}
}
},
{
"type": "metric",
"x": 0,
"y": 27,
"width": 24,
"height": 6,
"properties": {
"metrics": [
[ "${MetricsCloudwatchNamespace}", "queue/send_email/scheduled_tasks", "InstanceId", "${InstanceId}", "Type", "gauge" ]
],
"view": "timeSeries",
"stacked": true,
"region": "${AWS::Region}",
"title": "Scheduled email tasks in the queue",
"stat": "Sum",
"period": 300,
"yAxis": {
"left": {
"showUnits": false
}
}
}
},
{
"type": "metric",
"x": 0,
"y": 33,
"width": 12,
"height": 6,
"properties": {
"metrics": [
[ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${InstanceId}", "Type", "gauge" ]
],
"view": "timeSeries",
"stacked": true,
"title": "Pack files cached",
"region": "${AWS::Region}",
"stat": "Sum",
"period": 60,
"yAxis": {
"left": {
"showUnits": false
}
}
}
},
{
"type": "metric",
"x": 0,
"y": 3,
"width": 6,
"height": 6,
"properties": {
"metrics": [
[ "AWS/EC2", "CPUUtilization" ]
],
"view": "timeSeries",
"stacked": true,
"region": "${AWS::Region}",
"title": "Cluster CPU Load",
"period": 60,
"stat": "Average"
}
}
]
}
Outputs:
########
# HTTP #
########
GerritHTTPLoadBalancerDNSName:
Description: The DNS name of the Gerrit HTTP load balancer
Value: !GetAtt 'GerritHTTPLoadBalancer.DNSName'
Export:
Name: !Join [ ':', [ !Ref 'AWS::StackName', 'GerritHTTPLoadBalancerDNSName' ] ]
GerritHTTPCanonicalHostedZoneID:
Description: Canonical Hosted Zone ID of the Gerrit HTTP load balancer
Value: !GetAtt 'GerritHTTPLoadBalancer.CanonicalHostedZoneID'
Export:
Name: !Join [ ':', [ !Ref 'AWS::StackName', 'GerritHTTPCanonicalHostedZoneID' ] ]
GerritHTTPLoadBalancerUrl:
Description: The url of the Gerrit HTTP load balancer
Value: !Join ['', ['http://', !GetAtt 'GerritHTTPLoadBalancer.DNSName']]
Export:
Name: !Join [ ':', [ !Ref 'AWS::StackName', 'GerritHTTPLoadBalancerUrl' ] ]
#######
# SSH #
#######
GerritSSHLoadBalancerDNSName:
Description: The DNS name of the Gerrit SSH load balancer
Value: !GetAtt 'GerritSSHLoadBalancer.DNSName'
Export:
Name: !Join [ ':', [ !Ref 'AWS::StackName', 'GerritSSHLoadBalancerDNSName' ] ]
GerritSSHCanonicalHostedZoneID:
Description: Canonical Hosted Zone ID of the Gerrit SSH load balancer
Value: !GetAtt 'GerritSSHLoadBalancer.CanonicalHostedZoneID'
Export:
Name: !Join [ ':', [ !Ref 'AWS::StackName', 'GerritSSHCanonicalHostedZoneID' ] ]
GerritSSHLoadBalancerUrl:
Description: The url of the Gerrit SSH load balancer
Value: !Join ['', ['http://', !GetAtt 'GerritSSHLoadBalancer.DNSName']]
Export:
Name: !Join [ ':', [ !Ref 'AWS::StackName', 'GerritSSHLoadBalancerUrl' ] ]
#######
# DNS #
#######
HostedZoneName:
Description: Route53 Hosted Zone name
Value: !Ref HostedZoneName
Export:
Name: !Join [ ':', [ !Ref 'AWS::StackName', 'HostedZoneName' ] ]
HttpSubdomain:
Description: Service DNS subdomain for HTTP traffic
Value: !Ref HttpSubdomain
Export:
Name: !Join [ ':', [ !Ref 'AWS::StackName', 'HttpSubdomain' ] ]
SshSubdomain:
Description: Service DNS subdomain for SSH traffic
Value: !Ref SshSubdomain
Export:
Name: !Join [ ':', [ !Ref 'AWS::StackName', 'SshSubdomain' ] ]
CanonicalWebUrl:
Description: Canonical Web URL
Value: !Sub 'https://${HttpSubdomain}.${HostedZoneName}'
Export:
Name: !Join [ ':', [ !Ref 'AWS::StackName', 'CanonicalWebUrl' ] ]