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.

chore: remove legacy notification email poller (#630)

Will Hutchinsonce5f536f021b
diff --git a/.github/services-config.json b/.github/services-config.json
index 947c1699b2..4d0beffde9 100644
--- a/.github/services-config.json
+++ b/.github/services-config.json
@@ -103,12 +103,6 @@
],
"stack_path": "infra/stacks/notification-service/**"
},
- "notification-email-poller": {
- "source_paths": [
- "rust/cloud-storage/notification_email_poller/**"
- ],
- "stack_path": "infra/stacks/notification-email-poller/**"
- },
"organization-service": {
"source_paths": [
"rust/cloud-storage/organization_service/**"
diff --git a/.github/workflows/deploy-service-generic.yml b/.github/workflows/deploy-service-generic.yml
index 410c803079..109dfc7f40 100644
--- a/.github/workflows/deploy-service-generic.yml
+++ b/.github/workflows/deploy-service-generic.yml
@@ -29,7 +29,6 @@ on:
- link-sharing
- metering-service
- notification-service
- - notification-email-poller
- organization-service
- organization-retention
- properties-service
diff --git a/infra/bun.lock b/infra/bun.lock
index e1aa3b70a0..259f299367 100644
--- a/infra/bun.lock
+++ b/infra/bun.lock
@@ -129,10 +129,6 @@
"name": "metering-service-stack",
"version": "0.0.0",
},
- "stacks/notification-email-poller": {
- "name": "notification-email-poller-stack",
- "version": "0.0.0",
- },
"stacks/notification-service": {
"name": "notification-service-stack",
"version": "0.0.0",
@@ -813,8 +809,6 @@
"normalize-url": ["[email protected]", "", {}, "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A=="],
- "notification-email-poller-stack": ["notification-email-poller-stack@workspace:stacks/notification-email-poller"],
-
"notification-service-stack": ["notification-service-stack@workspace:stacks/notification-service"],
"npm-bundled": ["[email protected]", "", { "dependencies": { "npm-normalize-package-bin": "^3.0.0" } }, "sha512-+AvaheE/ww1JEwRHOrn4WHNzOxGtVp+adrg2AeZS/7KuxGUYFuBta98wYpfHBbJp6Tg6j1NKSEVHNcfZzJHQwQ=="],
diff --git a/infra/stacks/notification-email-poller/Pulumi.dev.yaml b/infra/stacks/notification-email-poller/Pulumi.dev.yaml
deleted file mode 100644
index 323295068a..0000000000
--- a/infra/stacks/notification-email-poller/Pulumi.dev.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-config:
- aws:region: us-east-1
- notification-email-poller:db-password-secret-key: notification-db-password-dev
diff --git a/infra/stacks/notification-email-poller/Pulumi.prod.yaml b/infra/stacks/notification-email-poller/Pulumi.prod.yaml
deleted file mode 100644
index 233ae733d0..0000000000
--- a/infra/stacks/notification-email-poller/Pulumi.prod.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-config:
- aws:region: us-east-1
- notification-email-poller:db-password-secret-key: notification-db-password-prod
diff --git a/infra/stacks/notification-email-poller/Pulumi.yaml b/infra/stacks/notification-email-poller/Pulumi.yaml
deleted file mode 100644
index e2a3c86498..0000000000
--- a/infra/stacks/notification-email-poller/Pulumi.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-name: notification-email-poller
-description: Notification Email Poller
-runtime:
- name: nodejs
diff --git a/infra/stacks/notification-email-poller/index.ts b/infra/stacks/notification-email-poller/index.ts
deleted file mode 100644
index 5ff9699b8a..0000000000
--- a/infra/stacks/notification-email-poller/index.ts
+++ /dev/null
@@ -1,125 +0,0 @@
-import * as aws from '@pulumi/aws';
-import * as pulumi from '@pulumi/pulumi';
-import { WorkerTrigger } from '../../packages/lambda';
-import { config, stack } from '../../packages/shared';
-import { Worker } from './notification-email-poller';
-
-export let notificationEmailPollerWorkerImageUri:
- | pulumi.Output<string>
- | undefined;
-export let notificationEmailPollerWorkerRoleArn:
- | pulumi.Output<string>
- | undefined;
-export let notificationEmailPollerWorkerTaskArn:
- | pulumi.Output<string>
- | undefined;
-export let notificationEmailPollerTriggerLambdaName:
- | pulumi.Output<string>
- | undefined;
-
-if (stack !== 'prod') {
- const tags = {
- environment: stack,
- tech_lead: 'hutch',
- project: 'notifications',
- };
-
- 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 notificationServiceStack = new pulumi.StackReference(
- 'notification-service-stack',
- {
- name: `macro-inc/notification-service/${stack}`,
- }
- );
- const notificationDatabaseEndpoint = notificationServiceStack
- .getOutput('notificationDatabaseEndpoint')
- .apply((endpoint) => endpoint as string);
-
- const notificationDatabasePassword = aws.secretsmanager
- .getSecretVersionOutput({
- secretId: config.require('db-password-secret-key'),
- })
- .apply((secret) => secret.secretString);
-
- const DATABASE_URL = pulumi
- .all([notificationDatabaseEndpoint, notificationDatabasePassword])
- .apply(
- // eslint-disable-next-line @typescript-eslint/no-shadow
- ([endpoint, password]) =>
- `postgresql://macrouser:${password}@${endpoint}/notificationdb`
- );
-
- const worker = new Worker('notification-email-poller-worker', {
- containerEnvVars: [
- {
- name: 'ENVIRONMENT',
- value: stack,
- },
- {
- name: 'RUST_LOG',
- value: `notification_email_poller_worker=${stack === 'prod' ? 'info' : 'debug'}`,
- },
- {
- name: 'DATABASE_URL',
- value: pulumi.interpolate`${DATABASE_URL}`,
- },
- {
- name: 'SENDER_BASE_ADDRESS',
- value: `notification.macro.com`,
- },
- ],
- platform: {
- family: 'linux',
- architecture: 'amd64',
- },
- tags,
- });
-
- notificationEmailPollerWorkerImageUri = worker.image.imageUri;
- notificationEmailPollerWorkerRoleArn = worker.role.arn;
- notificationEmailPollerWorkerTaskArn =
- worker.taskDefinition.taskDefinition.arn;
-
- const notificationEmailPollerTriggerLambda = new WorkerTrigger(
- 'notification-email-poller-trigger',
- {
- clusterArn: cloudStorageClusterArn,
- taskDefinitionArn: pulumi.interpolate`${notificationEmailPollerWorkerTaskArn}`,
- tags,
- }
- );
-
- const notificationEmailPollerTriggerRule = new aws.cloudwatch.EventRule(
- `notification-email-poller-hourly-rule-${stack}`,
- {
- name: `notification-email-poller-hourly-${stack}`,
- scheduleExpression: 'rate(1 hour)', // start at 1hr rate. may increase if needed.
- tags,
- }
- );
-
- new aws.cloudwatch.EventTarget(`notification-email-poller-target-${stack}`, {
- rule: notificationEmailPollerTriggerRule.name,
- arn: notificationEmailPollerTriggerLambda.lambda.arn,
- });
-
- new aws.lambda.Permission(
- `notification-email-poller-trigger-permission-${stack}`,
- {
- action: 'lambda:InvokeFunction',
- function: notificationEmailPollerTriggerLambda.lambda.name,
- principal: 'events.amazonaws.com',
- sourceArn: notificationEmailPollerTriggerRule.arn,
- }
- );
-
- notificationEmailPollerTriggerLambdaName =
- notificationEmailPollerTriggerLambda.lambda.name;
-}
diff --git a/infra/stacks/notification-email-poller/notification-email-poller.ts b/infra/stacks/notification-email-poller/notification-email-poller.ts
deleted file mode 100644
index 344634257c..0000000000
--- a/infra/stacks/notification-email-poller/notification-email-poller.ts
+++ /dev/null
@@ -1,155 +0,0 @@
-import * as aws from '@pulumi/aws';
-import * as awsx from '@pulumi/awsx';
-import type { Output } from '@pulumi/pulumi';
-import * as pulumi from '@pulumi/pulumi';
-import { EcrImage } from '../../packages/service';
-import { awsRegion, stack } from '../../packages/shared';
-
-// import {
-// DATADOG_API_KEY,
-// datadogAgentContainer,
-// fargateLogRouterSidecarContainer,
-// } from '../../packages/resources';
-
-const BASE_NAME = `notification-email-poller-worker`;
-const WORKER_NAME = `${BASE_NAME}-${stack}`;
-const BASE_PATH = '../../../rust/cloud-storage';
-
-type WorkerArgs = {
- containerEnvVars: { name: string; value: Output<string> | string }[];
- platform: { family: string; architecture: 'amd64' | 'arm64' };
- tags: { [key: string]: string };
-};
-
-export class Worker extends pulumi.ComponentResource {
- public role: aws.iam.Role;
- public ecr: awsx.ecr.Repository;
- public image: awsx.ecr.Image;
- public taskDefinition: awsx.ecs.FargateTaskDefinition;
- tags: { [key: string]: string };
- constructor(
- name: string,
- { platform, containerEnvVars, tags }: WorkerArgs,
- opts?: pulumi.ComponentResourceOptions
- ) {
- super('my:components:Worker', name, {}, opts);
- this.tags = tags;
-
- 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: 'notification_email_poller_worker',
- },
- tags: this.tags,
- },
- { parent: this }
- );
- this.ecr = image.ecr;
- this.image = image.image;
-
- 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/notification.macro.com`,
- ],
- Effect: 'Allow',
- },
- ],
- },
- tags: this.tags,
- },
- { parent: this }
- );
-
- this.role = new aws.iam.Role(
- `${BASE_NAME}-role-${stack}`,
- {
- name: `${BASE_NAME}-role-${stack}`,
- assumeRolePolicy: {
- Version: '2012-10-17',
- Statement: [
- {
- Action: 'sts:AssumeRole',
- Principal: {
- Service: 'ecs-tasks.amazonaws.com',
- },
- Effect: 'Allow',
- Sid: '',
- },
- ],
- },
- managedPolicyArns: [sesPolicy.arn],
- tags: this.tags,
- },
- { parent: this }
- );
-
- this.taskDefinition = new awsx.ecs.FargateTaskDefinition(
- `${BASE_NAME}-task-def-${stack}`,
- {
- cpu: '256',
- memory: '512',
- taskRole: { roleArn: this.role.arn },
- container: {
- name: WORKER_NAME,
- image: image.image.imageUri,
- stopTimeout: 10, // 10 seconds to force kill the task
- cpu: 256, // Specify CPU units
- memory: 512, // Specify memory in MB
- environment: [...containerEnvVars],
- },
- // containers: {
- // log_router: fargateLogRouterSidecarContainer,
- // datadog_agent: datadogAgentContainer,
- // worker: {
- // name: WORKER_NAME,
- // image: image.image.imageUri,
- // cpu: 256,
- // memory: 512,
- // environment: [...containerEnvVars],
- // logConfiguration: {
- // logDriver: 'awsfirelens',
- // options: {
- // Name: 'datadog',
- // Host: 'http-intake.logs.us5.datadoghq.com',
- // apikey: DATADOG_API_KEY,
- // dd_service: `${WORKER_NAME}`,
- // dd_source: 'fargate',
- // dd_tags: 'project:cloudstorage',
- // provider: 'ecs',
- // },
- // },
- // },
- // },
- runtimePlatform: {
- operatingSystemFamily: `${platform.family.toUpperCase()}`,
- cpuArchitecture: `${
- platform.architecture === 'amd64'
- ? 'X86_64'
- : platform.architecture.toUpperCase()
- }`,
- },
- tags,
- },
- { parent: this }
- );
- }
-}
diff --git a/infra/stacks/notification-email-poller/package.json b/infra/stacks/notification-email-poller/package.json
deleted file mode 100644
index 9fd2e49e76..0000000000
--- a/infra/stacks/notification-email-poller/package.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "name": "notification-email-poller-stack",
- "version": "0.0.0",
- "private": true,
- "license": "MIT",
- "main": "index.ts"
-}
diff --git a/infra/stacks/notification-email-poller/tsconfig.json b/infra/stacks/notification-email-poller/tsconfig.json
deleted file mode 100644
index 4082f16a5d..0000000000
--- a/infra/stacks/notification-email-poller/tsconfig.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": "../../tsconfig.json"
-}