mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-12-04 00:56:43 +09:00
## Summary - **Phase 1**: Cloud Function `divebar-mirror` — recursively indexes 84 brand folders in Divebar Google Drive into BigQuery `divebar_catalog` table. Daily at 2 AM ET. - **Phase 2**: Cloud Function `kn-data-sync` — replaces legacy `projectbread-karaokay` pipeline. Fetches full KN catalog (281K songs) + community tracks (58K with YouTube URLs). Stores to GCS + refreshes BigQuery. KN API key in Secret Manager. - **Phase 3**: Cloud Function `divebar-lookup` — public API for search, KN ID lookup, and cross-reference rebuild. Links KN songs to Divebar files via artist+title matching. All three are Pulumi-managed with dedicated service accounts, Cloud Scheduler triggers, and minimal IAM permissions. ## Infrastructure deployed - 3 Cloud Functions (Gen2, Python 3.12) - 3 Service accounts with least-privilege IAM - 4 GCS buckets (3 source + 1 data) - 3 BigQuery tables (`divebar_catalog`, `karaokenerds_community`, `kn_divebar_xref`) - 5 Cloud Scheduler jobs - 1 Secret Manager secret (`karaokenerds-api-key`) ## Test plan - [x] KN full catalog sync: 281,007 songs loaded in 60s - [x] KN community sync: 58,825 tracks loaded in 17s - [x] Divebar mirror: deployed, running initial sync (cycle detection fix applied) - [ ] Cross-reference rebuild after mirror completes - [ ] KJ Controller search integration (in kjbox PR) @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
772 B
Bash
28 lines
772 B
Bash
#!/bin/bash
|
|
# Deploy the KN Data Sync Cloud Function
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ID="${GOOGLE_CLOUD_PROJECT:-nomadkaraoke}"
|
|
REGION="us-central1"
|
|
FUNCTION_NAME="kn-data-sync"
|
|
BUCKET_NAME="kn-data-sync-source-${PROJECT_ID}"
|
|
|
|
echo "Deploying KN Data Sync Cloud Function..."
|
|
echo " Project: ${PROJECT_ID}"
|
|
echo " Region: ${REGION}"
|
|
echo " Function: ${FUNCTION_NAME}"
|
|
echo ""
|
|
|
|
cd "${SCRIPT_DIR}"
|
|
|
|
echo "Creating source ZIP..."
|
|
rm -f /tmp/kn-data-sync-source.zip
|
|
zip -r /tmp/kn-data-sync-source.zip main.py requirements.txt
|
|
|
|
echo "Uploading to GCS..."
|
|
gsutil cp /tmp/kn-data-sync-source.zip "gs://${BUCKET_NAME}/kn-data-sync-source.zip"
|
|
|
|
echo ""
|
|
echo "Source uploaded. The Cloud Function will be updated on next Pulumi deploy."
|