infra: give audio-download-job the Tornado key (0.291.1) (#1251)

`audio-download-job` does most YouTube downloads, and it gets secrets
from Pulumi rather than CI's API deploy, so #1247's wiring alone would
have left Tornado off for them.

Already applied to prod with `gcloud run jobs update --update-secrets`
(env diff checked: one variable added). This records it in Pulumi so a
later apply doesn't remove it. Pulumi preview couldn't run from Andrew's
Mac: its GCP provider fails with `socket is not connected` on IPv6 token
requests, while `gcloud` works. Run a targeted preview later to confirm
no diff:

`scripts/gcp-admin pulumi preview --stack prod --diff --target
'urn:pulumi:prod::karaoke-gen-infrastructure::gcp:cloudrunv2/job:Job::audio-download-job-us-east4'`

Merging also triggers the API deploy, which now finds secret
`tornado-api-key` and wires it there.

No local CodeRabbit review on this small config change, so the bot may
review it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_012RYLVTvqXyL4QyA2EjzQMG


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
  * Updated credential availability for audio download processing.

* **Documentation**
* Clarified how the Tornado API credential is provided to the API
service and audio download processing.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andrew Beveridge ☄️andClaude Opus 5.5 authored and GitHub committed 2026-11-04 23:36:33 -05:00
1 parent ca05245469
commit 688ca162f8
3 files changed
+14 -2

No files matched your search

+1 -1
View File
@@ -705,7 +705,7 @@ Audio can come from file upload or remote search (YouTube, torrents). All YouTub
2026-09-26; the backend and `audio-download-job` / `bulk-search-job` have no VPC egress, so every
dependency they call must be reachable on a public address.
- `FLACFETCH_API_KEY` - API key for authentication
- `TORNADO_API_KEY` - TornadoAPI key (secret `tornado-api-key`). When set, YouTube downloads and availability checks try Tornado first and fall back to flacfetch: WARNING per failed download, ERROR if the account is rejected. CI wires the secret once it has a version. It covers downloads only, so YouTube search still uses flacfetch's cookies.
- `TORNADO_API_KEY` - TornadoAPI key (secret `tornado-api-key`). When set, YouTube downloads and availability checks try Tornado first and fall back to flacfetch: WARNING per failed download, ERROR if the account is rejected. The secret was created by hand (not in `secrets.py`). CI wires it on the API service once it has a version; Pulumi wires it on `audio-download-job`, which does most YouTube downloads. It covers downloads only, so YouTube search still uses flacfetch's cookies.
- `YOUTUBE_DOWNLOAD_PROVIDER` - set to `flacfetch` to switch Tornado off, e.g. `gcloud run services update karaoke-backend --update-env-vars YOUTUBE_DOWNLOAD_PROVIDER=flacfetch` (default `tornado`; the next CI deploy resets it, so also change the workflow to make it permanent).
## Worker Execution
+12
View File
@@ -516,6 +516,18 @@ def create_audio_download_job(
),
),
),
# TornadoAPI key: YouTube downloads try Tornado first, flacfetch is
# the fallback (backend/services/youtube_download_service.py). This job
# does most YouTube downloads; CI wires the same secret on the API service.
cloudrunv2.JobTemplateTemplateContainerEnvArgs(
name="TORNADO_API_KEY",
value_source=cloudrunv2.JobTemplateTemplateContainerEnvValueSourceArgs(
secret_key_ref=cloudrunv2.JobTemplateTemplateContainerEnvValueSourceSecretKeyRefArgs(
secret=f"projects/{PROJECT_ID}/secrets/tornado-api-key",
version="latest",
),
),
),
# Flacfetch API URL (public HTTPS endpoint; no VPC egress)
cloudrunv2.JobTemplateTemplateContainerEnvArgs(
name="FLACFETCH_API_URL",
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "karaoke-gen"
version = "0.291.0"
version = "0.291.1"
description = "Generate karaoke videos with synchronized lyrics. Handles the entire process from downloading audio and lyrics to creating the final video with title screens."
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
license = "MIT"