# Nginx-based reverse proxy cluster This blueprint shows how to deploy an autoscaling reverse proxy cluster using Nginx, based on regional Managed Instance Groups. ![High-level diagram](reverse-proxy.png "High-level diagram") The autoscaling is driven by Nginx current connections metric, sent by Cloud Ops Agent. The example is for Nginx, but it could be easily adapted to any other reverse proxy software (eg. Squid, Varnish, etc). ## Ops Agent image There is a simple [`Dockerfile`](Dockerfile) available for building Ops Agent to be run inside the ContainerOS instance. Build the container, push it to your Container/Artifact Repository and set the `ops_agent_image` to point to the image you built. ## Variables | name | description | type | required | default | |---|---|:---:|:---:|:---:| | [autoscaling_metric](variables.tf#L31) | | object({…} | ✓ | | | [project_name](variables.tf#L108) | Name of an existing project or of the new project | string | ✓ | | | [autoscaling](variables.tf#L17) | Autoscaling configuration for the instance group. | object({…}) | | {…} | | [backends](variables.tf#L49) | Nginx locations configurations to proxy traffic to. | string | | "<<-EOT…EOT" | | [cidrs](variables.tf#L61) | Subnet IP CIDR ranges. | map(string) | | {…} | | [network](variables.tf#L69) | Network name. | string | | "reverse-proxy-vpc" | | [network_create](variables.tf#L75) | Create network or use existing one. | bool | | true | | [nginx_image](variables.tf#L81) | Nginx container image to use. | string | | "gcr.io/cloud-marketplace/google/nginx1:latest" | | [ops_agent_image](variables.tf#L87) | Google Cloud Ops Agent container image to use. | string | | "gcr.io/sfans-hub-project-d647/ops-agent:latest" | | [prefix](variables.tf#L93) | Prefix used for resources that need unique names. | string | | "" | | [project_create](variables.tf#L99) | Parameters for the creation of the new project | object({…}) | | null | | [region](variables.tf#L113) | Default region for resources. | string | | "europe-west4" | | [subnetwork](variables.tf#L119) | Subnetwork name. | string | | "gce" | | [tls](variables.tf#L125) | Also offer reverse proxying with TLS (self-signed certificate). | bool | | false | ## Outputs | name | description | sensitive | |---|---|:---:| | [load_balancer_url](outputs.tf#L17) | Load balancer for the reverse proxy instance group. | |