Skip to content

Commit

Permalink
Upgrade indexstar and kepa on prod with ndjson
Browse files Browse the repository at this point in the history
Upgrade services on prod and set up cache config for ndjson on prod.

While at it, upgrade `ago` to latest.
  • Loading branch information
masih committed Feb 2, 2023
1 parent 5d6b11f commit 3240762
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 20 deletions.
57 changes: 40 additions & 17 deletions deploy/infrastructure/prod/us-east-2/cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ resource "aws_cloudfront_distribution" "cdn" {
}

ordered_cache_behavior {
path_pattern = "reframe"
path_pattern = "reframe"
# CloudFront does not support configuring allowed methods selectively.
# Hence the complete method list.
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "PATCH", "POST"]
Expand All @@ -92,18 +92,14 @@ resource "aws_cloudfront_distribution" "cdn" {
}

ordered_cache_behavior {
path_pattern = "multihash/*"
path_pattern = "multihash/*"
# CloudFront does not support configuring allowed methods selectively.
# Hence the complete method list.
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "PATCH", "POST"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
target_origin_id = local.indexstar_origin_id
forwarded_values {
query_string = false
cookies {
forward = "none"
}
}
cache_policy_id = aws_cloudfront_cache_policy.lookup.id

compress = true
viewer_protocol_policy = "redirect-to-https"
min_ttl = 0
Expand All @@ -116,12 +112,8 @@ resource "aws_cloudfront_distribution" "cdn" {
allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
target_origin_id = local.indexstar_origin_id
forwarded_values {
query_string = false
cookies {
forward = "none"
}
}
cache_policy_id = aws_cloudfront_cache_policy.lookup.id

compress = true
viewer_protocol_policy = "redirect-to-https"
min_ttl = 0
Expand All @@ -148,7 +140,7 @@ resource "aws_cloudfront_distribution" "cdn" {
}

ordered_cache_behavior {
path_pattern = "ingest/*"
path_pattern = "ingest/*"
# CloudFront does not support configuring allowed methods selectively.
# Hence the complete method list.
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "PATCH", "POST"]
Expand Down Expand Up @@ -203,6 +195,37 @@ resource "aws_cloudfront_cache_policy" "reframe" {
}
}

resource "aws_cloudfront_cache_policy" "lookup" {
name = "lookup"

# We have to set non-zero TTL values because otherwise CloudFront won't let
# the query strings settings to be configured.
min_ttl = 0
default_ttl = 3600
max_ttl = 86400

parameters_in_cache_key_and_forwarded_to_origin {
cookies_config {
cookie_behavior = "none"
}
headers_config {
header_behavior = "whitelist"
headers {
items = ["Accept"]
}
}
query_strings_config {
query_string_behavior = "whitelist"
query_strings {
items = ["cascade"]
}
}

enable_accept_encoding_brotli = true
enable_accept_encoding_gzip = true
}
}

provider "aws" {
alias = "use1"
region = "us-east-1"
Expand Down Expand Up @@ -232,8 +255,8 @@ module "records" {

records = [
{
name = local.cdn_subdomain
type = "A"
name = local.cdn_subdomain
type = "A"
alias = {
name = aws_cloudfront_distribution.cdn.domain_name
zone_id = aws_cloudfront_distribution.cdn.hosted_zone_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ patchesStrategicMerge:
images:
- name: storetheindex
newName: 407967248065.dkr.ecr.us-east-2.amazonaws.com/storetheindex/storetheindex
newTag: 20230201182245-cee0f4faba5b495c5174f3c0514d3c82c12ac140
newTag: 20230202091228-d681a36337e90c829fa9e46b6c6ec04559492049
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ replicas:
images:
- name: indexstar
newName: 407967248065.dkr.ecr.us-east-2.amazonaws.com/indexstar/indexstar
newTag: 20221215113602-67c9360d3785d2f77975c21287efffd99bc50bc2
newTag: 20230201190758-f61e21138983efaf2e1b2cb63df624c57ca045a4
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ patchesStrategicMerge:
images:
- name: storetheindex
newName: 407967248065.dkr.ecr.us-east-2.amazonaws.com/storetheindex/storetheindex
newTag: 0.5.7
newTag: 0.5.8

0 comments on commit 3240762

Please sign in to comment.