|
| 1 | +# GCP Cloud Run Plugin |
| 2 | + |
| 3 | +Deploys containerized applications to Google Cloud Run with automatic scaling, traffic management, and service account integration. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This plugin provisions Cloud Run services with: |
| 8 | + |
| 9 | +- Automatic scaling based on traffic |
| 10 | +- Configurable CPU, memory, and concurrency limits |
| 11 | +- Environment variable management |
| 12 | +- Service account integration for secure resource access |
| 13 | +- Flexible ingress controls |
| 14 | +- Request timeout configuration |
| 15 | + |
| 16 | +## Required Inputs |
| 17 | + |
| 18 | +| Parameter | Type | Description | |
| 19 | +| ------------ | ------ | --------------------------------------------------------------- | |
| 20 | +| `project_id` | string | Google Cloud Project ID (e.g. `my-project-123`) | |
| 21 | +| `region` | string | Google Cloud region for service deployment (e.g. `us-central1`) | |
| 22 | + |
| 23 | +## Optional Inputs |
| 24 | + |
| 25 | +| Parameter | Type | Description | Default | |
| 26 | +| ----------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | |
| 27 | +| `environment` | map(string) | Environment variables (e.g. `{"NODE_ENV": "production", "API_KEY": "secret"}`) | `{}` | |
| 28 | +| `memory_mb` | number | Memory allocation in MB | `512` | |
| 29 | +| `cpus` | number | CPU allocation | `1` | |
| 30 | +| `gpus` | number | GPU allocation | `0` | |
| 31 | +| `min_instances` | number | Minimum instances to keep running | `0` | |
| 32 | +| `max_instances` | number | Maximum instances that can be created | `10` | |
| 33 | +| `container_concurrency` | number | Maximum concurrent requests per instance | `80` | |
| 34 | +| `timeout_seconds` | number | Maximum request timeout in seconds | `10` | |
| 35 | +| `container_port` | number | Container port number | `9001` | |
| 36 | +| `ingress` | string | Traffic ingress setting. Must be one of `INGRESS_TRAFFIC_ALL`, `INGRESS_TRAFFIC_INTERNAL_ONLY`, or `INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER` | `INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER` | |
| 37 | + |
| 38 | +## Prerequisites |
| 39 | + |
| 40 | +- Container image pushed to Google Container Registry or Artifact Registry |
| 41 | +- Service account with appropriate IAM permissions (managed by `gcp-service-account` plugin) |
| 42 | + |
| 43 | +## Usage Example |
| 44 | + |
| 45 | +**Note:** This example shows platform file syntax. You can configure this plugin directly in the Suga Platform Builder UI without writing YAML. |
| 46 | + |
| 47 | +```yaml |
| 48 | +services: |
| 49 | + api: |
| 50 | + plugin: "gcp-cloudrun" |
| 51 | + identities: |
| 52 | + - plugin: "gcp-service-account" |
| 53 | + properties: |
| 54 | + project_id: "my-project-123" |
| 55 | + region: "us-central1" |
| 56 | + environment: |
| 57 | + NODE_ENV: "production" |
| 58 | + DATABASE_URL: "postgresql://..." |
| 59 | + memory_mb: 1024 |
| 60 | + cpus: 2 |
| 61 | + min_instances: 1 |
| 62 | + max_instances: 100 |
| 63 | + container_concurrency: 80 |
| 64 | + timeout_seconds: 300 |
| 65 | + container_port: 8080 |
| 66 | + ingress: "INGRESS_TRAFFIC_ALL" |
| 67 | +``` |
| 68 | +
|
| 69 | +## Features |
| 70 | +
|
| 71 | +- **Serverless**: Pay only for the resources you use |
| 72 | +- **Auto-scaling**: Automatically scales from zero to handle traffic spikes |
| 73 | +- **Security**: Integrated with GCP IAM and service accounts |
| 74 | +- **Flexibility**: Support for various runtime configurations and constraints |
| 75 | +- **Traffic Management**: Multiple ingress options for different security requirements |
| 76 | +
|
| 77 | +## References |
| 78 | +
|
| 79 | +- [Cloud Run Documentation](https://cloud.google.com/run/docs) |
| 80 | +- [Cloud Run Pricing](https://cloud.google.com/run/pricing) |
| 81 | +- [Cloud Run Quotas and Limits](https://cloud.google.com/run/quotas) |
| 82 | +- [Container Runtime Contract](https://cloud.google.com/run/docs/container-contract) |
0 commit comments