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

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

Merged
merged 6 commits into from
Apr 26, 2024
Merged
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
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
Loading