Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add redis url & autoscaling for passport #1954

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion infra/aws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ const taskDefinition = new aws.ecs.TaskDefinition(`passport-iam`, {
environment: [{
name: "CGRANTS_API_URL",
value: "https://api.scorer.gitcoin.co/cgrants"
}, {
name: "REDIS_URL",
value: redisConnectionUrl,
}],
logConfiguration: {
logDriver: "awslogs",
Expand Down Expand Up @@ -427,14 +430,30 @@ const service = new aws.ecs.Service(`passport-iam`, {
dependsOn: [albTargetGroup, taskDefinition]
});

const ecsTarget = new aws.appautoscaling.Target("autoscaling_target", {
const ecsAutoScalingTarget = new aws.appautoscaling.Target("autoscaling_target", {
maxCapacity: 10,
minCapacity: 1,
resourceId: pulumi.interpolate`service/${cluster.name}/${service.name}`,
scalableDimension: "ecs:service:DesiredCount",
serviceNamespace: "ecs",
});

const ecsAutoScalingPolicy = new aws.appautoscaling.Policy("passport-autoscaling-policy", {
policyType: "TargetTrackingScaling",
resourceId: ecsAutoScalingTarget.resourceId,
scalableDimension: ecsAutoScalingTarget.scalableDimension,
serviceNamespace: ecsAutoScalingTarget.serviceNamespace,
targetTrackingScalingPolicyConfiguration: {
predefinedMetricSpecification: {
predefinedMetricType: "ECSServiceAverageCPUUtilization",
},
targetValue: 50,
scaleInCooldown: 300,
scaleOutCooldown: 300,
},
});


const serviceRecord = new aws.route53.Record("passport-record", {
name: route53Domain,
zoneId: route53Zone,
Expand Down
Loading