Skip to content

Commit

Permalink
Add GOMEMLIMIT as env variable in Terraform for serverless implementa…
Browse files Browse the repository at this point in the history
…tion of Buz (#592)

* Relax Content-Type expectation and bump version to 0.18.3

* Add GOMEMLIMIT as env variable in Terraform for serverless implementation of Buz

* Revert "Add GOMEMLIMIT as env variable in Terraform for serverless implementation of Buz"

This reverts commit 00ebb48.

* Add GOMEMLIMIT as env variable in Terraform for serverless implementation of Buz

---------

Signed-off-by: Jake Thomas <[email protected]>
Co-authored-by: Jake Thomas <[email protected]>
  • Loading branch information
ricky-galvao and jakthom authored Apr 26, 2024
1 parent 60eadaa commit 6b8c5af
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.18.4
v0.18.5
1 change: 1 addition & 0 deletions deploy/terraform/aws/lambda/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ resource "aws_lambda_function" "buz" {
variables = {
(local.buz_config_var) = local.buz_config_path,
(local.buz_debug_var) = var.debug
GOMEMLIMIT = floor(var.buz_lambda_gomemlimit_pct * var.buz_lambda_memory_limit)
}
}

Expand Down
8 changes: 7 additions & 1 deletion deploy/terraform/aws/lambda/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ variable "buz_image_repo" {
variable "buz_version" {
description = "The version of Buz to run."
type = string
default = "v0.18.4"
default = "v0.18.5"
}

variable "buz_lambda_memory_limit" {
Expand All @@ -50,6 +50,12 @@ variable "buz_lambda_memory_limit" {
default = 128
}

variable "buz_lambda_gomemlimit_pct" {
description = "Percentage of the lambda memory limit to specify in GOMEMLIMIT env variable."
type = number
default = 0.9
}

variable "buz_lambda_timeout" {
description = "The lambda timeout"
type = number
Expand Down
5 changes: 5 additions & 0 deletions deploy/terraform/gcp/cloud_run/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ resource "google_cloud_run_service" "buz" {
value = local.buz_config_path
}

env {
name = "GOMEMLIMIT"
value = floor(var.buz_service_gomemlimit_pct * var.buz_service_memory_limit)
}

volume_mounts {
name = local.config
mount_path = local.buz_config_dir
Expand Down
8 changes: 7 additions & 1 deletion deploy/terraform/gcp/cloud_run/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ variable "buz_domain" {
variable "buz_version" {
description = "The version of Buz to run."
type = string
default = "v0.18.4"
default = "v0.18.5"
}

variable "buz_service_timeout_seconds" {
Expand All @@ -55,6 +55,12 @@ variable "buz_service_memory_limit" {
default = "512Mi" # Cloud Run default
}

variable "buz_service_gomemlimit_pct" {
description = "Percentage of the cloud run memory limit to specify in GOMEMLIMIT env variable."
type = number
default = 0.9
}

variable "buz_service_container_port" {
description = "The service container port"
type = number
Expand Down
2 changes: 1 addition & 1 deletion examples/quickstart/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ x-dependency:
services:
buz:
container_name: buz
image: ghcr.io/silverton-io/buz:v0.18.4
image: ghcr.io/silverton-io/buz:v0.18.5
volumes:
- type: bind
source: ./buz/quickstart.conf.yml
Expand Down

0 comments on commit 6b8c5af

Please sign in to comment.