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

fix(user-list-search): replace kinesis with event bridge events for search indexing #967

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
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
14 changes: 0 additions & 14 deletions .github/workflows/user-list-search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,6 @@ jobs:
codedeploy-group-name-pattern: UserListSearch-{0}-EventHandler
function-name-pattern: UserListSearch-{0}-EventHandler
secrets: inherit

kinesis-lambda:
uses: ./.github/workflows/reuse-build-and-push-lambda.yml
needs: [infrastructure]
with:
scope: user-list-search-kinesis-to-sqs
sentry-project: user-list-search
s3-bucket-pattern: pocket-userlistsearch-{0}-kinesis-consumer
s3-key: kinesis-${{ github.sha }}.zip
codedeploy-app-name-pattern: UserListSearch-{0}-UnifiedEventsConsumer
codedeploy-group-name-pattern: UserListSearch-{0}-UnifiedEventsConsumer
function-name-pattern: UserListSearch-{0}-UnifiedEventsConsumer
secrets: inherit

item-update-lambda:
uses: ./.github/workflows/reuse-build-and-push-lambda.yml
Expand Down Expand Up @@ -189,7 +176,6 @@ jobs:
needs:
- api
- events-lambda
- kinesis-lambda
- item-update-lambda
- item-delete-lambda
- item-update-backfill-lambda
Expand Down
180 changes: 0 additions & 180 deletions infrastructure/user-list-search/kinesis_consumer.tf

This file was deleted.

64 changes: 0 additions & 64 deletions infrastructure/user-list-search/kinesis_consumer_codedeploy.tf

This file was deleted.

16 changes: 16 additions & 0 deletions infrastructure/user-list-search/lambda_bucket.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# NOTE: The bucket is called kinesis-consumer, because that was the old name of the lambdas deployed from here.
resource "aws_s3_bucket" "lambda_unified_events_consumer_code_bucket" {
bucket = "pocket-${lower(local.prefix)}-kinesis-consumer"
tags = local.tags
}

resource "aws_s3_bucket_acl" "lambda_unified_events_consumer_code_bucket" {
acl = "private"
bucket = aws_s3_bucket.lambda_unified_events_consumer_code_bucket.id
}

resource "aws_s3_bucket_public_access_block" "lambda_unified_events_consumer_code_bucket" {
bucket = aws_s3_bucket.lambda_unified_events_consumer_code_bucket.id
block_public_acls = true
block_public_policy = true
}
41 changes: 41 additions & 0 deletions infrastructure/user-list-search/lambda_codedeploy.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
resource "aws_iam_role" "lambda_codedeploy_role" {
name = "${local.prefix}-LambdaCodeDeployRole"
assume_role_policy = data.aws_iam_policy_document.codedeploy_assume_role.json
}


resource "aws_iam_role_policy_attachment" "lambda_codedeploy_role" {
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSCodeDeployRoleForLambda"
#Depending on the service there are different types.
role = aws_iam_role.lambda_codedeploy_role.name
}

resource "aws_iam_role" "lambda_role" {
name = "${local.prefix}-LambdaExecutionRole"
tags = local.tags
assume_role_policy = data.aws_iam_policy_document.lambda_assume.json
}

resource "aws_iam_role_policy_attachment" "lambda_role_xray_write" {
role = aws_iam_role.lambda_role.name
policy_arn = data.aws_iam_policy.aws_xray_write_only_access.arn
}

data "aws_iam_policy_document" "lambda_assume" {
version = "2012-10-17"

statement {
effect = "Allow"
actions = [
"sts:AssumeRole"
]

principals {
identifiers = [
"lambda.amazonaws.com"
]

type = "Service"
}
}
}
3 changes: 3 additions & 0 deletions infrastructure/user-list-search/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ locals {
userEvents = local.workspace.sns_topic_user_events
corpusEvents = local.workspace.sns_topic_corpus_events
collectionEvents = local.workspace.sns_topic_collection_events
listEvents = local.workspace.sns_topic_list_events
}

# environment or workspace-specific local variables go here.
Expand All @@ -80,6 +81,7 @@ locals {
sns_topic_user_events = "PocketEventBridge-Dev-UserEvents"
sns_topic_corpus_events = "PocketEventBridge-Dev-CorpusEvents"
sns_topic_collection_events = "PocketEventBridge-Dev-CollectionEvents"
sns_topic_list_events = "PocketEventBridge-Dev-ListEvents"
userApiUri = "https://user-list-search.getpocket.dev"
otlpCollectorUrl = "https://otel-collector.getpocket.dev:443"
}
Expand All @@ -97,6 +99,7 @@ locals {
sns_topic_user_events = "PocketEventBridge-Prod-UserEvents"
sns_topic_corpus_events = "PocketEventBridge-Prod-CorpusEvents"
sns_topic_collection_events = "PocketEventBridge-Prod-CollectionEvents"
sns_topic_list_events = "PocketEventBridge-Prod-ListEvents"
userApiUri = "https://user-list-search.readitlater.com"
otlpCollectorUrl = "https://otel-collector.readitlater.com:443"
}
Expand Down
19 changes: 0 additions & 19 deletions infrastructure/user-list-search/metrics.tf
Original file line number Diff line number Diff line change
Expand Up @@ -246,25 +246,6 @@ module "dashboard_alarm" {
merge(local.metrics.list_item_update_lambda.throttles, { metadata = { color = "#ff7f0e", yAxis = "right" } }),
]
},
{
x = 0.0
y = 24.0
width = 12.0
height = 6.0
properties = {
title = "Event Kinesis Consumer"
stacked = false
region = data.aws_region.current.name,
stat = "Average"
period = 60
}
metrics = [
local.metrics.event_consumer_lambda.duration,
local.metrics.event_consumer_lambda.errors,
merge(local.metrics.event_consumer_lambda.iterator_age, { metadata = { yAxis = "right" } })
]

},
{
x = 12.0
y = 24.0
Expand Down
Loading
Loading