Skip to content

Commit

Permalink
(improvment): fdr cdk accepts memory and cpu parameters (#799)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi authored May 5, 2024
1 parent 6204445 commit 353d26d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions servers/fdr-deploy/bin/fdr-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ async function main() {
desiredTaskCount: 2,
maxTaskCount: 4,
redis: true,
memory: 1024,
cpu: 512,
},
{
env: { account: "985111089818", region: "us-east-1" },
Expand All @@ -47,6 +49,8 @@ async function main() {
desiredTaskCount: 1,
maxTaskCount: 1,
redis: false,
memory: 8192,
cpu: 4096,
},
{
env: { account: "985111089818", region: "us-east-1" },
Expand Down
9 changes: 5 additions & 4 deletions servers/fdr-deploy/scripts/fdr-deploy-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ interface FdrStackOptions {
redis: boolean;
maxTaskCount: number;
desiredTaskCount: number;
cpu: number;
memory: number;
}

export class FdrDeployStack extends Stack {
Expand Down Expand Up @@ -118,12 +120,11 @@ export class FdrDeployStack extends Stack {
hostedZoneId: environmentInfo.route53Info.hostedZoneId,
zoneName: environmentInfo.route53Info.hostedZoneName,
});
const redisEnabled = environmentType !== "PROD";
const fargateService = new ApplicationLoadBalancedFargateService(this, SERVICE_NAME, {
serviceName: SERVICE_NAME,
cluster,
cpu: environmentType === "PROD" ? 4096 : 512,
memoryLimitMiB: environmentType === "PROD" ? 8192 : 1024,
cpu: options.cpu,
memoryLimitMiB: options.memory,
desiredCount: options.desiredTaskCount,
securityGroups: [fdrSg, efsSg],
taskImageOptions: {
Expand All @@ -143,7 +144,7 @@ export class FdrDeployStack extends Stack {
LOG_LEVEL: getLogLevel(environmentType),
DOCS_CACHE_ENDPOINT: fernDocsCacheEndpoint,
ENABLE_CUSTOMER_NOTIFICATIONS: (environmentType === "PROD").toString(),
REDIS_ENABLED: redisEnabled.toString(),
REDIS_ENABLED: options.redis.toString(),
APPLICATION_ENVIRONMENT: getEnvironmentVariableOrThrow("APPLICATION_ENVIRONMENT"),
},
containerName: CONTAINER_NAME,
Expand Down

0 comments on commit 353d26d

Please sign in to comment.