diff --git a/deploy/tts-audio/Makefile b/deploy/tts-audio/Makefile index 3481355..24b6599 100644 --- a/deploy/tts-audio/Makefile +++ b/deploy/tts-audio/Makefile @@ -141,8 +141,8 @@ dev-synth: ## Build the image and speak TEXT=... in LOCALE=en|es|br to OUT (defa # ── GCP bootstrap ───────────────────────────────────────────────────────────── -GCP_PROJECT ?= sredevops-audio -GCS_BUCKET ?= sredevops-audio +GCP_PROJECT ?= sredevopsorg +GCS_BUCKET ?= tts-sredevopsorg GCP_LOCATION ?= us-central1 GSA_NAME ?= tts-audio-runner SITE_ORIGINS ?= https://www.sredevops.org,https://sredevops.org,http://localhost:2368 diff --git a/deploy/tts-audio/README.md b/deploy/tts-audio/README.md index 857839f..4f1c069 100644 --- a/deploy/tts-audio/README.md +++ b/deploy/tts-audio/README.md @@ -43,10 +43,37 @@ for the reader-facing behaviour. ## 1. Google Cloud +The defaults in the Makefile (and `base/configmap.yaml`) are +`GCP_PROJECT=sredevopsorg`, `GCS_BUCKET=tts-sredevopsorg`; override them for another +project. The service account is `tts-audio-runner@.iam.gserviceaccount.com` and +needs object access to that bucket only. + ```bash make gcp-bootstrap GCP_PROJECT= GCS_BUCKET= GCP_LOCATION= ``` +`gcp-bootstrap` needs a principal that can **administer** the bucket (IAM + CORS). The +runner service account deliberately cannot: it is scoped to objects, so it can write audio +but not widen its own permissions. If you are using the runner key by mistake you will see +`storage.buckets.get` / `storage.buckets.update` denied. + +Three failures are worth naming, because each one leaves a pipeline that looks deployed +but produces nothing a reader can hear: + +| Symptom | Cause | +|---|---| +| `The specified bucket does not exist` | `GCS_BUCKET` names a bucket that was never created, or the wrong project | +| Anonymous `GET` on an object returns **403** | `allUsers` → `roles/storage.objectViewer` is missing; the player cannot read it | +| `OPTIONS` preflight has no `access-control-allow-origin` | CORS was never applied; a ranged seek fails in the browser | + +Verify all three after the bootstrap: + +```bash +curl -s -o /dev/null -w 'anonymous: %{http_code}\n' "https://storage.googleapis.com/$GCS_BUCKET/" +curl -sI -X OPTIONS -H 'Origin: https://www.sredevops.org' -H 'Access-Control-Request-Method: GET' \ + "https://storage.googleapis.com/$GCS_BUCKET/" | grep -i access-control +``` + That command is idempotent and does four things: 1. Creates the bucket with **uniform bucket-level access** and public-access prevention, so diff --git a/deploy/tts-audio/base/configmap.yaml b/deploy/tts-audio/base/configmap.yaml index e92389e..5ed3628 100644 --- a/deploy/tts-audio/base/configmap.yaml +++ b/deploy/tts-audio/base/configmap.yaml @@ -19,7 +19,7 @@ metadata: data: GHOST_API_URL: "https://www.sredevops.org" SITE_URL: "https://www.sredevops.org" - GCS_BUCKET: "sredevops-audio" + GCS_BUCKET: "tts-sredevopsorg" AUDIO_BASE_URL: "https://audio.sredevops.org" # Kokoro-82M v1.0 voices. Same female timbre across locales, replacing Chirp 3: HD diff --git a/deploy/tts-audio/scripts/cors.sh b/deploy/tts-audio/scripts/cors.sh index 1abb833..54b6c04 100755 --- a/deploy/tts-audio/scripts/cors.sh +++ b/deploy/tts-audio/scripts/cors.sh @@ -13,7 +13,7 @@ set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -BUCKET="${GCS_BUCKET:-sredevops-audio}" +BUCKET="${GCS_BUCKET:-tts-sredevopsorg}" command -v gcloud >/dev/null || { echo "cors: gcloud is required" >&2; exit 2; }