diff --git a/gcp/.header.md b/gcp/.header.md index e55ef66..1b6c95b 100644 --- a/gcp/.header.md +++ b/gcp/.header.md @@ -76,6 +76,7 @@ This Terraform project automates the deployment of Fleet Device Management (Flee # max_instance_count = 3 # exec_migration = true # Set to true to run migrations on `terraform apply` # (e.g., when changing image_tag) + # use_h2c = false # Set to true to use h2c } ``` @@ -94,6 +95,16 @@ This Terraform project automates the deployment of Fleet Device Management (Flee Review `variables.tf` and `byo-project/variables.tf` for all available options and their defaults. +## Known Limitations + +1. To handle large uploads, we need to bypass GCP cloud run's 32MB HTTP/1 body limit, by setting `fleet_config.use_h2c = true` which forces Fleet to use HTTP/2. However, as Cloud Run documentation notes, HTTP/2 end-to-end breaks connection upgrades, affecting WebSocket support and Fleet functionality for features such as Live Queries. + + **Workaround**: [Use Fleet Gitops Flow](https://fleetdm.com/docs/using-fleet/gitops#managing-software-installers) + * Set `fleet_config.use_h2c = false` to force HTTP/1 + * If you have large uploads, use `fleetctl apply` with a url field in your software YAML. The data flow avoids the ingress limit: + * Apply the YAML (small request). + * The Fleet Server makes an outbound GET request to download the file from the URL (S3, GCS, etc). + * Cloud Run doesn't apply the 32MB limit to outbound requests. ## Deployment Steps @@ -220,4 +231,4 @@ graph TD LB --> CloudRun NAT --> GitHub -``` \ No newline at end of file +``` diff --git a/gcp/README.md b/gcp/README.md index 0ce8aea..91b2d59 100644 --- a/gcp/README.md +++ b/gcp/README.md @@ -76,6 +76,7 @@ This Terraform project automates the deployment of Fleet Device Management (Flee # max_instance_count = 3 # exec_migration = true # Set to true to run migrations on `terraform apply` # (e.g., when changing image_tag) + # use_h2c = false # Set to true to use h2c } ``` @@ -86,12 +87,23 @@ This Terraform project automates the deployment of Fleet Device Management (Flee * `dns_zone_name`: The DNS zone that will be created/managed in Cloud DNS (e.g., `mydomain.com.`). **Must end with a dot.** * `dns_record_name`: The specific DNS record for Fleet (e.g., `fleet.mydomain.com.`). **Must end with a dot.** * `project_name`: A descriptive name for the project to be created. -* `fleet_config.image_tag`: The Docker image tag for the Fleet version you want to deploy (e.g., `fleetdm/fleet:v4.76.0`). +* `fleet_config.image_tag`: The Docker image tag for the Fleet version you want to deploy (e.g., `fleetdm/fleet:v4.79.1`). * `fleet_config.exec_migration`: Set to `true` when you are upgrading the `fleet_config.image_tag` to automatically run database migrations. Set to `false` if you want to manage migrations manually or if it's not an image upgrade. * `fleet_config.license_key` (Optional, inside the `fleet_config` object): Your Fleet license key if you have one. Review `variables.tf` and `byo-project/variables.tf` for all available options and their defaults. +## Known Limitations + +1. To handle large uploads, we need to bypass GCP cloud run's 32MB HTTP/1 body limit, by setting `fleet_config.use_h2c = true` which forces Fleet to use HTTP/2. However, as Cloud Run documentation notes, HTTP/2 end-to-end breaks connection upgrades, affecting WebSocket support and Fleet functionality for features such as Live Queries. + + **Workaround**: [Use Fleet Gitops Flow](https://fleetdm.com/docs/using-fleet/gitops#managing-software-installers) + * Set `fleet_config.use_h2c = false` to force HTTP/1 + * If you have large uploads, use `fleetctl apply` with a url field in your software YAML. The data flow avoids the ingress limit: + * Apply the YAML (small request). + * The Fleet Server makes an outbound GET request to download the file from the URL (S3, GCS, etc). + * Cloud Run doesn't apply the 32MB limit to outbound requests. + ## Deployment Steps 1. **Authenticate with GCP:** @@ -245,20 +257,20 @@ No resources. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [billing\_account\_id](#input\_billing\_account\_id) | billing account id | `any` | n/a | yes | -| [cache\_config](#input\_cache\_config) | Configuration for the Memorystore (Redis) instance. |
object({
name = string
tier = string
engine_version = string
connect_mode = string
memory_size = number
})
|
{
"connect_mode": "PRIVATE_SERVICE_ACCESS",
"engine_version": null,
"memory_size": 1,
"name": "fleet-cache",
"tier": "STANDARD_HA"
}
| no | -| [database\_config](#input\_database\_config) | Configuration for the Cloud SQL (MySQL) instance. |
object({
name = string
database_name = string
database_user = string
collation = string
charset = string
deletion_protection = bool
database_version = string
tier = string
})
|
{
"charset": "utf8mb4",
"collation": "utf8mb4_unicode_ci",
"database_name": "fleet",
"database_user": "fleet",
"database_version": "MYSQL_8_0",
"deletion_protection": false,
"name": "fleet-mysql",
"tier": "db-n1-standard-1"
}
| no | +| [cache\_config](#input\_cache\_config) | Configuration for the Memorystore (Redis) instance. |
object({
name = string
tier = string
engine_version = string
connect_mode = string
memory_size = number
})
|
{
"connect_mode": "PRIVATE_SERVICE_ACCESS",
"engine_version": null,
"memory_size": 1,
"name": "fleet-cache",
"tier": "STANDARD_HA"
}
| no | +| [database\_config](#input\_database\_config) | Configuration for the Cloud SQL (MySQL) instance. |
object({
name = string
database_name = string
database_user = string
collation = string
charset = string
deletion_protection = bool
database_version = string
tier = string
})
|
{
"charset": "utf8mb4",
"collation": "utf8mb4_unicode_ci",
"database_name": "fleet",
"database_user": "fleet",
"database_version": "MYSQL_8_0",
"deletion_protection": false,
"name": "fleet-mysql",
"tier": "db-n1-standard-1"
}
| no | | [dns\_record\_name](#input\_dns\_record\_name) | The DNS record for Fleet (e.g., 'fleet.my-fleet-infra.com.') | `string` | n/a | yes | | [dns\_zone\_name](#input\_dns\_zone\_name) | The DNS name of the managed zone (e.g., 'my-fleet-infra.com.') | `string` | n/a | yes | -| [fleet\_config](#input\_fleet\_config) | Configuration for the Fleet application deployment. |
object({
installers_bucket_name = string
image_tag = string
fleet_cpu = string
fleet_memory = string
debug_logging = bool
license_key = optional(string)
min_instance_count = number
max_instance_count = number
exec_migration = bool
extra_env_vars = optional(map(string))
extra_secret_env_vars = optional(map(object({
secret = string
version = string
})))
})
|
{
"debug_logging": false,
"exec_migration": true,
"extra_env_vars": {},
"extra_secret_env_vars": {},
"fleet_cpu": "1000m",
"fleet_memory": "4096Mi",
"image_tag": "fleetdm/fleet:v4.76.0",
"installers_bucket_name": "",
"max_instance_count": 5,
"min_instance_count": 1
}
| no | +| [fleet\_config](#input\_fleet\_config) | Configuration for the Fleet application deployment. |
object({
installers_bucket_name = string
image_tag = string
fleet_cpu = string
fleet_memory = string
debug_logging = bool
license_key = optional(string)
min_instance_count = number
max_instance_count = number
exec_migration = bool
use_h2c = bool
extra_env_vars = optional(map(string))
extra_secret_env_vars = optional(map(object({
secret = string
version = string
})))
})
|
{
"debug_logging": false,
"exec_migration": true,
"extra_env_vars": {},
"extra_secret_env_vars": {},
"fleet_cpu": "1000m",
"fleet_memory": "4096Mi",
"image_tag": "fleetdm/fleet:v4.78.2",
"installers_bucket_name": "",
"max_instance_count": 5,
"min_instance_count": 1,
"use_h2c": false
}
| no | | [fleet\_image](#input\_fleet\_image) | n/a | `string` | `"v4.67.3"` | no | -| [labels](#input\_labels) | resource labels | `map(string)` |
{
"application": "fleet"
}
| no | +| [labels](#input\_labels) | resource labels | `map(string)` |
{
"application": "fleet"
}
| no | | [location](#input\_location) | The general location for resources, e.g., 'us' for GCS buckets. | `string` | `"us"` | no | | [org\_id](#input\_org\_id) | organization id | `any` | n/a | yes | | [prefix](#input\_prefix) | A prefix used for naming resources within the byo-project module. | `string` | `"fleet"` | no | | [project\_name](#input\_project\_name) | n/a | `string` | `"fleet"` | no | | [random\_project\_id](#input\_random\_project\_id) | n/a | `bool` | `true` | no | | [region](#input\_region) | The GCP region for regional resources. | `string` | `"us-central1"` | no | -| [vpc\_config](#input\_vpc\_config) | Configuration for the VPC network and subnets. |
object({
network_name = string
subnets = list(object({
subnet_name = string
subnet_ip = string
subnet_region = string
subnet_private_access = bool
}))
})
|
{
"network_name": "fleet-network",
"subnets": [
{
"subnet_ip": "10.10.10.0/24",
"subnet_name": "fleet-subnet",
"subnet_private_access": true,
"subnet_region": "us-central1"
}
]
}
| no | +| [vpc\_config](#input\_vpc\_config) | Configuration for the VPC network and subnets. |
object({
network_name = string
subnets = list(object({
subnet_name = string
subnet_ip = string
subnet_region = string
subnet_private_access = bool
}))
})
|
{
"network_name": "fleet-network",
"subnets": [
{
"subnet_ip": "10.10.10.0/24",
"subnet_name": "fleet-subnet",
"subnet_private_access": true,
"subnet_region": "us-central1"
}
]
}
| no | ## Outputs diff --git a/gcp/byo-project/cloud_run.tf b/gcp/byo-project/cloud_run.tf index 7bb2f0b..0cf8964 100644 --- a/gcp/byo-project/cloud_run.tf +++ b/gcp/byo-project/cloud_run.tf @@ -18,7 +18,7 @@ locals { }) fleet_env_vars = merge(var.fleet_config.extra_env_vars, { FLEET_LICENSE_KEY = var.fleet_config.license_key - FLEET_SERVER_FORCE_H2C = "true" + FLEET_SERVER_FORCE_H2C = var.fleet_config.use_h2c FLEET_MYSQL_PROTOCOL = "tcp" FLEET_MYSQL_ADDRESS = "${module.mysql.private_ip_address}:3306" FLEET_MYSQL_USERNAME = var.database_config.database_user @@ -77,7 +77,7 @@ module "fleet-service" { { container_image = local.fleet_image_tag ports = { - name = "h2c" + name = var.fleet_config.use_h2c ? "h2c" : "http1" container_port = 8080 } # container_command = ["/bin/sh"] diff --git a/gcp/byo-project/variables.tf b/gcp/byo-project/variables.tf index 8f6b776..457d2c9 100644 --- a/gcp/byo-project/variables.tf +++ b/gcp/byo-project/variables.tf @@ -99,6 +99,7 @@ variable "fleet_config" { min_instance_count = number max_instance_count = number exec_migration = bool + use_h2c = bool extra_env_vars = optional(map(string)) extra_secret_env_vars = optional(map(object({ secret = string @@ -114,6 +115,7 @@ variable "fleet_config" { min_instance_count = 1 max_instance_count = 5 exec_migration = true + use_h2c = false extra_env_vars = {} extra_secret_env_vars = {} } diff --git a/gcp/variables.tf b/gcp/variables.tf index b9a4f3e..4178413 100644 --- a/gcp/variables.tf +++ b/gcp/variables.tf @@ -129,6 +129,7 @@ variable "fleet_config" { min_instance_count = number max_instance_count = number exec_migration = bool + use_h2c = bool extra_env_vars = optional(map(string)) extra_secret_env_vars = optional(map(object({ secret = string @@ -144,6 +145,7 @@ variable "fleet_config" { min_instance_count = 1 max_instance_count = 5 exec_migration = true + use_h2c = false extra_env_vars = {} extra_secret_env_vars = {} }