Loading…
Loading…
Deploy the platform on Google Cloud using managed services: Cloud Run, Cloud SQL for PostgreSQL with IAM DB auth, Cloud Storage, and Cloud IAP for
This document describes the recommended topology for deploying the platform on Google Cloud Platform (GCP) using native, managed services. This approach uses Cloud Run for the core services, Cloud SQL for PostgreSQL as the database, Cloud Storage for the raw traffic archive, and Cloud IAP (Identity-Aware Proxy) for securing administrative access.
This deployment model is designed for minimal operational overhead and creates an internal-only environment with no public endpoints. All ingress is handled by a regional internal HTTP(S) load balancer. The platform's core services (admin-api, admin-ui, runtime, worker) are deployed as distinct Cloud Run services, each with its own least-privilege IAM service account.
This GCP-native topology has been generally available since v1.0 and is the same architecture used by the GCP Marketplace offering.
NOTE
The deployment process described here is typically automated on your behalf by the Specaria portal's Bring-Your-Own-Cloud (BYOC) self-service provisioning. You request a deployment from the portal rather than running the deployment scripts manually from a source checkout.
The platform is deployed as a set of interconnected GCP services. The following table maps the platform's logical components to the specific GCP resources created during installation.
| Component | GCP Resource |
|---|---|
admin-api, admin-ui, runtime, worker | Cloud Run services (s2r-admin-api, s2r-admin-ui, s2r-runtime, s2r-worker) |
| Database | Cloud SQL for PostgreSQL, accessed via private IP with IAM database authentication |
| Raw traffic archive | Cloud Storage bucket |
| Front-door identity | Cloud IAP on the admin UI and admin API backend services |
| Edge | Regional internal HTTP(S) load balancer |
| Egress to backends | Cloud Run Direct VPC egress |
The following diagram illustrates the request flow for an administrative user accessing the platform.
flowchart TD
subgraph "Your GCP Project"
subgraph "Your VPC"
User(["<br/><b>API Publisher</b><br/>(via peered network)"])
IAP[("Cloud IAP")]
LB["Regional Internal<br>HTTP(S) Load Balancer"]
subgraph "Cloud Run Services"
AdminUI["s2r-admin-ui"]
AdminAPI["s2r-admin-api"]
Runtime["s2r-runtime"]
Worker["s2r-worker"]
end
subgraph "Data Plane"
SQL[("Cloud SQL<br>for PostgreSQL")]
GCS[("Cloud Storage<br>Bucket")]
end
end
end
User --> LB
LB -- Authenticates via --> IAP
IAP -- Authorizes & Forwards --> LB
LB --> AdminUI
LB --> AdminAPI
AdminUI -- Interacts with --> AdminAPI
AdminAPI -- Reads/Writes --> SQL
Runtime -- Reads/Writes --> SQL
Worker -- Reads/Writes --> SQL
Runtime -- Archives traffic to --> GCSEach service runs with a dedicated, least-privilege IAM service account.
runtime, admin-api, and worker service accounts are granted the roles/cloudsql.client and roles/cloudsql.instanceUser roles to enable IAM database authentication with the Cloud SQL instance.runtime service account is additionally granted read access to Secret Manager for resolving backend credentials at runtime.The deployment is executed by a series of scripts in a specific order. This process is automated when using the BYOC deployment from the Specaria portal.
scripts/build-images.ps1): Container images for each service are built using Cloud Build.scripts/configure-iam.ps1): IAM service accounts are created and permissions are bound.scripts/deploy-gcloud.ps1): The four Cloud Run services are deployed. The admin-api is deployed first, which triggers the Flyway database migrations on its initial startup. The script waits for each service revision to report Ready=True before proceeding.scripts/deploy-terraform.ps1): Terraform is used to provision the supporting infrastructure, including the internal load balancer and the Cloud IAP configuration.IMPORTANT
The deployment order is gcloud first, then Terraform. The deploy-gcloud.ps1 script handles the deployment of Cloud Run services with critical service-account, secret, and provenance bindings. Terraform then configures the networking and identity infrastructure that targets these services.
Before deployment, the following resources must exist in your GCP project:
roles/iap.httpsResourceAccessor role for the admin-ui and admin-api services.GOOGLE_APPLICATION_CREDENTIALS environment variable must be set, pointing to a service account JSON key with permissions to deploy resources. The deployment scripts use this credential and do not require an interactive gcloud auth login.CAUTION
In this topology, the Cloud SQL instance is configured for private-IP only. Database access for operators and DBAs must be performed over a peered VPC network path. The application services always use IAM database authentication, not static passwords.
While the initial deployment provisions all services, you can redeploy a single service using the -Service parameter with the deployment script. This is the correct method for updating a service without losing its configuration bindings.
./scripts/deploy-gcloud.ps1 -Service admin-api
WARNING
Do not use a manual gcloud run deploy command to redeploy a service. Doing so will drop the operator-critical secret bindings that are applied by the deploy-gcloud.ps1 script.
After a deployment, verify that the installation is correctly configured and secure.
Confirm that access is properly restricted. The raw *.run.app URLs for the Cloud Run services should not be accessible from the public internet. Access should only be possible through the internal load balancer's IAP-protected hostname.
Check the following:
internal-and-cloud-load-balancing.s2r-admin-ui and s2r-admin-api.roles/iap.httpsResourceAccessor role on both admin services.roles/run.invoker role on s2r-admin-ui and s2r-admin-api.allUsers invoker bindings exist on any of the services.You can use gcloud commands to check the status of the deployed services and verify the source code provenance of a running revision.
List running services:
# Replace <region> with your deployment region
gcloud run services list --region=<region> --filter='metadata.name~"^s2r-"'
This command should list the s2r-admin-api, s2r-admin-ui, s2r-runtime, and s2r-worker services.
Check deployment provenance:
# Replace <revision> and <region> with your service revision and region
gcloud run revisions describe <revision> \
--region=<region> \
--format='value(spec.containers[0].env)' | grep S2R_DEPLOY
The output should display environment variables that indicate the source commit and build details, confirming which version of the code is running.
Finally, navigate to your IAP-gated hostname in a browser, authenticate through your identity provider, and confirm that the administration dashboard loads successfully.
The platform is designed with a cloud-adapter layer to abstract cloud-specific implementations for services like object storage and secret management. The active provider is selected at boot time via the s2r.cloud.provider and s2r.relay-vm.provider configuration settings, which default to gcp.
The following sample Terraform environments are provided as starting points for other deployment topologies:
| Directory | Cloud | Purpose |
|---|---|---|
customer-mot-gcp | GCP | Reference GCP-native environment (this deployment model) |
customer-test-aws | AWS | Sample AWS-hosted environment |
customer-test-azure | Azure | Sample Azure-hosted environment |
customer-vmware-relay-only | vSphere | F5 relay VM on vSphere |