@@ -18,11 +18,12 @@ drop the `[tool.uv.sources]` override once it ships on PyPI.
1818
1919Prerequisites: a Temporal Cloud namespace and API key; a Google Cloud project
2020with billing and an authenticated ` gcloud ` CLI; ` envsubst ` (` gettext ` package).
21- Worker pools bill continuously, so run scale-to- zero (step 6) after testing.
21+ Worker pools bill continuously, so scale to zero after testing (see below) .
2222
2323## Deploy
2424
25- Run from the repository root, with your own values:
25+ Run from the repository root. Set your own values (also used by the verify step
26+ below), then run the deploy script:
2627
2728``` bash
2829export PROJECT_ID=your-project-id REGION=us-central1
@@ -37,39 +38,17 @@ export COLLECTOR_CONFIG_SECRET=temporal-otel-collector COLLECTOR_CONFIG_SECRET_V
3738export WORKER_IMAGE=" ${REGION} -docker.pkg.dev/${PROJECT_ID} /${REPOSITORY} /gcp-cloud-run:v1"
3839export INSTANCE_COUNT=1
3940
40- # Steps 1-3 are one-time setup; re-run steps 4-5 to redeploy.
41- # 1. Enable APIs, create the Artifact Registry repo and the runtime service account.
42- gcloud services enable artifactregistry.googleapis.com cloudbuild.googleapis.com \
43- monitoring.googleapis.com run.googleapis.com secretmanager.googleapis.com \
44- telemetry.googleapis.com --project " $PROJECT_ID "
45- gcloud artifacts repositories create " $REPOSITORY " --location " $REGION " \
46- --repository-format docker --project " $PROJECT_ID "
47-
48- # 2. Grant the service account the collector's telemetry roles.
49- for role in roles/logging.logWriter roles/monitoring.metricWriter roles/telemetry.tracesWriter; do
50- gcloud projects add-iam-policy-binding " $PROJECT_ID " \
51- --member " serviceAccount:${SERVICE_ACCOUNT_EMAIL} " --role " $role "
52- done
53-
54- # 3. Store the API key and collector config as secrets the service account can read.
55- gcloud secrets create " $TEMPORAL_API_KEY_SECRET " --data-file " $TEMPORAL_API_KEY_FILE " --project " $PROJECT_ID "
56- gcloud secrets create " $COLLECTOR_CONFIG_SECRET " \
57- --data-file gcp/cloud_run/collector-config.yaml --project " $PROJECT_ID "
58- for secret in " $TEMPORAL_API_KEY_SECRET " " $COLLECTOR_CONFIG_SECRET " ; do
59- gcloud secrets add-iam-policy-binding " $secret " \
60- --member " serviceAccount:${SERVICE_ACCOUNT_EMAIL} " \
61- --role roles/secretmanager.secretAccessor --project " $PROJECT_ID "
62- done
41+ ./gcp/cloud_run/deploy.sh
42+ ```
6343
64- # 4. Build the image (build context is the sample dir, keeping credentials out).
65- gcloud builds submit gcp/cloud_run --region " $REGION " \
66- --tag " $WORKER_IMAGE " --project " $PROJECT_ID "
44+ ` deploy.sh ` enables the required APIs; creates the Artifact Registry repo, the
45+ runtime service account, and the API key and collector-config secrets; grants the
46+ telemetry and secret-access roles; then builds the image and deploys the
47+ two-container worker pool. The create steps are one-time and re-run safely.
6748
68- # 5. Render and deploy the two-container worker pool.
69- envsubst < gcp/cloud_run/worker-pool.yaml > /tmp/worker-pool.yaml
70- gcloud run worker-pools replace /tmp/worker-pool.yaml --project " $PROJECT_ID "
49+ Worker pools bill continuously, so scale to zero when done testing:
7150
72- # 6. Scale to zero when done to stop compute charges.
51+ ``` bash
7352gcloud run worker-pools update " $WORKER_POOL " --instances 0 \
7453 --region " $REGION " --project " $PROJECT_ID "
7554```
0 commit comments