Skip to content

Commit

Permalink
crates-io: Add support for db-dump.zip files
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Jun 1, 2024
1 parent 688a7d9 commit 8ae0c44
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions terragrunt/modules/crates-io/compute-static/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ fn handle_request(config: &Config, mut request: Request) -> Result<Response, Err
// Database dump is too big to cache on Fastly
if request.get_url_str().ends_with("db-dump.tar.gz") {
redirect_to_cloudfront(config, "db-dump.tar.gz")
} else if request.get_url_str().ends_with("db-dump.zip") {
redirect_to_cloudfront(config, "db-dump.zip")
} else {
send_request_to_s3(config, &request)
}
Expand Down
13 changes: 12 additions & 1 deletion terragrunt/modules/crates-io/s3-static.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resource "aws_s3_bucket" "static" {
max_age_seconds = 3000
}

// Keep only the live db-dump.tar.gz and the previous day's version, removing
// Keep only the live db-dumps and the previous day's versions, removing
// all the other ones. This is needed because we don't want this file to be
// versioned, while all the other ones in the bucket should be versioned.
lifecycle_rule {
Expand All @@ -27,6 +27,17 @@ resource "aws_s3_bucket" "static" {
}
}

lifecycle_rule {
id = "purge-db-dump-zip"
enabled = true
prefix = "db-dump.zip"

abort_incomplete_multipart_upload_days = 1
noncurrent_version_expiration {
days = 1
}
}

lifecycle {
ignore_changes = [
replication_configuration,
Expand Down

0 comments on commit 8ae0c44

Please sign in to comment.