diff --git a/README.md b/README.md index ca07426..31127db 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,24 @@ A lightweight, cloud-native API for storing and querying test artifacts includin ## Quick Start -### Using Docker Compose (Recommended) +### One-Command Setup + +**Linux/macOS:** +```bash +./quickstart.sh +``` + +**Windows (PowerShell):** +```powershell +.\quickstart.ps1 +``` + +**Windows (Command Prompt):** +```batch +quickstart.bat +``` + +### Manual Setup with Docker Compose 1. Clone the repository: ```bash @@ -52,10 +69,10 @@ cp .env.example .env docker-compose up -d ``` -4. Access the API: -- API: http://localhost:8000 -- API Docs: http://localhost:8000/docs -- MinIO Console: http://localhost:9001 +4. Access the application: +- **Web UI**: http://localhost:8000 +- **API Docs**: http://localhost:8000/docs +- **MinIO Console**: http://localhost:9001 ### Using Python Directly diff --git a/quickstart.bat b/quickstart.bat new file mode 100644 index 0000000..be8fc12 --- /dev/null +++ b/quickstart.bat @@ -0,0 +1,106 @@ +@echo off +setlocal enabledelayedexpansion + +echo ========================================= +echo Test Artifact Data Lake - Quick Start +echo ========================================= +echo. + +REM Check if Docker is installed +where docker >nul 2>nul +if %errorlevel% neq 0 ( + echo Error: Docker is not installed. Please install Docker Desktop first. + echo Visit: https://www.docker.com/products/docker-desktop + pause + exit /b 1 +) + +REM Check if Docker Compose is available +where docker-compose >nul 2>nul +if %errorlevel% neq 0 ( + REM Try docker compose (new version) + docker compose version >nul 2>nul + if %errorlevel% neq 0 ( + echo Error: Docker Compose is not available. + echo Please ensure Docker Desktop is running. + pause + exit /b 1 + ) + set COMPOSE_CMD=docker compose +) else ( + set COMPOSE_CMD=docker-compose +) + +REM Create .env file if it doesn't exist +if not exist .env ( + echo Creating .env file from .env.example... + copy .env.example .env >nul + echo [OK] .env file created +) else ( + echo [OK] .env file already exists +) + +echo. +echo Starting services with Docker Compose... +%COMPOSE_CMD% up -d + +if %errorlevel% neq 0 ( + echo. + echo Error: Failed to start services. + echo Make sure Docker Desktop is running. + pause + exit /b 1 +) + +echo. +echo Waiting for services to be ready... +timeout /t 15 /nobreak >nul + +echo. +echo ========================================= +echo Services are running! +echo ========================================= +echo. +echo Web UI: http://localhost:8000 +echo API Docs: http://localhost:8000/docs +echo MinIO Console: http://localhost:9001 +echo Username: minioadmin +echo Password: minioadmin +echo. +echo To view logs: %COMPOSE_CMD% logs -f +echo To stop: %COMPOSE_CMD% down +echo. +echo ========================================= +echo Testing the API... +echo ========================================= +echo. + +REM Wait a bit more for API to be fully ready +timeout /t 5 /nobreak >nul + +REM Test health endpoint +curl -s http://localhost:8000/health | findstr "healthy" >nul 2>nul +if %errorlevel% equ 0 ( + echo [OK] API is healthy! + echo. + echo ========================================= + echo Open your browser to get started: + echo http://localhost:8000 + echo ========================================= +) else ( + echo [WARNING] API is not responding yet. + echo Please wait a moment and check http://localhost:8000 +) + +echo. +echo ========================================= +echo Setup complete! +echo ========================================= +echo. +echo Press any key to open the UI in your browser... +pause >nul + +REM Open browser +start http://localhost:8000 + +exit /b 0 diff --git a/quickstart.ps1 b/quickstart.ps1 new file mode 100644 index 0000000..09373cb --- /dev/null +++ b/quickstart.ps1 @@ -0,0 +1,129 @@ +# Test Artifact Data Lake - Quick Start (PowerShell) + +Write-Host "=========================================" -ForegroundColor Cyan +Write-Host "Test Artifact Data Lake - Quick Start" -ForegroundColor Cyan +Write-Host "=========================================" -ForegroundColor Cyan +Write-Host "" + +# Check if Docker is installed +try { + $dockerVersion = docker --version + Write-Host "[OK] Docker found: $dockerVersion" -ForegroundColor Green +} catch { + Write-Host "[ERROR] Docker is not installed." -ForegroundColor Red + Write-Host "Please install Docker Desktop first:" -ForegroundColor Yellow + Write-Host "https://www.docker.com/products/docker-desktop" -ForegroundColor Yellow + Read-Host "Press Enter to exit" + exit 1 +} + +# Determine Docker Compose command +$composeCmd = "docker-compose" +try { + docker-compose version | Out-Null +} catch { + # Try new docker compose syntax + try { + docker compose version | Out-Null + $composeCmd = "docker compose" + } catch { + Write-Host "[ERROR] Docker Compose is not available." -ForegroundColor Red + Write-Host "Please ensure Docker Desktop is running." -ForegroundColor Yellow + Read-Host "Press Enter to exit" + exit 1 + } +} + +Write-Host "[OK] Using: $composeCmd" -ForegroundColor Green + +# Create .env file if it doesn't exist +if (-Not (Test-Path ".env")) { + Write-Host "Creating .env file from .env.example..." -ForegroundColor Yellow + Copy-Item .env.example .env + Write-Host "[OK] .env file created" -ForegroundColor Green +} else { + Write-Host "[OK] .env file already exists" -ForegroundColor Green +} + +Write-Host "" +Write-Host "Starting services with Docker Compose..." -ForegroundColor Yellow + +# Start services +if ($composeCmd -eq "docker-compose") { + docker-compose up -d +} else { + docker compose up -d +} + +if ($LASTEXITCODE -ne 0) { + Write-Host "" + Write-Host "[ERROR] Failed to start services." -ForegroundColor Red + Write-Host "Make sure Docker Desktop is running." -ForegroundColor Yellow + Read-Host "Press Enter to exit" + exit 1 +} + +Write-Host "" +Write-Host "Waiting for services to be ready..." -ForegroundColor Yellow +Start-Sleep -Seconds 15 + +Write-Host "" +Write-Host "=========================================" -ForegroundColor Cyan +Write-Host "Services are running!" -ForegroundColor Green +Write-Host "=========================================" -ForegroundColor Cyan +Write-Host "" +Write-Host "Web UI: " -NoNewline +Write-Host "http://localhost:8000" -ForegroundColor Yellow +Write-Host "API Docs: " -NoNewline +Write-Host "http://localhost:8000/docs" -ForegroundColor Yellow +Write-Host "MinIO Console: " -NoNewline +Write-Host "http://localhost:9001" -ForegroundColor Yellow +Write-Host " Username: minioadmin" +Write-Host " Password: minioadmin" +Write-Host "" +Write-Host "To view logs: $composeCmd logs -f" -ForegroundColor Cyan +Write-Host "To stop: $composeCmd down" -ForegroundColor Cyan +Write-Host "" +Write-Host "=========================================" -ForegroundColor Cyan +Write-Host "Testing the API..." -ForegroundColor Yellow +Write-Host "=========================================" -ForegroundColor Cyan +Write-Host "" + +# Wait a bit more for API +Start-Sleep -Seconds 5 + +# Test health endpoint +try { + $response = Invoke-WebRequest -Uri "http://localhost:8000/health" -UseBasicParsing -TimeoutSec 5 + if ($response.Content -like "*healthy*") { + Write-Host "[OK] API is healthy!" -ForegroundColor Green + Write-Host "" + Write-Host "=========================================" -ForegroundColor Cyan + Write-Host "Opening browser..." -ForegroundColor Yellow + Write-Host "http://localhost:8000" -ForegroundColor Yellow + Write-Host "=========================================" -ForegroundColor Cyan + + # Open browser + Start-Process "http://localhost:8000" + } +} catch { + Write-Host "[WARNING] API is not responding yet." -ForegroundColor Yellow + Write-Host "Please wait a moment and check http://localhost:8000" -ForegroundColor Yellow +} + +Write-Host "" +Write-Host "=========================================" -ForegroundColor Cyan +Write-Host "Setup complete! " -NoNewline +Write-Host "🚀" -ForegroundColor Green +Write-Host "=========================================" -ForegroundColor Cyan +Write-Host "" +Write-Host "Useful Commands:" -ForegroundColor Cyan +Write-Host " Generate seed data: " -NoNewline +Write-Host "Use the 'Generate Seed Data' button in the UI" -ForegroundColor Yellow +Write-Host " View logs: " -NoNewline +Write-Host "$composeCmd logs -f api" -ForegroundColor Yellow +Write-Host " Restart services: " -NoNewline +Write-Host "$composeCmd restart" -ForegroundColor Yellow +Write-Host " Stop all: " -NoNewline +Write-Host "$composeCmd down" -ForegroundColor Yellow +Write-Host ""