This runbook explains how to set up all GCP resources for a new Orcha environment.
The setup-gcp.sh script creates:
OAuth credentials must be created manually in the console:
After deploying Phase 1 (FoundationStack + DataStack) and before deploying Phase 2 (ComputeStack).
getorcha-prod)gcloud auth loginapp.getorcha.com)gcloud auth login
cd /home/volrath/code/orcha/orcha/infra
./scripts/setup-gcp.sh \
--gcp-project getorcha-prod \
--aws-account 700558745280 \
--env prod \
--app-domain app.getorcha.com
The script will:
Configure OAuth Consent Screen (if not done):
https://www.googleapis.com/auth/gmail.readonlyCreate OAuth 2.0 Client ID:
https://app.getorcha.com/oauth/gmail/callbackNote the Client ID and Client Secret
This creates a separate OAuth app for Cognito user authentication. This is distinct from the Gmail OAuth above which is for email acquisition.
Still in Google Cloud Console - Credentials
Create another OAuth 2.0 Client ID:
Orcha Auth - {env} (e.g., "Orcha Auth - prod")https://{cognito-domain}.auth.eu-central-1.amazoncognito.com/oauth2/idpresponseThe Cognito domain is output by CDK deployment (e.g., v1-orcha-prod-auth).
Full URI example: https://v1-orcha-prod-auth.auth.eu-central-1.amazoncognito.com/oauth2/idpresponse
Note the Client ID and Client Secret - these go into different SSM params than Gmail:
/v1-orcha/cognito-google-client-id/v1-orcha/cognito-google-client-secretAdd the script output to your secrets, filling in the OAuth values:
# Edit secrets with values from script output and OAuth console
vim secrets
# Update SSM
./scripts/update-secrets.sh --from-file secrets
# Document AI processor
curl -s -H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://eu-documentai.googleapis.com/v1/projects/getorcha-prod/locations/eu/processors" \
| jq '.processors[].displayName'
# Workload Identity Pool
gcloud iam workload-identity-pools describe aws-prod \
--location=global --project=getorcha-prod
# Gmail Pub/Sub
gcloud pubsub topics describe gmail-notifications --project=getorcha-prod
gcloud pubsub subscriptions describe gmail-push --project=getorcha-prod
Cause: Workload Identity Federation misconfigured or AWS role name mismatch.
Fix:
v1-orcha-service-rolegcloud iam service-accounts get-iam-policy \
orcha-docai@getorcha-prod.iam.gserviceaccount.com
Cause: Org policy exception not set or set at wrong level (must be at folder level, not project).
Fix:
The script sets the iam.managed.allowedPolicyMembers policy at the folder level. Verify:
FOLDER_ID=$(gcloud projects describe getorcha-prod --format="value(parent.id)")
gcloud org-policies describe iam.managed.allowedPolicyMembers --folder=$FOLDER_ID
If missing, the script will create it automatically. The policy must be at the folder level because project-level policies don't override inherited org policies for this constraint.
Cause: Pub/Sub subscription misconfigured or endpoint unreachable.
Fix:
gcloud pubsub subscriptions describe gmail-push --project=getorcha-prod
Cause: Redirect URI mismatch.
Fix: Ensure the OAuth client's authorized redirect URI exactly matches:
https://<app-domain>/oauth/gmail/callback
| Resource | Prod Value |
|---|---|
| GCP Project | getorcha-prod |
| AWS Account | 700558745280 |
| Document AI Processor | orcha-ocr |
| Workload Identity Pool | aws-prod |
| DocAI Service Account | orcha-docai@getorcha-prod.iam.gserviceaccount.com |
| AWS IAM Role | v1-orcha-service-role |
| Gmail Topic | gmail-notifications |
| Gmail Subscription | gmail-push |
| Push Invoker SA | gmail-push-invoker@getorcha-prod.iam.gserviceaccount.com |
| Script | scripts/setup-gcp.sh |
| Gmail OAuth Redirect | https://app.getorcha.com/oauth/gmail/callback |
| Auth OAuth Redirect | https://v1-orcha-prod-auth.auth.eu-central-1.amazoncognito.com/oauth2/idpresponse |