Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

remove org service infra (#1237)

Will Hutchinson1d392a473a9e
diff --git a/infra/bun.lock b/infra/bun.lock
index ebd196a9da..015a5902db 100644
--- a/infra/bun.lock
+++ b/infra/bun.lock
@@ -142,10 +142,6 @@
"name": "organization-retention-stack",
"version": "0.0.0",
},
- "stacks/organization-service": {
- "name": "organization-service-stack",
- "version": "0.0.0",
- },
"stacks/properties-service": {
"name": "properties-service-stack",
"version": "0.0.0",
@@ -826,8 +822,6 @@
"organization-retention-stack": ["organization-retention-stack@workspace:stacks/organization-retention"],
- "organization-service-stack": ["organization-service-stack@workspace:stacks/organization-service"],
-
"p-cancelable": ["[email protected]", "", {}, "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg=="],
"p-limit": ["[email protected]", "", { "dependencies": { "yocto-queue": "^1.0.0" } }, "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ=="],
diff --git a/infra/stacks/organization-service/Pulumi.dev.yaml b/infra/stacks/organization-service/Pulumi.dev.yaml
deleted file mode 100644
index 63b6aac083..0000000000
--- a/infra/stacks/organization-service/Pulumi.dev.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-config:
- aws-native:region: us-east-1
- aws:region: us-east-1
- organization-service:document_storage_service_auth_key: document-storage-service-auth-key-dev
- organization-service:legacy_jwt_secret_key: jwt-secret-dev
- organization-service:macro_db_secret_key: macro-db-dev
- organization-service:macro_cache_secret_key: macro-cache-dev
- organization-service:jwt_secret_key: fusionauth-jwt-secret-dev
- organization-service:fusionauth_client_id: fusionauth-client-id-key-dev
- organization-service:fusionauth_issuer: fusionauth-dev.macro.com
- organization-service:authentication_service_internal_api_key: authentication-service-internal-api-key-dev
diff --git a/infra/stacks/organization-service/Pulumi.prod.yaml b/infra/stacks/organization-service/Pulumi.prod.yaml
deleted file mode 100644
index 976d7a82f3..0000000000
--- a/infra/stacks/organization-service/Pulumi.prod.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-config:
- aws-native:region: us-east-1
- aws:region: us-east-1
- organization-service:document_storage_service_auth_key: document-storage-service-auth-key-prod
- organization-service:legacy_jwt_secret_key: jwt-secret-prod
- organization-service:macro_db_secret_key: macro-db-prod
- organization-service:macro_cache_secret_key: macro-cache-prod
- organization-service:jwt_secret_key: fusionauth-jwt-secret-prod
- organization-service:fusionauth_client_id: fusionauth-client-id-key-prod
- organization-service:fusionauth_issuer: auth.macro.com
- organization-service:authentication_service_internal_api_key: authentication-service-internal-api-key-prod
diff --git a/infra/stacks/organization-service/Pulumi.yaml b/infra/stacks/organization-service/Pulumi.yaml
deleted file mode 100644
index c5956967f8..0000000000
--- a/infra/stacks/organization-service/Pulumi.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-name: organization-service
-runtime: nodejs
-description: Macro Organization Service
diff --git a/infra/stacks/organization-service/index.ts b/infra/stacks/organization-service/index.ts
deleted file mode 100644
index 278a967bea..0000000000
--- a/infra/stacks/organization-service/index.ts
+++ /dev/null
@@ -1,168 +0,0 @@
-import * as aws from '@pulumi/aws';
-import * as pulumi from '@pulumi/pulumi';
-import { config, getMacroApiToken, stack } from '../../packages/shared';
-import { get_coparse_api_vpc } from '../../packages/vpc';
-import { OrganizationService } from './organization-service';
-
-const tags = {
- environment: stack,
- tech_lead: 'hutch',
- project: 'organization-service',
-};
-
-const DATABASE_URL = aws.secretsmanager
- .getSecretVersionOutput({
- secretId: config.require(`macro_db_secret_key`),
- })
- .apply((secret) => secret.secretString);
-
-const MACRO_CACHE = aws.secretsmanager
- .getSecretVersionOutput({
- secretId: config.require(`macro_cache_secret_key`),
- })
- .apply((secret) => secret.secretString);
-
-const LEGACY_JWT_SECRET = aws.secretsmanager
- .getSecretVersionOutput({
- secretId: config.require(`legacy_jwt_secret_key`),
- })
- .apply((secret) => secret.secretString);
-
-const DOCUMENT_STORAGE_SERVICE_AUTH_KEY = aws.secretsmanager
- .getSecretVersionOutput({
- secretId: config.require(`document_storage_service_auth_key`),
- })
- .apply((secret) => secret.secretString);
-
-const JWT_SECRET_KEY = config.require(`jwt_secret_key`);
-const jwtSecretKeyArn: pulumi.Output<string> = aws.secretsmanager
- .getSecretVersionOutput({ secretId: JWT_SECRET_KEY })
- .apply((secret) => secret.arn);
-
-const AUTHENTICATION_SERVICE_INTERNAL_API_SECRET_KEY = config.require(
- `authentication_service_internal_api_key`
-);
-const authInternalSecretKeyArn: pulumi.Output<string> = aws.secretsmanager
- .getSecretVersionOutput({
- secretId: AUTHENTICATION_SERVICE_INTERNAL_API_SECRET_KEY,
- })
- .apply((secret) => secret.arn);
-
-const fusionauthClientIdSecretKey = config.require(`fusionauth_client_id`);
-
-const FUSIONAUTH_CLIENT_ID = aws.secretsmanager
- .getSecretVersionOutput({
- secretId: fusionauthClientIdSecretKey,
- })
- .apply((secret) => secret.secretString);
-const FUSIONAUTH_ISSUER = config.require(`fusionauth_issuer`);
-
-export const coparse_api_vpc = get_coparse_api_vpc();
-
-const cloudStorageStack = new pulumi.StackReference('cloud-storage-stack', {
- name: `macro-inc/document-storage/${stack}`,
-});
-
-const cloudStorageClusterArn: pulumi.Output<string> = cloudStorageStack
- .getOutput('cloudStorageClusterArn')
- .apply((arn) => arn as string);
-
-const cloudStorageClusterName: pulumi.Output<string> = cloudStorageStack
- .getOutput('cloudStorageClusterName')
- .apply((arn) => arn as string);
-
-export const INVITE_EMAIL = `invite${
- stack === 'prod' ? '' : `-${stack}`
-}@macro.com`;
-
-const MACRO_API_TOKENS = getMacroApiToken();
-
-const organizationService = new OrganizationService(
- `organization-service-${stack}`,
- {
- ecsClusterArn: cloudStorageClusterArn,
- cloudStorageClusterName: cloudStorageClusterName,
- secretKeyArns: [
- jwtSecretKeyArn,
- authInternalSecretKeyArn,
- MACRO_API_TOKENS.macroApiTokenPublicKeyArn,
- ],
- vpc: coparse_api_vpc,
- platform: {
- family: 'linux',
- architecture: 'amd64',
- },
- serviceContainerPort: 8080,
- healthCheckPath: '/health',
- containerEnvVars: [
- {
- name: 'DATABASE_URL',
- value: pulumi.interpolate`${DATABASE_URL}`,
- },
- {
- name: 'REDIS_URI',
- value: pulumi.interpolate`redis://${MACRO_CACHE}`,
- },
- {
- name: 'LEGACY_JWT_SECRET',
- value: pulumi.interpolate`${LEGACY_JWT_SECRET}`,
- },
- {
- name: 'INTERNAL_API_SECRET_KEY',
- value: pulumi.interpolate`${DOCUMENT_STORAGE_SERVICE_AUTH_KEY}`,
- },
- {
- name: 'DOCUMENT_STORAGE_SERVICE_URL',
- value: `https://cloud-storage${
- stack === 'prod' ? '' : `-${stack}`
- }.macro.com`,
- },
- {
- name: 'INVITE_EMAIL',
- value: pulumi.interpolate`${INVITE_EMAIL}`,
- },
- {
- name: 'ENVIRONMENT',
- value: stack,
- },
- {
- name: 'RUST_LOG',
- value: `organization_service=${
- stack === 'prod' ? 'debug' : 'trace'
- },tower_http=debug`,
- },
- { name: 'ISSUER', value: pulumi.interpolate`${FUSIONAUTH_ISSUER}` },
- {
- name: 'JWT_SECRET_KEY',
- value: pulumi.interpolate`${JWT_SECRET_KEY}`,
- },
- {
- name: 'AUDIENCE',
- value: pulumi.interpolate`${FUSIONAUTH_CLIENT_ID}`,
- },
- {
- name: 'AUTHENTICATION_SERVICE_URL',
- value: `https://auth-service${stack === 'prod' ? '' : '-dev'}.macro.com`,
- },
- {
- name: 'AUTHENTICATION_SERVICE_INTERNAL_API_SECRET_KEY',
- value: pulumi.interpolate`${AUTHENTICATION_SERVICE_INTERNAL_API_SECRET_KEY}`,
- },
- {
- name: 'MACRO_API_TOKEN_ISSUER',
- value: pulumi.interpolate`${MACRO_API_TOKENS.macroApiTokenIssuer}`,
- },
- {
- name: 'MACRO_API_TOKEN_PUBLIC_KEY',
- value: pulumi.interpolate`${MACRO_API_TOKENS.macroApiTokenPublicKey}`,
- },
- ],
- isPrivate: false,
- tags,
- }
-);
-
-export const organizationServiceRoleArn = organizationService.role.arn;
-export const organizationServiceSgId = organizationService.serviceSg.id;
-export const organizationServiceAlbSgId = organizationService.serviceAlbSg.id;
-export const organizationServiceUrl = pulumi.interpolate`${organizationService.domain}`;
diff --git a/infra/stacks/organization-service/organization-service.ts b/infra/stacks/organization-service/organization-service.ts
deleted file mode 100644
index 4374045507..0000000000
--- a/infra/stacks/organization-service/organization-service.ts
+++ /dev/null
@@ -1,538 +0,0 @@
-import * as aws from '@pulumi/aws';
-import * as awsx from '@pulumi/awsx';
-import * as pulumi from '@pulumi/pulumi';
-import {
- DATADOG_API_KEY,
- datadogAgentContainer,
- fargateLogRouterSidecarContainer,
- serviceLoadBalancer,
-} from '../../packages/resources';
-import { EcrImage } from '../../packages/service';
-import {
- awsRegion,
- BASE_DOMAIN,
- CLOUD_TRAIL_SNS_TOPIC_ARN,
- stack,
-} from '../../packages/shared';
-
-const BASE_NAME = 'organization-service';
-const BASE_PATH = '../../../rust/cloud-storage';
-
-export const SERVICE_DOMAIN_NAME = `organization-service${
- stack === 'prod' ? '' : `-${stack}`
-}.${BASE_DOMAIN}`;
-
-type CreateOrganizationServiceArgs = {
- cloudStorageClusterName: pulumi.Output<string> | string;
- ecsClusterArn: pulumi.Output<string> | string;
- vpc: {
- vpcId: pulumi.Output<string> | string;
- publicSubnetIds: pulumi.Output<string[]> | string[];
- privateSubnetIds: pulumi.Output<string[]> | string[];
- };
- platform: { family: string; architecture: 'amd64' | 'arm64' };
- serviceContainerPort: number;
- isPrivate?: boolean;
- containerEnvVars?: { name: string; value: pulumi.Output<string> | string }[];
- healthCheckPath: string;
- secretKeyArns: (pulumi.Output<string> | string)[];
- tags: { [key: string]: string };
-};
-
-export class OrganizationService extends pulumi.ComponentResource {
- public role: aws.iam.Role;
- public ecr: awsx.ecr.Repository;
- public serviceAlbSg: aws.ec2.SecurityGroup;
- public serviceSg: aws.ec2.SecurityGroup;
- public targetGroup: aws.lb.TargetGroup;
- public lb: aws.lb.LoadBalancer;
- public listener: aws.lb.Listener;
- public service: awsx.ecs.FargateService;
- public domain: string;
- public cloudStorageClusterName: pulumi.Output<string> | string;
- public tags: { [key: string]: string };
-
- constructor(
- name: string,
- {
- ecsClusterArn,
- vpc,
- platform,
- serviceContainerPort,
- healthCheckPath,
- isPrivate,
- containerEnvVars,
- cloudStorageClusterName,
- secretKeyArns,
- tags,
- }: CreateOrganizationServiceArgs,
- opts?: pulumi.ComponentResourceOptions
- ) {
- super('my:components:CloudStorageService', name, {}, opts);
- this.tags = tags;
-
- this.cloudStorageClusterName = cloudStorageClusterName;
-
- // role
- const secretsManagerPolicy = new aws.iam.Policy(
- `${BASE_NAME}-secrets-manager-policy`,
- {
- name: `${BASE_NAME}-secrets-manager-policy-${stack}`,
- policy: {
- Version: '2012-10-17',
- Statement: [
- {
- Action: [
- 'secretsmanager:GetSecretValue',
- 'secretsmanager:DescribeSecret',
- ],
- Resource: [...secretKeyArns],
- Effect: 'Allow',
- },
- ],
- },
- tags: this.tags,
- },
- { parent: this }
- );
- const sesPolicy = new aws.iam.Policy(
- `${BASE_NAME}-ses-policy`,
- {
- name: `${BASE_NAME}-ses-policy-${stack}`,
- policy: {
- Version: '2012-10-17',
- Statement: [
- {
- Action: [
- 'ses:SendEmail',
- 'ses:SendRawEmail',
- 'ses:SendTemplatedEmail',
- ],
- Resource: [
- `arn:aws:ses:${awsRegion}:569036502058:identity/macro.com`,
- ],
- Effect: 'Allow',
- },
- ],
- },
- tags: this.tags,
- },
- { parent: this }
- );
-
- this.role = new aws.iam.Role(
- `${BASE_NAME}-role`,
- {
- name: `${BASE_NAME}-role-${stack}`,
- assumeRolePolicy: {
- Version: '2012-10-17',
- Statement: [
- {
- Action: 'sts:AssumeRole',
- Principal: {
- Service: 'ecs-tasks.amazonaws.com',
- },
- Effect: 'Allow',
- Sid: '',
- },
- ],
- },
- tags: this.tags,
- managedPolicyArns: [sesPolicy.arn, secretsManagerPolicy.arn],
- },
- { parent: this }
- );
-
- // ecr image
- const image = new EcrImage(
- `${BASE_NAME}-ecr-image-${stack}`,
- {
- repositoryId: `${BASE_NAME}-ecr-${stack}`,
- repositoryName: `${BASE_NAME}-${stack}`,
- imageId: `${BASE_NAME}-image-${stack}`,
- imagePath: BASE_PATH,
- dockerfile: 'Dockerfile',
- platform,
- buildArgs: {
- SERVICE_NAME: 'organization_service',
- },
- tags: this.tags,
- },
- { parent: this }
- );
- this.ecr = image.ecr;
-
- // sg
- const sg = this.initializeSecurityGroups({
- vpcId: vpc.vpcId,
- serviceContainerPort,
- });
- this.serviceAlbSg = sg.serviceAlbSg;
- this.serviceSg = sg.serviceSg;
-
- // lb
- const { targetGroup, lb, listener } = serviceLoadBalancer(this, {
- serviceName: BASE_NAME, // service name
- serviceContainerPort,
- healthCheckPath,
- vpc,
- albSecurityGroupId: this.serviceAlbSg.id,
- isPrivate,
- tags,
- });
- this.targetGroup = targetGroup;
- this.lb = lb;
- this.listener = listener;
-
- // service
- const service = new awsx.ecs.FargateService(
- `${BASE_NAME}`,
- {
- tags,
- cluster: ecsClusterArn,
- networkConfiguration: {
- subnets: vpc.privateSubnetIds,
- securityGroups: [this.serviceSg.id],
- },
- taskDefinitionArgs: {
- taskRole: {
- roleArn: this.role.arn,
- },
- containers: {
- log_router: fargateLogRouterSidecarContainer,
- datadog_agent: datadogAgentContainer,
- service: {
- name: BASE_NAME,
- image: image.image.imageUri,
- stopTimeout: 10, // 10 seconds to force kill the task
- cpu: stack === 'prod' ? 1024 : 256,
- memory: stack === 'prod' ? 2048 : 512,
- environment: containerEnvVars,
- logConfiguration: {
- logDriver: 'awsfirelens',
- options: {
- Name: 'datadog',
- Host: 'http-intake.logs.us5.datadoghq.com',
- apikey: DATADOG_API_KEY,
- dd_service: `organization-service-${stack}`,
- dd_source: 'fargate',
- dd_tags: `project:cloudstorage, env:${stack}`,
- provider: 'ecs',
- },
- },
- portMappings: [
- {
- appProtocol: 'http',
- name: `${BASE_NAME}-tcp-${stack}`,
- hostPort: serviceContainerPort,
- containerPort: serviceContainerPort,
- targetGroup,
- },
- ],
- },
- },
- runtimePlatform: {
- operatingSystemFamily: `${platform.family.toUpperCase()}`,
- cpuArchitecture: `${
- platform.architecture === 'amd64'
- ? 'X86_64'
- : platform.architecture.toUpperCase()
- }`,
- },
- },
- desiredCount: 1,
- },
- { parent: this }
- );
-
- this.service = service;
-
- this.setupAutoScaling();
-
- this.setupServiceAlarms();
-
- // domain record
- const zone = aws.route53.getZoneOutput({ name: BASE_DOMAIN });
-
- new aws.route53.Record(
- `${BASE_NAME}-domain-record`,
- {
- name: SERVICE_DOMAIN_NAME,
- type: 'A',
- zoneId: zone.zoneId,
- aliases: [
- {
- evaluateTargetHealth: false,
- name: this.lb.dnsName,
- zoneId: this.lb.zoneId,
- },
- ],
- },
- { parent: this }
- );
-
- this.domain = `https://${SERVICE_DOMAIN_NAME}`;
- }
-
- initializeSecurityGroups({
- vpcId,
- serviceContainerPort,
- }: {
- vpcId: pulumi.Output<string> | string;
- serviceContainerPort: number;
- }) {
- const serviceAlbSg = new aws.ec2.SecurityGroup(
- `${BASE_NAME}-alb-sg-${stack}`,
- {
- name: `${BASE_NAME}-alb-sg-${stack}`,
- description: `${BASE_NAME} application load balancer security group`,
- vpcId,
- tags: this.tags,
- },
- { parent: this }
- );
-
- const serviceSg = new aws.ec2.SecurityGroup(
- `${BASE_NAME}-sg-${stack}`,
- {
- name: `${BASE_NAME}-sg-${stack}`,
- vpcId,
- description: `${BASE_NAME} security group that is attached directly to the service`,
- tags: this.tags,
- },
- { parent: this }
- );
-
- new aws.vpc.SecurityGroupIngressRule(
- `${BASE_NAME}-alb-in`,
- {
- securityGroupId: serviceSg.id,
- description: 'Allow inbound traffic from the services ALB',
- referencedSecurityGroupId: serviceAlbSg.id,
- fromPort: serviceContainerPort,
- toPort: serviceContainerPort,
- ipProtocol: 'tcp',
- tags: this.tags,
- },
- { parent: this }
- );
-
- new aws.vpc.SecurityGroupEgressRule(
- `${BASE_NAME}-all-out`,
- {
- securityGroupId: serviceSg.id,
- description: 'Allow all outbound',
- cidrIpv4: '0.0.0.0/0',
- ipProtocol: '-1',
- tags: this.tags,
- },
- { parent: this }
- );
-
- // ALB SG rules
- new aws.vpc.SecurityGroupIngressRule(
- `${BASE_NAME}-http`,
- {
- securityGroupId: serviceAlbSg.id,
- description: 'Allow inbound HTTP traffic',
- cidrIpv4: '0.0.0.0/0',
- fromPort: 80,
- ipProtocol: 'tcp',
- toPort: 80,
- tags: this.tags,
- },
- { parent: this }
- );
-
- new aws.vpc.SecurityGroupIngressRule(
- `${BASE_NAME}-https`,
- {
- securityGroupId: serviceAlbSg.id,
- description: 'Allow inbound HTTPS traffic',
- cidrIpv4: '0.0.0.0/0',
- fromPort: 443,
- ipProtocol: 'tcp',
- toPort: 443,
- tags: this.tags,
- },
- { parent: this }
- );
-
- new aws.vpc.SecurityGroupEgressRule(
- `${BASE_NAME}-out-service`,
- {
- description: 'Allow traffic to the service security group',
- securityGroupId: serviceAlbSg.id,
- referencedSecurityGroupId: serviceSg.id,
- fromPort: serviceContainerPort,
- ipProtocol: 'tcp',
- toPort: serviceContainerPort,
- tags: this.tags,
- },
- { parent: this }
- );
-
- return { serviceAlbSg, serviceSg };
- }
-
- setupAutoScaling() {
- if (!this.service) return;
-
- const serviceScalableTarget = new aws.appautoscaling.Target(
- `${BASE_NAME}-service-scalable-target-${stack}`,
- {
- maxCapacity: stack === 'prod' ? 10 : 3,
- minCapacity: 1,
- resourceId: pulumi.interpolate`service/${this.cloudStorageClusterName}/${this.service.service.name}`,
- scalableDimension: 'ecs:service:DesiredCount',
- serviceNamespace: 'ecs',
- tags: this.tags,
- },
- { parent: this }
- );
-
- const lbPortion: pulumi.Output<string> = this.lb.arn.apply((arn) => {
- const parts = arn.split(':loadbalancer/');
- return parts[1];
- });
-
- const tgPortion: pulumi.Output<string> = this.targetGroup.arn.apply(
- (arn) => {
- const parts = arn.split(':');
- return parts[parts.length - 1];
- }
- );
-
- const resourceLabel = pulumi.interpolate`${lbPortion}/${tgPortion}`;
-
- // Create an Auto Scaling policy for request count.
- new aws.appautoscaling.Policy(
- `${BASE_NAME}-scaling-policy-request-count-${stack}`,
- {
- policyType: 'TargetTrackingScaling',
- resourceId: serviceScalableTarget.resourceId,
- scalableDimension: serviceScalableTarget.scalableDimension,
- serviceNamespace: serviceScalableTarget.serviceNamespace,
- targetTrackingScalingPolicyConfiguration: {
- targetValue: 1000, // TODO: play with this
- predefinedMetricSpecification: {
- predefinedMetricType: 'ALBRequestCountPerTarget',
- resourceLabel,
- },
- scaleInCooldown: 60,
- scaleOutCooldown: 120,
- },
- },
- { parent: this }
- );
-
- // Create an Auto Scaling policy for CPU utilization.
- new aws.appautoscaling.Policy(
- `${BASE_NAME}-scaling-policy-cpu-${stack}`,
- {
- policyType: 'TargetTrackingScaling',
- resourceId: serviceScalableTarget.resourceId,
- scalableDimension: serviceScalableTarget.scalableDimension,
- serviceNamespace: serviceScalableTarget.serviceNamespace,
- targetTrackingScalingPolicyConfiguration: {
- targetValue: 70.0,
- predefinedMetricSpecification: {
- predefinedMetricType: 'ECSServiceAverageCPUUtilization',
- },
- scaleInCooldown: 100,
- scaleOutCooldown: 300,
- },
- },
- { parent: this }
- );
-
- new aws.appautoscaling.Policy(
- `${BASE_NAME}-scaling-policy-memory-${stack}`,
- {
- policyType: 'TargetTrackingScaling',
- resourceId: serviceScalableTarget.resourceId,
- scalableDimension: serviceScalableTarget.scalableDimension,
- serviceNamespace: serviceScalableTarget.serviceNamespace,
- targetTrackingScalingPolicyConfiguration: {
- targetValue: 70.0,
- predefinedMetricSpecification: {
- predefinedMetricType: 'ECSServiceAverageMemoryUtilization',
- },
- scaleInCooldown: 100,
- scaleOutCooldown: 300,
- },
- },
- { parent: this }
- );
- }
-
- setupServiceAlarms() {
- new aws.cloudwatch.MetricAlarm(
- `${BASE_NAME}-high-cpu-alarm`,
- {
- name: `${BASE_NAME}-high-cpu-alarm-${stack}`,
- metricName: 'CPUUtilization',
- namespace: 'AWS/ECS',
- statistic: 'Average',
- period: 180,
- evaluationPeriods: 1,
- threshold: 80,
- comparisonOperator: 'GreaterThanThreshold',
- dimensions: {
- ClusterName: this.cloudStorageClusterName,
- ServiceName: this.service.service.name,
- },
- alarmDescription: `High CPU usage alarm for ${BASE_NAME} service.`,
- actionsEnabled: true,
- alarmActions: [CLOUD_TRAIL_SNS_TOPIC_ARN],
- tags: this.tags,
- },
- { parent: this }
- );
-
- new aws.cloudwatch.MetricAlarm(
- `${BASE_NAME}-high-mem-alarm`,
- {
- name: `${BASE_NAME}-high-mem-alarm-${stack}`,
- metricName: 'MemoryUtilization',
- namespace: 'AWS/ECS',
- statistic: 'Average',
- period: 180,
- evaluationPeriods: 1,
- threshold: 80,
- comparisonOperator: 'GreaterThanThreshold',
- dimensions: {
- ClusterName: this.cloudStorageClusterName,
- ServiceName: this.service.service.name,
- },
- alarmDescription: `High Memory usage alarm for ${BASE_NAME} service.`,
- actionsEnabled: true,
- alarmActions: [CLOUD_TRAIL_SNS_TOPIC_ARN],
- tags: this.tags,
- },
- { parent: this }
- );
-
- new aws.cloudwatch.MetricAlarm(
- `${BASE_NAME}-http-5xx-alarm`,
- {
- name: `${BASE_NAME}-http-5xx-${stack}`,
- metricName: 'HTTPCode_ELB_5XX_Count',
- namespace: 'AWS/ApplicationELB',
- statistic: 'Sum',
- period: 180,
- evaluationPeriods: 1,
- threshold: 25,
- comparisonOperator: 'GreaterThanOrEqualToThreshold',
- dimensions: {
- LoadBalancer: this.lb.arn,
- },
- alarmDescription: `High HTTP 5XX count alarm for ${BASE_NAME} Load Balancer.`,
- actionsEnabled: true,
- alarmActions: [CLOUD_TRAIL_SNS_TOPIC_ARN],
- tags: this.tags,
- },
- { parent: this }
- );
- }
-}
diff --git a/infra/stacks/organization-service/package.json b/infra/stacks/organization-service/package.json
deleted file mode 100644
index 295ee934fc..0000000000
--- a/infra/stacks/organization-service/package.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "name": "organization-service-stack",
- "version": "0.0.0",
- "private": true,
- "license": "MIT",
- "main": "index.ts"
-}
diff --git a/infra/stacks/organization-service/tsconfig.json b/infra/stacks/organization-service/tsconfig.json
deleted file mode 100644
index 6f83eb665f..0000000000
--- a/infra/stacks/organization-service/tsconfig.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": "../../tsconfig.json",
-}