Files
karaoke-gen/docs/03-deployment/CLOUD-RUN-DEPLOYMENT.md
T

4.0 KiB

Cloud Run Deployment - Complete ✅

Deployment Status

✅ Service Deployed: karaoke-backend ✅ URL: https://karaoke-backend-718638054799.us-central1.run.app ✅ Health Check: Passed (with authentication) ✅ Configuration: 2GB RAM, 2 CPU, 600s timeout ✅ Secrets: All configured and accessible ✅ Environment Variables: Set correctly

Test Results

# Health endpoint with authentication
curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" \
  https://karaoke-backend-718638054799.us-central1.run.app/api/health

Response: {"status":"healthy","service":"karaoke-gen-backend"}

Authentication Requirement

The service currently requires authentication due to an organization policy that restricts public access to Cloud Run services.

Current Behavior:

  • ❌ Public/unauthenticated access: 403 Forbidden
  • ✅ Authenticated access: Works perfectly

Options to Enable Public Access:

Contact your GCP organization admin to modify the policy:

# Check current org policies
gcloud resource-manager org-policies list --organization=YOUR_ORG_ID

# The policy preventing public access is likely:
# - iam.allowedPolicyMemberDomains
# - run.allowedIngress

Option 2: Use Cloud IAP (Identity-Aware Proxy)

Keep authentication but provide a better user experience with Cloud IAP.

Option 3: Use API Gateway

Route through API Gateway which can handle authentication differently.

Option 4: Deploy to a Different Project

If this is a sandbox/dev project with strict policies, consider deploying to a project without such restrictions.

For MVP Development (No Public Access Needed Yet)

Since we're still building the MVP and haven't built the frontend yet, this is not blocking. The backend works perfectly with authentication, which is fine for:

✅ Backend development and testing ✅ Building the React frontend (can use authenticated requests during dev) ✅ Integration testing

When ready to launch publicly, work with your org admin to enable unauthenticated access.

Current Service Configuration

Service: karaoke-backend
Region: us-central1
URL: https://karaoke-backend-718638054799.us-central1.run.app
Service Account: karaoke-backend@nomadkaraoke.iam.gserviceaccount.com
Memory: 2Gi
CPU: 2
Timeout: 600s
Min Instances: 0
Max Instances: 10
Environment: production

Environment Variables Set:

  • GOOGLE_CLOUD_PROJECT=nomadkaraoke
  • GCS_BUCKET_NAME=karaoke-gen-storage-nomadkaraoke
  • FIRESTORE_COLLECTION=jobs
  • ENVIRONMENT=production
  • LOG_LEVEL=INFO

Secrets Configured:

  • AUDIOSHAKE_API_KEY → secret: audioshake-api-key:latest
  • GENIUS_API_KEY → secret: genius-api-key:latest
  • AUDIO_SEPARATOR_API_URL → secret: audio-separator-api-url:latest

Testing Commands

Health Check

curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" \
  https://karaoke-backend-718638054799.us-central1.run.app/api/health

View Logs

gcloud logging read "resource.type=cloud_run_revision \
  AND resource.labels.service_name=karaoke-backend" \
  --limit 50 --format json

Update Service

# After rebuilding image
gcloud run deploy karaoke-backend \
  --image us-central1-docker.pkg.dev/nomadkaraoke/karaoke-repo/karaoke-backend:latest \
  --region us-central1

Next Steps

Immediate (No Public Access Required):

  1. ✅ Backend deployed and healthy
  2. 🔄 Build React Frontend (Phase 2 of migration plan)
  3. 🔄 Test API endpoints with authentication
  4. 🔄 Deploy frontend to Cloudflare Pages

Before Public Launch:

  1. 📋 Work with org admin to enable public access
  2. 📋 Test unauthenticated access
  3. 📋 Configure custom domain
  4. 📋 Set up monitoring and alerting

Status: Backend successfully deployed and functional! ✅

The authentication requirement is an organization policy constraint, not a deployment issue. The service works perfectly and is ready for frontend development.