File size: 2,430 Bytes
f280f9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 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