Skip to content

Commit

Permalink
Merge pull request #15 from Rungutan/issue-14
Browse files Browse the repository at this point in the history
Issue 14
  • Loading branch information
mariusmitrofan authored Jan 24, 2021
2 parents 44bdd0a + bcbf359 commit 28fde6d
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 3 deletions.
File renamed without changes.
41 changes: 41 additions & 0 deletions .github/workflows/release-s3-push-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: release-s3-push-template

on:
push:
tags:
- '*'

jobs:
sentry-base:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Upload template file to bucket with latest
uses: ItsKarma/[email protected]
with:
args: s3 cp cloudformation-template.yaml s3://sentry-performance-monitoring/cloudformation-template.yaml
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
- name: Upload template file to bucket with tag
uses: ItsKarma/[email protected]
with:
args: s3 cp cloudformation-template.yaml s3://sentry-performance-monitoring/${{ steps.get_version.outputs.VERSION }}/cloudformation-template.yaml
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
- name: Login to ECR
uses: docker/login-action@v1
with:
registry: public.ecr.aws
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
env:
AWS_REGION: ${{ secrets.AWS_REGION }}

57 changes: 54 additions & 3 deletions cloudformation-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,14 @@ Parameters:
Type: String
Default: "10"

DesiredCountSentryWorkers:
MinCountSentryWorkers:
Type: String
Default: "1"

MaxCountSentryWorkers:
Type: String
Default: "10"

SentrySystemSecretKey:
Type: String
NoEcho: true
Expand Down Expand Up @@ -500,7 +504,8 @@ Metadata:
- MaxCountSnubaTransactionsConsumer
- MinCountSnubaEventsReplacer
- MaxCountSnubaEventsReplacer
- DesiredCountSentryWorkers
- MinCountSentryWorkers
- MaxCountSentryWorkers
- SentrySystemSecretKey

- Label:
Expand Down Expand Up @@ -4811,7 +4816,7 @@ Resources:
MinimumHealthyPercent: 100
MaximumPercent: 200
DesiredCount:
Ref: DesiredCountSentryWorkers
Ref: MinCountSentryWorkers
PropagateTags: SERVICE
NetworkConfiguration:
AwsvpcConfiguration:
Expand All @@ -4823,6 +4828,52 @@ Resources:
SecurityGroups:
- Ref: Ec2SecurityGroup

AutoScalingTargetSentryWorkers:
Type: AWS::ApplicationAutoScaling::ScalableTarget
Properties:
MaxCapacity:
Ref: MaxCountSentryWorkers
MinCapacity:
Ref: MinCountSentryWorkers
ResourceId:
Fn::Sub: service/${ClusterWorkers}/${ServiceSentryWorkers.Name}
RoleARN:
Fn::GetAtt: ScalingRole.Arn
ScalableDimension: ecs:service:DesiredCount
ServiceNamespace: ecs

CpuAutoScalingPolicySentryWorkers:
Type: AWS::ApplicationAutoScaling::ScalingPolicy
Properties:
PolicyName:
Fn::Sub: ${AWS::StackName}-Cpu-SentryWorkers
PolicyType: TargetTrackingScaling
ScalingTargetId:
Ref: AutoScalingTargetSentryWorkers
TargetTrackingScalingPolicyConfiguration:
DisableScaleIn: false
TargetValue: 40
ScaleInCooldown: 600
ScaleOutCooldown: 60
PredefinedMetricSpecification:
PredefinedMetricType: ECSServiceAverageCPUUtilization

RamAutoScalingPolicySentryWorkers:
Type: AWS::ApplicationAutoScaling::ScalingPolicy
Properties:
PolicyName:
Fn::Sub: ${AWS::StackName}-Ram-SentryWorkers
PolicyType: TargetTrackingScaling
ScalingTargetId:
Ref: AutoScalingTargetSentryWorkers
TargetTrackingScalingPolicyConfiguration:
DisableScaleIn: false
TargetValue: 40
ScaleInCooldown: 600
ScaleOutCooldown: 60
PredefinedMetricSpecification:
PredefinedMetricType: ECSServiceAverageMemoryUtilization

TaskDefinitionClickHouseBootstrap:
Type: AWS::ECS::TaskDefinition
Properties:
Expand Down

0 comments on commit 28fde6d

Please sign in to comment.