Compare commits

..
Author SHA1 Message Date
Andrew BeveridgeandClaude Opus 4.5 c78c7bc056 fix: add karaoke-decide to WIF binding for GitHub Actions deploys
The IAMBinding is authoritative and was missing karaoke-decide,
causing GitHub Actions deploys to fail with permission denied.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 10:55:57 -05:00
Andrew BeveridgeandClaude Opus 4.5 490738ee18 Add GCE encoding worker for high-performance video encoding
- Add C4-standard-8 GCE instance with Intel Granite Rapids 3.9 GHz CPU
- Create embedded FastAPI encoding service in VM startup script
- Add encoding_service.py client for dispatching jobs to GCE worker
- Integrate GCE encoding path in video_worker.py (enabled via USE_GCE_ENCODING)
- Add health check for encoding worker to /api/health/detailed
- Configure secrets and environment variables for Cloud Run
- Add aiohttp dependency for async HTTP client

When USE_GCE_ENCODING=true, video encoding is offloaded to a dedicated
GCE instance for 2-3x faster FFmpeg libx264 encoding compared to Cloud Run.

Note: Currently using c4-standard-8 due to quota limits. Can upgrade to
c4-standard-96 after requesting quota increase for maximum performance.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 01:48:40 -05:00
12 changed files with 58 additions and 430 deletions

No files matched your search

+1 -155
View File
@@ -144,23 +144,6 @@ jobs:
needs.changes.outputs.frontend == 'true' &&
contains(github.event.pull_request.labels.*.name, 'e2e')
steps:
- name: Check disk space
run: |
echo "Checking disk space..."
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Current disk usage: ${USAGE}%"
if [ "$USAGE" -gt 70 ]; then
echo "Disk usage high, running cleanup..."
docker system prune -af || true
docker builder prune -af || true
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "After cleanup: ${USAGE}%"
fi
if [ "$USAGE" -gt 85 ]; then
echo "::error::Disk usage ${USAGE}% exceeds 85% even after cleanup. Runner needs maintenance."
exit 1
fi
- uses: actions/checkout@v4
- name: Setup Node.js with caching
@@ -225,8 +208,7 @@ jobs:
- name: Run Happy Path Production Test
working-directory: frontend
env:
TESTMAIL_API_KEY: ${{ secrets.TESTMAIL_API_KEY }}
TESTMAIL_NAMESPACE: ${{ secrets.TESTMAIL_NAMESPACE }}
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
E2E_TEST_TOKEN: ${{ secrets.E2E_TEST_TOKEN }}
E2E_ADMIN_TOKEN: ${{ secrets.E2E_ADMIN_TOKEN }}
run: |
@@ -283,23 +265,6 @@ jobs:
needs: changes
if: github.ref != 'refs/heads/main' && (needs.changes.outputs.package == 'true' || needs.changes.outputs.deps == 'true')
steps:
- name: Check disk space
run: |
echo "Checking disk space..."
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Current disk usage: ${USAGE}%"
if [ "$USAGE" -gt 70 ]; then
echo "Disk usage high, running cleanup..."
docker system prune -af || true
docker builder prune -af || true
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "After cleanup: ${USAGE}%"
fi
if [ "$USAGE" -gt 85 ]; then
echo "::error::Disk usage ${USAGE}% exceeds 85% even after cleanup. Runner needs maintenance."
exit 1
fi
- uses: actions/checkout@v4
with:
submodules: true
@@ -358,23 +323,6 @@ jobs:
needs: changes
if: github.ref != 'refs/heads/main' && (needs.changes.outputs.package == 'true' || needs.changes.outputs.deps == 'true')
steps:
- name: Check disk space
run: |
echo "Checking disk space..."
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Current disk usage: ${USAGE}%"
if [ "$USAGE" -gt 70 ]; then
echo "Disk usage high, running cleanup..."
docker system prune -af || true
docker builder prune -af || true
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "After cleanup: ${USAGE}%"
fi
if [ "$USAGE" -gt 85 ]; then
echo "::error::Disk usage ${USAGE}% exceeds 85% even after cleanup. Runner needs maintenance."
exit 1
fi
- uses: actions/checkout@v4
with:
submodules: true
@@ -428,23 +376,6 @@ jobs:
(needs.package-integration-tests.result == 'success' || needs.package-integration-tests.result == 'skipped') &&
(needs.changes.outputs.package == 'true' || needs.changes.outputs.deps == 'true')
steps:
- name: Check disk space
run: |
echo "Checking disk space..."
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Current disk usage: ${USAGE}%"
if [ "$USAGE" -gt 70 ]; then
echo "Disk usage high, running cleanup..."
docker system prune -af || true
docker builder prune -af || true
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "After cleanup: ${USAGE}%"
fi
if [ "$USAGE" -gt 85 ]; then
echo "::error::Disk usage ${USAGE}% exceeds 85% even after cleanup. Runner needs maintenance."
exit 1
fi
- uses: actions/checkout@v4
with:
submodules: true
@@ -478,23 +409,6 @@ jobs:
needs: changes
if: github.ref != 'refs/heads/main' && (needs.changes.outputs.backend == 'true' || needs.changes.outputs.package == 'true' || needs.changes.outputs.deps == 'true')
steps:
- name: Check disk space
run: |
echo "Checking disk space..."
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Current disk usage: ${USAGE}%"
if [ "$USAGE" -gt 70 ]; then
echo "Disk usage high, running cleanup..."
docker system prune -af || true
docker builder prune -af || true
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "After cleanup: ${USAGE}%"
fi
if [ "$USAGE" -gt 85 ]; then
echo "::error::Disk usage ${USAGE}% exceeds 85% even after cleanup. Runner needs maintenance."
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
with:
@@ -532,23 +446,6 @@ jobs:
needs: changes
if: github.ref != 'refs/heads/main' && (needs.changes.outputs.backend == 'true' || needs.changes.outputs.package == 'true' || needs.changes.outputs.deps == 'true')
steps:
- name: Check disk space
run: |
echo "Checking disk space..."
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Current disk usage: ${USAGE}%"
if [ "$USAGE" -gt 70 ]; then
echo "Disk usage high, running cleanup..."
docker system prune -af || true
docker builder prune -af || true
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "After cleanup: ${USAGE}%"
fi
if [ "$USAGE" -gt 85 ]; then
echo "::error::Disk usage ${USAGE}% exceeds 85% even after cleanup. Runner needs maintenance."
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
with:
@@ -596,23 +493,6 @@ jobs:
needs: changes
if: github.ref != 'refs/heads/main' && (needs.changes.outputs.backend == 'true' || needs.changes.outputs.package == 'true')
steps:
- name: Check disk space
run: |
echo "Checking disk space..."
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Current disk usage: ${USAGE}%"
if [ "$USAGE" -gt 70 ]; then
echo "Disk usage high, running cleanup..."
docker system prune -af || true
docker builder prune -af || true
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "After cleanup: ${USAGE}%"
fi
if [ "$USAGE" -gt 85 ]; then
echo "::error::Disk usage ${USAGE}% exceeds 85% even after cleanup. Runner needs maintenance."
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
with:
@@ -688,23 +568,6 @@ jobs:
runs-on: [self-hosted, linux, gcp]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Check disk space
run: |
echo "Checking disk space..."
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Current disk usage: ${USAGE}%"
if [ "$USAGE" -gt 70 ]; then
echo "Disk usage high, running cleanup..."
docker system prune -af || true
docker builder prune -af || true
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "After cleanup: ${USAGE}%"
fi
if [ "$USAGE" -gt 85 ]; then
echo "::error::Disk usage ${USAGE}% exceeds 85% even after cleanup. Runner needs maintenance."
exit 1
fi
- uses: actions/checkout@v4
with:
submodules: true
@@ -915,23 +778,6 @@ jobs:
BASE_IMAGE_NAME: karaoke-backend-base
APP_IMAGE_NAME: karaoke-backend
steps:
- name: Check disk space
run: |
echo "Checking disk space..."
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Current disk usage: ${USAGE}%"
if [ "$USAGE" -gt 70 ]; then
echo "Disk usage high, running cleanup..."
docker system prune -af || true
docker builder prune -af || true
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "After cleanup: ${USAGE}%"
fi
if [ "$USAGE" -gt 85 ]; then
echo "::error::Disk usage ${USAGE}% exceeds 85% even after cleanup. Runner needs maintenance."
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
with:
+1 -2
View File
@@ -70,8 +70,7 @@ jobs:
- name: Run E2E Happy Path Test
working-directory: frontend
env:
TESTMAIL_API_KEY: ${{ secrets.TESTMAIL_API_KEY }}
TESTMAIL_NAMESPACE: ${{ secrets.TESTMAIL_NAMESPACE }}
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
E2E_TEST_TOKEN: ${{ inputs.use_test_token == 'true' && secrets.E2E_TEST_TOKEN || '' }}
E2E_ADMIN_TOKEN: ${{ secrets.E2E_ADMIN_TOKEN }}
DEBUG_MODE: ${{ inputs.debug_mode || 'false' }}
+2 -34
View File
@@ -1082,18 +1082,6 @@ async def get_download_urls(
}
# Map file keys to human-readable suffixes (matching Dropbox naming from karaoke_finalise.py)
DOWNLOAD_FILENAME_SUFFIXES = {
"lossless_4k_mp4": " (Final Karaoke Lossless 4k).mp4",
"lossless_4k_mkv": " (Final Karaoke Lossless 4k).mkv",
"lossy_4k_mp4": " (Final Karaoke Lossy 4k).mp4",
"lossy_720p_mp4": " (Final Karaoke Lossy 720p).mp4",
"cdg_zip": " (Final Karaoke CDG).zip",
"txt_zip": " (Final Karaoke TXT).zip",
"with_vocals": " (With Vocals).mkv",
}
@router.get("/{job_id}/download/{category}/{file_key}")
async def download_file(
job_id: str,
@@ -1158,28 +1146,8 @@ async def download_file(
}
content_type = content_types.get(ext, 'application/octet-stream')
# Build proper filename: "Artist - Title (Final Karaoke Lossy 4k).mp4"
# Sanitize artist/title to remove filesystem-unsafe characters
def sanitize_filename_part(s: str) -> str:
if not s:
return ""
# Remove/replace characters unsafe for filesystems: / \ : * ? " < > |
unsafe_chars = r'[/\\:*?"<>|]'
import re
sanitized = re.sub(unsafe_chars, '', s)
# Collapse multiple spaces and trim
sanitized = ' '.join(sanitized.split())
# Limit length to prevent overly long filenames
return sanitized[:100].strip()
artist_clean = sanitize_filename_part(job.artist) if job.artist else None
title_clean = sanitize_filename_part(job.title) if job.title else None
base_name = f"{artist_clean} - {title_clean}" if artist_clean and title_clean else None
if base_name and file_key in DOWNLOAD_FILENAME_SUFFIXES:
filename = f"{base_name}{DOWNLOAD_FILENAME_SUFFIXES[file_key]}"
else:
filename = gcs_path.split('/')[-1] # Fallback to original
# Get filename for Content-Disposition
filename = gcs_path.split('/')[-1]
try:
# Download to temp file and stream
+6 -9
View File
@@ -23,15 +23,12 @@
│ • Video Worker - Final assembly and encoding │
└───────────────────────────┬─────────────────────────────────────┘
│
┌─────────────┼─────────────┬───────────────┐
▼ ▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────────┐ ┌──────────────┐
│ Firestore│ │ GCS │ │Secret Manager│ │GCE Encoding │
│ (jobs) │ │ (files) │ │ (API keys) │ │ Worker (*) │
└──────────┘ └──────────┘ └──────────────┘ └──────────────┘
(*) GCE Encoding Worker: C4-standard-8 VM with Intel Granite Rapids for
high-performance FFmpeg encoding. Optional - falls back to Cloud Run.
┌─────────────┼─────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────────┐
│ Firestore│ │ GCS │ │Secret Manager│
│ (jobs) │ │ (files) │ │ (API keys) │
└──────────┘ └──────────┘ └──────────────┘
```
## Processing Pipeline
+5 -7
View File
@@ -14,14 +14,14 @@
## Test Requirements
### 1. New User Registration (testmail.app)
### 1. New User Registration (MailSlurp)
- [ ] Navigate to landing page (`gen.nomadkaraoke.com`)
- [ ] Click "Sign In" or "Get Started" button
- [ ] Create a NEW testmail.app inbox (fresh email address for each test run)
- [ ] Create a NEW MailSlurp inbox (fresh email address for each test run)
- [ ] Enter the test email in the beta enrollment form
- [ ] Submit the form
- [ ] Wait for welcome/magic-link email in testmail.app inbox
- [ ] Wait for welcome/magic-link email in MailSlurp inbox
- [ ] Extract the magic link from the email
- [ ] Click/navigate to the magic link to authenticate
- [ ] Verify user is logged in and has credits
@@ -118,8 +118,7 @@
### Environment Variables
```bash
TESTMAIL_API_KEY=xxx # Required - for email testing
TESTMAIL_NAMESPACE=xxx # Required - testmail.app namespace
MAILSLURP_API_KEY=xxx # Required - for email testing
# No pre-auth tokens - test handles full signup
```
@@ -161,8 +160,7 @@ Log detailed progress at each step with timestamps for debugging.
### Secrets Required
- `TESTMAIL_API_KEY` - For email testing
- `TESTMAIL_NAMESPACE` - testmail.app namespace
- `MAILSLURP_API_KEY` - For email testing
### Workflow Steps
-70
View File
@@ -569,51 +569,6 @@ GitHub-hosted runners have ~14GB disk, which caused failures during Docker build
See `docs/archive/2025-12-28-self-hosted-github-runner.md` for full details.
### Docker Disk Space Management on Self-Hosted Runners
**Problem**: Even with 200GB SSDs, self-hosted runners can fill up with Docker images. Each CI build creates new dangling images (~15GB each), and without aggressive cleanup, disk fills in days.
**Symptoms**:
- CI jobs fail with `No space left on device`
- Jobs that require Docker (build, deploy, emulator tests) fail
- Runners 11-20 at 100% while 1-10 at 30% (newer runners had less cleanup history)
**Root cause**: Original cleanup cron used `docker system prune -af --filter "until=168h"` which only removes images older than 7 days. With frequent CI builds, most dangling images are < 7 days old and never get cleaned.
**Solution** (two-layer approach):
1. **Hourly threshold-based cleanup** (on runners):
```bash
# /etc/cron.hourly/docker-cleanup
THRESHOLD=70
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
if [ "$USAGE" -gt "$THRESHOLD" ]; then
docker system prune -af # No age filter!
docker builder prune -af
fi
```
2. **Pre-job disk check** (in CI workflow):
```yaml
- name: Check disk space
run: |
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
if [ "$USAGE" -gt 70 ]; then
docker system prune -af || true
docker builder prune -af || true
fi
if [ "$USAGE" -gt 85 ]; then
echo "::error::Disk usage exceeds 85%. Runner needs maintenance."
exit 1
fi
```
**Key insights**:
- Remove the age filter (`--filter "until=168h"`) - dangling images should always be cleaned
- Threshold-based cleanup is better than time-based (don't clean if disk is fine)
- Pre-job checks provide fail-fast behavior with clear error messages
- `docker builder prune -af` catches buildkit cache that `system prune` misses
## Performance Observations
| Operation | Duration |
@@ -770,31 +725,6 @@ result = job.state_data['search_results'][selection_index]
**Lesson**: Design for stateless request handling. Any state that must survive between requests must be persisted externally.
### GCS Downloads Preserve Directory Structure
**Problem**: When downloading files from GCS, the directory structure is preserved. Code that uses non-recursive glob patterns won't find files in subdirectories.
**Example**: GCE encoding worker downloaded from `gs://bucket/jobs/{job_id}/` but files were stored as:
- `videos/with_vocals.mkv`
- `stems/instrumental_clean.flac`
The original code used `work_dir.glob("*.mkv")` which only searched the root directory, causing "No video files found" errors.
**Solution**: Use recursive glob patterns and filter results:
```python
# BAD - only searches root directory
input_files = list(work_dir.glob("*.mkv"))
# GOOD - searches all subdirectories
input_files = list(work_dir.glob("**/*.mkv"))
# Filter out outputs directory to avoid re-encoding
input_files = [f for f in input_files if "outputs" not in str(f)]
```
**Related gotcha**: Case sensitivity matters. GCS stores filenames as-is, so if files are uploaded as `instrumental_clean.flac` (lowercase), searching for `*Instrumental*.flac` (capital I) won't find them. Use case-insensitive patterns or search for both cases.
**Lesson**: When writing code that processes files downloaded from GCS, always use recursive glob patterns and verify the expected directory structure matches what's actually stored.
### Library Caches Need GCS Sync in Cloud Run
**Problem**: Libraries like LyricsTranscriber cache API responses to local directories (e.g., `~/lyrics-transcriber-cache`). In Cloud Run, each container is ephemeral - the cache is lost on every restart or scale-up, causing redundant API calls.
-4
View File
@@ -34,10 +34,6 @@
## Recent Changes
- **GCE Encoding Worker** (2026-01-03): Added optional high-performance encoding on dedicated GCE VM (C4-standard-8 with Intel Granite Rapids 3.9 GHz). Uses `USE_GCE_ENCODING=true` env var. Falls back to Cloud Run if unavailable. See [ARCHITECTURE.md](ARCHITECTURE.md).
- **Runner Disk Space Auto-Cleanup** (2026-01-03): Fixed CI failures caused by self-hosted runners filling up with Docker images. Changed cleanup from daily/7-day-old to hourly/threshold-based (70%). Added pre-job disk checks to all self-hosted CI jobs. See [LESSONS-LEARNED.md](LESSONS-LEARNED.md#docker-disk-space-management-on-self-hosted-runners)
- **E2E Happy Path Test** (2026-01-02): Added comprehensive E2E test that validates the complete karaoke generation journey using ONLY browser UI interactions (no API shortcuts). Test covers all 12 steps from landing page through cleanup. Runs daily via GitHub Actions and takes ~38 minutes. See [E2E-HAPPY-PATH-TEST-SPEC.md](E2E-HAPPY-PATH-TEST-SPEC.md)
- **LyricsTranscriber Cache Persistence** (2026-01-02): Added GCS-backed cache for LyricsTranscriber to avoid redundant API calls. AudioShake transcription and lyrics provider responses (Genius, Spotify, LRCLib, Musixmatch) are now cached to `gs://karaoke-gen-storage/lyrics-transcriber-cache/`. Cache is synced before/after each job, persisting across Cloud Run instances. Significantly reduces API costs and speeds up repeated processing of same songs.
+26 -93
View File
@@ -1,9 +1,9 @@
"use client"
import { useEffect, useState, useRef, useCallback } from "react"
import { useEffect, useState } from "react"
import { api } from "@/lib/api"
import { Button } from "@/components/ui/button"
import { Download, Loader2, ExternalLink, FolderOpen, Copy } from "lucide-react"
import { Download, Loader2, ExternalLink, FolderOpen } from "lucide-react"
interface OutputLinksProps {
jobId: string
@@ -14,28 +14,17 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
const [youtubeUrl, setYoutubeUrl] = useState<string | null>(null)
const [dropboxUrl, setDropboxUrl] = useState<string | null>(null)
const [isLoading, setIsLoading] = useState(false)
const [copiedUrl, setCopiedUrl] = useState<string | null>(null)
const copyTimeoutRef = useRef<NodeJS.Timeout | null>(null)
useEffect(() => {
loadOutputLinks()
}, [jobId])
// Cleanup timeout on unmount
useEffect(() => {
return () => {
if (copyTimeoutRef.current) {
clearTimeout(copyTimeoutRef.current)
}
}
}, [])
async function loadOutputLinks() {
setIsLoading(true)
try {
const result = await api.getDownloadUrls(jobId)
setDownloadUrls(result.download_urls)
// Extract YouTube and Dropbox URLs from state_data if available
const job = await api.getJob(jobId)
if (job.state_data?.youtube_url) {
@@ -51,31 +40,6 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
}
}
const copyToClipboard = useCallback(async (url: string) => {
// Check if clipboard API is available
if (!navigator?.clipboard?.writeText) {
console.error("Clipboard API not available")
return
}
try {
await navigator.clipboard.writeText(url)
setCopiedUrl(url)
// Clear any existing timeout
if (copyTimeoutRef.current) {
clearTimeout(copyTimeoutRef.current)
}
// Set new timeout
copyTimeoutRef.current = setTimeout(() => {
setCopiedUrl(null)
}, 2000)
} catch (err) {
console.error("Failed to copy to clipboard:", err)
}
}, [])
if (isLoading) {
return (
<div className="flex items-center gap-2 text-xs" style={{ color: 'var(--text-muted)' }}>
@@ -96,55 +60,33 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
<div className="flex flex-wrap gap-2">
{/* Distribution Links */}
{youtubeUrl && (
<div className="flex gap-1">
<a
href={youtubeUrl}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded-l bg-red-600 hover:bg-red-500 text-white"
onClick={(e) => e.stopPropagation()}
>
<ExternalLink className="w-3 h-3" />
View on YouTube
</a>
<button
type="button"
onClick={(e) => { e.stopPropagation(); copyToClipboard(youtubeUrl) }}
className="inline-flex items-center text-xs px-2 py-1.5 rounded-r bg-red-700 hover:bg-red-600 text-white"
title="Copy YouTube URL"
aria-label={copiedUrl === youtubeUrl ? "YouTube URL copied" : "Copy YouTube URL"}
>
{copiedUrl === youtubeUrl ? <span className="text-[10px]">Copied!</span> : <Copy className="w-3 h-3" />}
</button>
</div>
<a
href={youtubeUrl}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-red-600 hover:bg-red-500 text-white"
onClick={(e) => e.stopPropagation()}
>
<ExternalLink className="w-3 h-3" />
View on YouTube
</a>
)}
{dropboxUrl && (
<div className="flex gap-1">
<a
href={dropboxUrl}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded-l bg-blue-600 hover:bg-blue-500 text-white"
onClick={(e) => e.stopPropagation()}
>
<FolderOpen className="w-3 h-3" />
Dropbox Folder
</a>
<button
type="button"
onClick={(e) => { e.stopPropagation(); copyToClipboard(dropboxUrl) }}
className="inline-flex items-center text-xs px-2 py-1.5 rounded-r bg-blue-700 hover:bg-blue-600 text-white"
title="Copy Dropbox URL"
aria-label={copiedUrl === dropboxUrl ? "Dropbox URL copied" : "Copy Dropbox URL"}
>
{copiedUrl === dropboxUrl ? <span className="text-[10px]">Copied!</span> : <Copy className="w-3 h-3" />}
</button>
</div>
<a
href={dropboxUrl}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-blue-600 hover:bg-blue-500 text-white"
onClick={(e) => e.stopPropagation()}
>
<FolderOpen className="w-3 h-3" />
Dropbox Folder
</a>
)}
{/* Download Links */}
{downloadUrls?.finals?.lossy_720p_mp4 && (
{downloadUrls?.finals?.lossy_720p && (
<a
href={api.getDownloadUrl(jobId, "finals", "lossy_720p_mp4")}
href={api.getDownloadUrl(jobId, "finals", "lossy_720p")}
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-green-600 hover:bg-green-500 text-white"
onClick={(e) => e.stopPropagation()}
>
@@ -162,16 +104,6 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
4K Video
</a>
)}
{downloadUrls?.videos?.with_vocals && (
<a
href={api.getDownloadUrl(jobId, "videos", "with_vocals")}
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-purple-600 hover:bg-purple-500 text-white"
onClick={(e) => e.stopPropagation()}
>
<Download className="w-3 h-3" />
With Vocals
</a>
)}
{downloadUrls?.packages?.cdg_zip && (
<a
href={api.getDownloadUrl(jobId, "packages", "cdg_zip")}
@@ -202,3 +134,4 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
</div>
)
}
@@ -11,7 +11,7 @@ import { createEmailHelper, isEmailTestingAvailable } from '../helpers/email-tes
*
* Test Flow:
* 1. Landing Page - Navigate and verify
* 2. New User Signup - Create testmail.app inbox, submit beta form, verify email
* 2. New User Signup - Create MailSlurp inbox, submit beta form, verify email
* 3. Magic Link Auth - Click magic link to authenticate
* 4. Create Job - Search for test song via UI
* 5. Audio Selection - Select audio source via UI dialog
@@ -24,7 +24,7 @@ import { createEmailHelper, isEmailTestingAvailable } from '../helpers/email-tes
* 12. Cleanup - Delete distributed content and job
*
* Environment Variables:
* - TESTMAIL_API_KEY + TESTMAIL_NAMESPACE: Required for email testing (can be skipped with E2E_TEST_TOKEN)
* - MAILSLURP_API_KEY: Required for email testing (can be skipped with E2E_TEST_TOKEN)
* - E2E_TEST_TOKEN: Pre-configured user token to skip signup flow (for iterations)
* - E2E_ADMIN_TOKEN: Required for cleanup endpoint (optional - cleanup skipped if not set)
*/
@@ -138,12 +138,12 @@ test.describe('E2E Happy Path - Real User with Full UI Interactions', () => {
}) => {
test.setTimeout(TIMEOUTS.fullTest);
// Check if we have a pre-configured token (for iterations without using testmail.app)
// Check if we have a pre-configured token (for iterations without using MailSlurp)
const usePreConfiguredToken = hasPreConfiguredToken();
// Skip if neither pre-configured token nor testmail.app is available
// Skip if neither pre-configured token nor MailSlurp is available
if (!usePreConfiguredToken && !isEmailTestingAvailable()) {
test.skip(true, 'Neither E2E_TEST_TOKEN nor TESTMAIL_API_KEY/TESTMAIL_NAMESPACE set - cannot run test');
test.skip(true, 'Neither E2E_TEST_TOKEN nor MAILSLURP_API_KEY set - cannot run test');
return;
}
@@ -217,7 +217,7 @@ test.describe('E2E Happy Path - Real User with Full UI Interactions', () => {
console.log('STEP 3 COMPLETE: User authenticated with pre-configured token');
} else {
// ----- FULL PATH: Beta signup with testmail.app -----
// ----- FULL PATH: Beta signup with MailSlurp -----
console.log('\n========================================');
console.log('STEP 2: New User Beta Enrollment');
console.log('========================================');
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "karaoke-gen-frontend",
"version": "0.79.0",
"version": "0.78.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "karaoke-gen-frontend",
"version": "0.79.0",
"version": "0.78.0",
"dependencies": {
"@hookform/resolvers": "^3.10.0",
"@radix-ui/react-accordion": "1.2.2",
+8 -47
View File
@@ -1237,10 +1237,8 @@ def run_encoding(job_id: str, work_dir: Path, config: dict):
jobs[job_id]["progress"] = 10
try:
# Find input files (search recursively since GCS downloads preserve directory structure)
input_files = list(work_dir.glob("**/*.mkv")) + list(work_dir.glob("**/*.mp4")) + list(work_dir.glob("**/*.mov"))
# Exclude files in the outputs directory to avoid re-encoding previous outputs
input_files = [f for f in input_files if "outputs" not in str(f)]
# Find input files
input_files = list(work_dir.glob("*.mkv")) + list(work_dir.glob("*.mp4")) + list(work_dir.glob("*.mov"))
if not input_files:
raise ValueError(f"No video files found in {work_dir}")
@@ -1248,14 +1246,8 @@ def run_encoding(job_id: str, work_dir: Path, config: dict):
input_video = input_files[0]
logger.info(f"Using input video: {input_video}")
# Find instrumental audio (search recursively, case-insensitive patterns)
# GCS stores as: instrumental_clean.flac, instrumental_with_backing.flac
instrumental_files = (
list(work_dir.glob("**/*instrumental*.flac")) +
list(work_dir.glob("**/*instrumental*.wav")) +
list(work_dir.glob("**/*Instrumental*.flac")) +
list(work_dir.glob("**/*Instrumental*.wav"))
)
# Find instrumental audio
instrumental_files = list(work_dir.glob("*Instrumental*.flac")) + list(work_dir.glob("*Instrumental*.wav"))
instrumental = instrumental_files[0] if instrumental_files else None
output_dir = work_dir / "outputs"
@@ -2014,44 +2006,13 @@ echo "Python 3.13 added to tool cache"
# ==================== Docker cleanup cron ====================
# Prevent disk from filling up with old Docker images
# Run hourly instead of daily, with threshold-based cleanup
echo "Setting up Docker cleanup cron..."
cat > /etc/cron.hourly/docker-cleanup << 'CRON'
cat > /etc/cron.daily/docker-cleanup << 'CRON'
#!/bin/bash
# Docker disk space cleanup for GitHub Actions runners
# Runs hourly, with aggressive cleanup when disk usage exceeds threshold
# Log to syslog
exec 1> >(logger -t docker-cleanup) 2>&1
THRESHOLD=70 # Cleanup when disk usage exceeds this percentage
# Get current disk usage percentage (remove % sign)
USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Current disk usage: ${USAGE}%"
if [ "$USAGE" -gt "$THRESHOLD" ]; then
echo "Disk usage ${USAGE}% exceeds threshold ${THRESHOLD}%, running cleanup..."
# Remove ALL unused images (not just old ones) - this is the key fix
# The previous 168h filter let recent images accumulate
docker system prune -af
# Also clean builder cache which can grow large
docker builder prune -af
# Report new usage
NEW_USAGE=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "Cleanup complete. Disk usage: ${NEW_USAGE}%"
else
echo "Disk usage ${USAGE}% is below threshold ${THRESHOLD}%, skipping cleanup"
fi
# Clean up Docker resources older than 7 days
docker system prune -af --filter "until=168h"
CRON
chmod +x /etc/cron.hourly/docker-cleanup
# Remove old daily cleanup if it exists (migrating to hourly)
rm -f /etc/cron.daily/docker-cleanup
chmod +x /etc/cron.daily/docker-cleanup
# ==================== Docker pre-warm cron ====================
# Keep base images fresh by pulling hourly
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "karaoke-gen"
version = "0.87.1"
version = "0.87.0"
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"