Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Pocket/pocket-monorepo into feat/br…
Browse files Browse the repository at this point in the history
…aze-waf
  • Loading branch information
bassrock committed Aug 28, 2024
2 parents c9ce285 + 8dc3a73 commit 7d927c3
Show file tree
Hide file tree
Showing 18 changed files with 4,032 additions and 291 deletions.
73 changes: 5 additions & 68 deletions infrastructure/braze-content-proxy/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { Construct } from 'constructs';
import {
App,
DataTerraformRemoteState,
S3Backend,
TerraformStack,
} from 'cdktf';
import { App, S3Backend, TerraformStack } from 'cdktf';
import {
provider as awsProvider,
dataAwsCallerIdentity,
Expand All @@ -15,10 +10,7 @@ import {
wafv2IpSet,
} from '@cdktf/provider-aws';
import { config } from './config';
import {
PocketALBApplication,
PocketPagerDuty,
} from '@pocket-tools/terraform-modules';
import { PocketALBApplication } from '@pocket-tools/terraform-modules';
import { provider as localProvider } from '@cdktf/provider-local';
import { provider as nullProvider } from '@cdktf/provider-null';
import { provider as pagerDutyProvider } from '@cdktf/provider-pagerduty';
Expand Down Expand Up @@ -52,7 +44,6 @@ class BrazeContentProxy extends TerraformStack {
);

this.createPocketAlbApplication({
pagerDuty: this.createPagerDuty(),
secretsManagerKmsAlias: this.getSecretsManagerKmsAlias(),
snsTopic: this.getCodeDeploySnsTopic(),
region,
Expand Down Expand Up @@ -150,57 +141,15 @@ class BrazeContentProxy extends TerraformStack {
});
}

/**
* Create PagerDuty service for alerts
* @private
*/
private createPagerDuty() {
// don't create any pagerduty resources if in dev
if (config.isDev) {
return undefined;
}

const incidentManagement = new DataTerraformRemoteState(
this,
'incident_management',
{
organization: 'Pocket',
workspaces: {
name: 'incident-management',
},
},
);

return new PocketPagerDuty(this, 'pagerduty', {
prefix: config.prefix,
service: {
// This is a Tier 2 service and as such only raises non-critical alarms.
criticalEscalationPolicyId: incidentManagement
.get('policy_default_non_critical_id')
.toString(),
nonCriticalEscalationPolicyId: incidentManagement
.get('policy_default_non_critical_id')
.toString(),
},
});
}

private createPocketAlbApplication(dependencies: {
pagerDuty: PocketPagerDuty;
region: dataAwsRegion.DataAwsRegion;
caller: dataAwsCallerIdentity.DataAwsCallerIdentity;
secretsManagerKmsAlias: dataAwsKmsAlias.DataAwsKmsAlias;
snsTopic: dataAwsSnsTopic.DataAwsSnsTopic;
wafAcl: wafv2WebAcl.Wafv2WebAcl;
}): PocketALBApplication {
const {
pagerDuty,
region,
caller,
secretsManagerKmsAlias,
snsTopic,
wafAcl,
} = dependencies;
const { region, caller, secretsManagerKmsAlias, snsTopic, wafAcl } =
dependencies;

return new PocketALBApplication(this, 'application', {
internal: false,
Expand Down Expand Up @@ -242,18 +191,6 @@ class BrazeContentProxy extends TerraformStack {
},
],
},
{
name: 'xray-daemon',
containerImage: 'public.ecr.aws/xray/aws-xray-daemon:latest',
portMappings: [
{
hostPort: 2000,
containerPort: 2000,
protocol: 'udp',
},
],
command: ['--region', 'us-east-1', '--local-mode'],
},
],
codeDeploy: {
useCodeDeploy: true,
Expand Down Expand Up @@ -324,7 +261,7 @@ class BrazeContentProxy extends TerraformStack {
threshold: 25,
evaluationPeriods: 4,
period: 300,
actions: config.isDev ? [] : [pagerDuty.snsNonCriticalAlarmTopic.arn],
actions: config.isDev ? [] : [snsTopic.arn],
},
},
});
Expand Down
3 changes: 2 additions & 1 deletion packages/apollo-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dev": "pnpm run build --watch",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"presemantic-release": "pnpm run build",
"semantic-release": "semantic-release",
"test": "jest",
"test:watch": "pnpm run test -- --watch"
Expand Down Expand Up @@ -113,4 +114,4 @@
"graphql": "16.8.1",
"graphql-tag": "2.12.6"
}
}
}
3 changes: 2 additions & 1 deletion packages/lambda-secrets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"dev": "pnpm run build --watch",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"presemantic-release": "pnpm run build",
"semantic-release": "semantic-release"
},
"release": {
Expand Down Expand Up @@ -86,4 +87,4 @@
"tsup": "8.2.4",
"typescript": "5.5.4"
}
}
}
3 changes: 2 additions & 1 deletion packages/terraform-modules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"example:synth": "cdktf synth",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"presemantic-release": "pnpm run build",
"semantic-release": "semantic-release",
"test": "jest --ci --maxWorkers=4 --logHeapUsage",
"test:watch": "npm test -- --watch --watch-extensions ts -R min --watch-files src"
Expand Down Expand Up @@ -94,4 +95,4 @@
"tsup": "8.2.4",
"typescript": "5.5.4"
}
}
}
3 changes: 2 additions & 1 deletion packages/tracing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dev": "pnpm run build --watch",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"presemantic-release": "pnpm run build",
"semantic-release": "semantic-release"
},
"release": {
Expand Down Expand Up @@ -105,4 +106,4 @@
"tsup": "8.2.4",
"typescript": "5.5.4"
}
}
}
3 changes: 2 additions & 1 deletion packages/ts-logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"dev": "pnpm run build --watch",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"presemantic-release": "pnpm run build",
"semantic-release": "semantic-release",
"test": "jest",
"test:watch": "pnpm run test -- --watch"
Expand Down Expand Up @@ -86,4 +87,4 @@
"tsup": "8.2.4",
"typescript": "5.5.4"
}
}
}
Loading

0 comments on commit 7d927c3

Please sign in to comment.