Skip to content

Commit 2f1908d

Browse files
feat: 0.18.0 minor release (#579)
* v0.18.0 * feat: extend cors (#578) * fix: cors not applied to all routes (#577) * feat: improve schema read (#576) * feat: collect ip fingerprint and better tstamp (#575) * feat: log schema metadata (#574) * feat: more lambda config options (#573) * fet: more lambda config options * chore: remove unused var * review --------- Co-authored-by: Léonard Henriquez <leonard@topo.io>
1 parent c251aed commit 2f1908d

File tree

16 files changed

+211
-51
lines changed

16 files changed

+211
-51
lines changed

.VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.17.0
1+
v0.18.0

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ examples/quickstart/minio/*
1919
.terraform.lock.hcl
2020
.terraform.tfstate.lock*
2121
terraform.*
22+
backend.tf
2223
build/buz
2324
*.build
2425
target/*

cmd/buz/app.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ func (a *App) initializeManifold() {
108108
func (a *App) initializeRouter() {
109109
log.Info().Msg("🟢 initializing router")
110110
a.engine = gin.New()
111-
a.publicRouterGroup = a.engine.Group("")
112-
a.switchableRouterGroup = a.engine.Group("")
113111
if err := a.engine.SetTrustedProxies(nil); err != nil {
114112
panic(err)
115113
}
@@ -147,6 +145,11 @@ func (a *App) initializeMiddleware() {
147145
}
148146
}
149147

148+
func (a *App) initializeRouterGroups() {
149+
a.publicRouterGroup = a.engine.Group("")
150+
a.switchableRouterGroup = a.engine.Group("")
151+
}
152+
150153
// 🐝 and healthcheck route are always public
151154
func (a *App) initializePublicRoutes() {
152155
log.Info().Msg("🟢 initializing buz route")
@@ -201,6 +204,7 @@ func (a *App) Initialize() {
201204
a.initializeRouter()
202205
a.initializeManifold()
203206
a.initializeMiddleware()
207+
a.initializeRouterGroups()
204208
a.initializePublicRoutes()
205209
a.initializeOpsRoutes()
206210
a.initializeSchemaCacheRoutes()
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
locals {
2-
domain_parts = split(".", var.buz_domain)
3-
cookie_domain = join(".", slice(local.domain_parts, 1, length(local.domain_parts))) # Assumes Buz is running on a subdomain and the cookie should be on root
4-
buz_debug_var = "DEBUG"
5-
buz_config_var = "BUZ_CONFIG_PATH"
6-
buz_config_path = "/etc/buz/config.yml"
7-
system_env_base = "${var.system}-${var.env}-"
8-
artifact_repository = "${local.system_env_base}img"
9-
image = "buz:${var.buz_version}"
10-
buz_source_image = "ghcr.io/silverton-io/${local.image}"
11-
service_name = "${local.system_env_base}collector"
12-
config = "${local.system_env_base}config"
13-
schema_bucket = "${local.system_env_base}${var.schema_bucket_name}"
14-
events_bucket = "${local.system_env_base}${var.events_bucket_name}"
15-
default_output = "buz_events"
16-
deadletter_output = "buz_invalid_events"
2+
domain_parts = split(".", var.buz_domain)
3+
cookie_domain = join(".", slice(local.domain_parts, 1, length(local.domain_parts))) # Assumes Buz is running on a subdomain and the cookie should be on root
4+
buz_debug_var = "DEBUG"
5+
buz_config_var = "BUZ_CONFIG_PATH"
6+
buz_config_path = "/etc/buz/config.yml"
7+
system_env_base = "${var.system}-${var.env}-"
8+
artifact_repository = "${local.system_env_base}img"
9+
image = "buz:${var.buz_version}"
10+
buz_source_image = "${var.buz_image_repo}/${local.image}"
11+
service_name = "${local.system_env_base}collector"
12+
config = "${local.system_env_base}config"
13+
schema_bucket = "${local.system_env_base}${var.schema_bucket_name}"
14+
events_bucket = "${local.system_env_base}${var.events_bucket_name}"
15+
default_output = "buz_events"
16+
deadletter_output = "buz_invalid_events"
1717
metadata_extraction_params = "{isValid:.isValid,vendor:.vendor,namespace:.namespace,version:.version}"
18-
s3_dynamic_prefix = "isValid=!{partitionKeyFromQuery:isValid}/vendor=!{partitionKeyFromQuery:vendor}/namespace=!{partitionKeyFromQuery:namespace}/version=!{partitionKeyFromQuery:version}/year=!{timestamp:yyyy}/month=!{timestamp:MM}/day=!{timestamp:dd}/"
18+
s3_dynamic_prefix = "isValid=!{partitionKeyFromQuery:isValid}/vendor=!{partitionKeyFromQuery:vendor}/namespace=!{partitionKeyFromQuery:namespace}/version=!{partitionKeyFromQuery:version}/year=!{timestamp:yyyy}/month=!{timestamp:MM}/day=!{timestamp:dd}/"
1919
}

deploy/terraform/aws/lambda/main.tf

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ data "aws_ecr_image" "buz_image" {
139139

140140
resource "null_resource" "configure_docker" {
141141
triggers = {
142-
build_number = var.buz_version
142+
always_run = timestamp()
143143
}
144144
provisioner "local-exec" {
145145
command = "aws ecr get-login-password --region ${var.aws_region} | docker login --username AWS --password-stdin ${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.aws_region}.amazonaws.com"
@@ -228,6 +228,14 @@ resource "aws_cloudwatch_log_group" "buz" {
228228
}
229229
}
230230

231+
data "aws_cloudfront_origin_request_policy" "buz" {
232+
name = "Managed-AllViewerExceptHostHeader"
233+
}
234+
235+
data "aws_cloudfront_cache_policy" "buz" {
236+
name = "Managed-CachingDisabled"
237+
}
238+
231239
resource "aws_cloudfront_distribution" "buz" {
232240
enabled = true
233241
is_ipv6_enabled = true
@@ -248,25 +256,20 @@ resource "aws_cloudfront_distribution" "buz" {
248256
}
249257

250258
default_cache_behavior {
251-
viewer_protocol_policy = "redirect-to-https"
252-
min_ttl = 0
253-
default_ttl = 3600
254-
max_ttl = 86400
255-
target_origin_id = replace(replace(aws_lambda_function_url.buz.function_url, "https://", ""), "/", "")
256-
allowed_methods = ["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"]
257-
cached_methods = ["HEAD", "GET"]
258-
forwarded_values {
259-
query_string = true
260-
cookies {
261-
forward = "all"
262-
}
263-
}
259+
viewer_protocol_policy = "redirect-to-https"
260+
min_ttl = 0
261+
default_ttl = 3600
262+
max_ttl = 86400
263+
target_origin_id = replace(replace(aws_lambda_function_url.buz.function_url, "https://", ""), "/", "")
264+
allowed_methods = ["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"]
265+
cached_methods = ["HEAD", "GET"]
266+
origin_request_policy_id = data.aws_cloudfront_origin_request_policy.buz.id
267+
cache_policy_id = data.aws_cloudfront_cache_policy.buz.id
264268
}
265269

266270
restrictions {
267271
geo_restriction {
268-
restriction_type = "whitelist"
269-
locations = ["US", "CA", "GB", "DE"]
272+
restriction_type = "none"
270273
}
271274
}
272275

deploy/terraform/aws/lambda/provider.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ terraform {
1010
}
1111

1212
provider "aws" {
13-
region = var.aws_region
14-
}
13+
region = var.aws_region
14+
profile = var.aws_profile
15+
}

deploy/terraform/aws/lambda/variables.tf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ variable "aws_region" {
44
default = "us-east-1"
55
}
66

7+
variable "aws_profile" {
8+
description = "AWS Profile"
9+
type = string
10+
default = "default"
11+
}
12+
713
variable "system" {
814
description = "The name of the Buz implementation. \n\nExample: buz"
915
type = string
@@ -26,10 +32,16 @@ variable "buz_domain" {
2632
type = string
2733
}
2834

35+
variable "buz_image_repo" {
36+
description = "The Buz image repository"
37+
type = string
38+
default = "ghcr.io/silverton-io"
39+
}
40+
2941
variable "buz_version" {
3042
description = "The version of Buz to run."
3143
type = string
32-
default = "v0.17.0"
44+
default = "v0.18.0"
3345
}
3446

3547
variable "buz_lambda_memory_limit" {

deploy/terraform/gcp/cloud_run/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ variable "buz_domain" {
2828
variable "buz_version" {
2929
description = "The version of Buz to run."
3030
type = string
31-
default = "v0.17.0"
31+
default = "v0.18.0"
3232
}
3333

3434
variable "buz_service_timeout_seconds" {

examples/quickstart/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ x-dependency:
2020
services:
2121
buz:
2222
container_name: buz
23-
image: ghcr.io/silverton-io/buz:v0.17.0
23+
image: ghcr.io/silverton-io/buz:v0.18.0
2424
volumes:
2525
- type: bind
2626
source: ./buz/quickstart.conf.yml

pkg/annotator/annotator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func getSchemaMetadata(schema []byte) schemaMetadata {
2525
namespace := schemaContents.Get("self.namespace").String()
2626
version := schemaContents.Get("self.version").String()
2727
disableValidation := schemaContents.Get("disableValidation").Bool()
28+
log.Debug().Msgf("🟡 vendor: %s, namespace: %s, version: %s, disableValidation: %t", vendor, namespace, version, disableValidation)
2829
return schemaMetadata{
2930
Vendor: vendor,
3031
Namespace: namespace,

0 commit comments

Comments
 (0)