ai-music-detection / deploy.ps1
juzer09's picture
Upload 19 files
f280f9f verified
raw
history blame
2.43 kB
# Madverse Music Deployment Script for Windows
# Run with: .\deploy.ps1
Write-Host "🎡 Deploying Madverse Music API..." -ForegroundColor Cyan
# Check if Docker is installed
try {
docker --version | Out-Null
Write-Host "βœ… Docker found" -ForegroundColor Green
} catch {
Write-Host "❌ Docker is not installed. Please install Docker Desktop first." -ForegroundColor Red
exit 1
}
# Check if docker-compose is installed
try {
docker-compose --version | Out-Null
Write-Host "βœ… Docker Compose found" -ForegroundColor Green
} catch {
Write-Host "❌ Docker Compose is not installed. Please install Docker Desktop with Compose." -ForegroundColor Red
exit 1
}
# Set environment variables
if (-not $env:MADVERSE_API_KEY) {
$env:MADVERSE_API_KEY = "madverse-music-api-key-2024"
}
Write-Host "πŸ”§ Building Docker image..." -ForegroundColor Yellow
docker-compose build
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Failed to build Docker image" -ForegroundColor Red
exit 1
}
Write-Host "πŸš€ Starting services..." -ForegroundColor Yellow
docker-compose up -d
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Failed to start services" -ForegroundColor Red
exit 1
}
Write-Host "⏳ Waiting for services to be healthy..." -ForegroundColor Yellow
Start-Sleep -Seconds 30
# Test the API
Write-Host "πŸ§ͺ Testing API health..." -ForegroundColor Yellow
try {
$response = Invoke-WebRequest -Uri "http://localhost:8000/health" -Method GET -TimeoutSec 10
if ($response.StatusCode -eq 200) {
Write-Host "βœ… API is healthy and running!" -ForegroundColor Green
Write-Host "πŸ“ API URL: http://localhost:8000" -ForegroundColor Cyan
Write-Host "πŸ“– API Docs: http://localhost:8000/" -ForegroundColor Cyan
Write-Host "πŸ”‘ API Key: $env:MADVERSE_API_KEY" -ForegroundColor Cyan
} else {
throw "Health check failed"
}
} catch {
Write-Host "❌ API health check failed. Check logs:" -ForegroundColor Red
docker-compose logs madverse-api
exit 1
}
Write-Host ""
Write-Host "🎯 Quick Test Command:" -ForegroundColor Yellow
Write-Host "Invoke-RestMethod -Uri 'http://localhost:8000/analyze' -Method POST -Headers @{'X-API-Key'='$env:MADVERSE_API_KEY'; 'Content-Type'='application/json'} -Body '{`"urls`": [`"https://example.com/song.mp3`"]}'" -ForegroundColor Gray