Switch to angular
This commit is contained in:
156
scripts/dev-start.ps1
Normal file
156
scripts/dev-start.ps1
Normal file
@@ -0,0 +1,156 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$Help
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if ($Help) {
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host "Test Artifact Data Lake - Development Setup" -ForegroundColor Cyan
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Usage: .\dev-start.ps1 [OPTIONS]" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "Options:" -ForegroundColor Yellow
|
||||
Write-Host " -Help Show this help message" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "This script starts backend services and frontend development server." -ForegroundColor Green
|
||||
Write-Host ""
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host "Test Artifact Data Lake - Development Setup" -ForegroundColor Cyan
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Check if Node.js is installed
|
||||
if (-not (Get-Command "node" -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "Error: Node.js is not installed. Please install Node.js 18+ first." -ForegroundColor Red
|
||||
Write-Host "Visit: https://nodejs.org/" -ForegroundColor Yellow
|
||||
Read-Host "Press Enter to exit"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check Node.js version
|
||||
try {
|
||||
$nodeVersion = & node --version
|
||||
$majorVersion = [int]($nodeVersion -replace 'v(\d+)\..*', '$1')
|
||||
if ($majorVersion -lt 18) {
|
||||
Write-Host "Error: Node.js version 18 or higher is required. Current version: $nodeVersion" -ForegroundColor Red
|
||||
Read-Host "Press Enter to exit"
|
||||
exit 1
|
||||
}
|
||||
Write-Host "[OK] Node.js version: $nodeVersion" -ForegroundColor Green
|
||||
}
|
||||
catch {
|
||||
Write-Host "Error: Failed to check Node.js version" -ForegroundColor Red
|
||||
Read-Host "Press Enter to exit"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if npm is installed
|
||||
if (-not (Get-Command "npm" -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "Error: npm is not installed. Please install npm first." -ForegroundColor Red
|
||||
Read-Host "Press Enter to exit"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$npmVersion = & npm --version
|
||||
Write-Host "[OK] npm version: $npmVersion" -ForegroundColor Green
|
||||
|
||||
# Check if Docker is installed
|
||||
if (-not (Get-Command "docker" -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "Error: Docker is not installed. Please install Docker Desktop first." -ForegroundColor Red
|
||||
Write-Host "Visit: https://www.docker.com/products/docker-desktop" -ForegroundColor Yellow
|
||||
Read-Host "Press Enter to exit"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if Docker Compose is available
|
||||
$ComposeCmd = $null
|
||||
if (Get-Command "docker-compose" -ErrorAction SilentlyContinue) {
|
||||
$ComposeCmd = "docker-compose"
|
||||
} else {
|
||||
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] Docker Compose command: $ComposeCmd" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
# 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 backend services (PostgreSQL, MinIO, API)..." -ForegroundColor Yellow
|
||||
|
||||
# Start backend services
|
||||
try {
|
||||
if ($ComposeCmd -eq "docker compose") {
|
||||
& docker compose up -d postgres minio api
|
||||
} else {
|
||||
& docker-compose up -d postgres minio api
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "Error: Failed to start backend 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 backend services to be ready..." -ForegroundColor Yellow
|
||||
Start-Sleep -Seconds 10
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Installing frontend dependencies..." -ForegroundColor Yellow
|
||||
Set-Location "frontend"
|
||||
|
||||
try {
|
||||
& npm install
|
||||
Write-Host "[OK] Frontend dependencies installed" -ForegroundColor Green
|
||||
}
|
||||
catch {
|
||||
Write-Host "Error: Failed to install frontend dependencies" -ForegroundColor Red
|
||||
Set-Location ".."
|
||||
Read-Host "Press Enter to exit"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host "Development Environment Ready!" -ForegroundColor Green
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Backend API: http://localhost:8000" -ForegroundColor White
|
||||
Write-Host "API Docs: http://localhost:8000/docs" -ForegroundColor White
|
||||
Write-Host "MinIO Console: http://localhost:9001" -ForegroundColor White
|
||||
Write-Host " Username: minioadmin" -ForegroundColor Gray
|
||||
Write-Host " Password: minioadmin" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
Write-Host "Frontend will be available at: http://localhost:4200" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "To view backend logs: $ComposeCmd logs -f api" -ForegroundColor Yellow
|
||||
Write-Host "To stop backend: $ComposeCmd down" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
Write-Host "Starting frontend development server..." -ForegroundColor Green
|
||||
|
||||
# Start the frontend development server
|
||||
& npm run start
|
||||
89
scripts/dev-start.sh
Normal file
89
scripts/dev-start.sh
Normal file
@@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "========================================="
|
||||
echo "Test Artifact Data Lake - Development Setup"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
|
||||
# Check if Node.js is installed
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo "Error: Node.js is not installed. Please install Node.js 18+ first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check Node.js version
|
||||
NODE_VERSION=$(node --version | cut -d'v' -f2 | cut -d'.' -f1)
|
||||
if [ "$NODE_VERSION" -lt "18" ]; then
|
||||
echo "Error: Node.js version 18 or higher is required. Current version: $(node --version)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if npm is installed
|
||||
if ! command -v npm &> /dev/null; then
|
||||
echo "Error: npm is not installed. Please install npm first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Docker is installed for backend services
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "Error: Docker is not installed. Please install Docker first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Docker Compose is installed
|
||||
if ! command -v docker-compose &> /dev/null; then
|
||||
echo "Error: Docker Compose is not installed. Please install Docker Compose first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ Node.js version: $(node --version)"
|
||||
echo "✓ npm version: $(npm --version)"
|
||||
echo "✓ Docker version: $(docker --version)"
|
||||
echo ""
|
||||
|
||||
# Create .env file if it doesn't exist
|
||||
if [ ! -f .env ]; then
|
||||
echo "Creating .env file from .env.example..."
|
||||
cp .env.example .env
|
||||
echo "✓ .env file created"
|
||||
else
|
||||
echo "✓ .env file already exists"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Starting backend services (PostgreSQL, MinIO, API)..."
|
||||
docker-compose up -d postgres minio api
|
||||
|
||||
echo ""
|
||||
echo "Waiting for backend services to be ready..."
|
||||
sleep 10
|
||||
|
||||
echo ""
|
||||
echo "Installing frontend dependencies..."
|
||||
cd frontend
|
||||
npm install
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Development Environment Ready!"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "Backend API: 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 start the frontend development server:"
|
||||
echo " cd frontend"
|
||||
echo " npm run start"
|
||||
echo ""
|
||||
echo "Frontend will be available at: http://localhost:4200"
|
||||
echo ""
|
||||
echo "To view backend logs: docker-compose logs -f api"
|
||||
echo "To stop backend: docker-compose down"
|
||||
echo ""
|
||||
echo "Starting frontend development server..."
|
||||
npm run start
|
||||
105
scripts/quickstart-build.sh
Normal file
105
scripts/quickstart-build.sh
Normal file
@@ -0,0 +1,105 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "========================================="
|
||||
echo "Test Artifact Data Lake - Production Build"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
|
||||
# Check if Node.js is installed
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo "Error: Node.js is not installed. Please install Node.js 18+ first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Docker is installed
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "Error: Docker is not installed. Please install Docker first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Docker Compose is installed
|
||||
if ! command -v docker-compose &> /dev/null; then
|
||||
echo "Error: Docker Compose is not installed. Please install Docker Compose first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create .env file if it doesn't exist
|
||||
if [ ! -f .env ]; then
|
||||
echo "Creating .env file from .env.example..."
|
||||
cp .env.example .env
|
||||
echo "✓ .env file created"
|
||||
else
|
||||
echo "✓ .env file already exists"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Building Angular Frontend..."
|
||||
echo "========================================="
|
||||
echo ""
|
||||
|
||||
cd frontend
|
||||
|
||||
# Install dependencies if node_modules doesn't exist
|
||||
if [ ! -d "node_modules" ]; then
|
||||
echo "Installing frontend dependencies..."
|
||||
npm install
|
||||
fi
|
||||
|
||||
# Build the Angular app for production
|
||||
echo "Building Angular app for production..."
|
||||
npm run build
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Frontend build failed. Please check the errors above."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ Frontend built successfully"
|
||||
|
||||
cd ..
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Starting Docker Services..."
|
||||
echo "========================================="
|
||||
echo ""
|
||||
|
||||
docker-compose -f docker-compose.production.yml up -d
|
||||
|
||||
echo ""
|
||||
echo "Waiting for services to be ready..."
|
||||
sleep 15
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Services are running!"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "Frontend (UI): http://localhost:80"
|
||||
echo "API: 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: docker-compose -f docker-compose.production.yml logs -f"
|
||||
echo "To stop: docker-compose -f docker-compose.production.yml down"
|
||||
echo ""
|
||||
echo "NOTE: The main application UI is now available at http://localhost:80"
|
||||
echo " This is an Angular application with Material Design components."
|
||||
echo ""
|
||||
|
||||
# Test health endpoint
|
||||
sleep 5
|
||||
if curl -s http://localhost:8000/health | grep -q "healthy"; then
|
||||
echo "✓ API is healthy!"
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Setup complete! 🚀"
|
||||
echo "========================================="
|
||||
else
|
||||
echo "⚠ API is not responding yet. Please wait a moment and check http://localhost:80"
|
||||
fi
|
||||
213
scripts/quickstart.ps1
Normal file
213
scripts/quickstart.ps1
Normal file
@@ -0,0 +1,213 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$Rebuild,
|
||||
[switch]$FullStack,
|
||||
[switch]$Dev,
|
||||
[switch]$Help
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if ($Help) {
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host "Test Artifact Data Lake - Quick Start" -ForegroundColor Cyan
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Usage: .\quickstart.ps1 [OPTIONS]" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "Options:" -ForegroundColor Yellow
|
||||
Write-Host " -Rebuild Force rebuild of all containers" -ForegroundColor White
|
||||
Write-Host " -FullStack Start complete stack including frontend (production build)" -ForegroundColor White
|
||||
Write-Host " -Dev Start backend only, use separate dev server for frontend" -ForegroundColor White
|
||||
Write-Host " -Help Show this help message" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "Default: Starts backend services only (recommended for development)" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
exit 0
|
||||
}
|
||||
|
||||
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
|
||||
if (-not (Get-Command "docker" -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "Error: Docker is not installed. Please install Docker Desktop first." -ForegroundColor Red
|
||||
Write-Host "Visit: https://www.docker.com/products/docker-desktop" -ForegroundColor Yellow
|
||||
Read-Host "Press Enter to exit"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if Docker Compose is available
|
||||
$ComposeCmd = $null
|
||||
if (Get-Command "docker-compose" -ErrorAction SilentlyContinue) {
|
||||
$ComposeCmd = "docker-compose"
|
||||
} else {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
# 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 ""
|
||||
|
||||
# Handle rebuild logic
|
||||
if ($Rebuild) {
|
||||
Write-Host "Rebuilding containers..." -ForegroundColor Yellow
|
||||
Write-Host "Stopping existing containers..." -ForegroundColor White
|
||||
|
||||
if ($FullStack) {
|
||||
if ($ComposeCmd -eq "docker compose") {
|
||||
& docker compose -f "docker-compose.production.yml" down
|
||||
Write-Host "Removing existing images for full rebuild..." -ForegroundColor White
|
||||
& docker compose -f "docker-compose.production.yml" down --rmi local 2>$null
|
||||
Write-Host "Building and starting full stack..." -ForegroundColor White
|
||||
& docker compose -f "docker-compose.production.yml" up -d --build
|
||||
} else {
|
||||
& docker-compose -f "docker-compose.production.yml" down
|
||||
Write-Host "Removing existing images for full rebuild..." -ForegroundColor White
|
||||
& docker-compose -f "docker-compose.production.yml" down --rmi local 2>$null
|
||||
Write-Host "Building and starting full stack..." -ForegroundColor White
|
||||
& docker-compose -f "docker-compose.production.yml" up -d --build
|
||||
}
|
||||
} else {
|
||||
if ($ComposeCmd -eq "docker compose") {
|
||||
& docker compose down
|
||||
Write-Host "Removing existing backend images for rebuild..." -ForegroundColor White
|
||||
& docker compose down --rmi local 2>$null
|
||||
Write-Host "Building and starting backend services..." -ForegroundColor White
|
||||
& docker compose up -d --build
|
||||
} else {
|
||||
& docker-compose down
|
||||
Write-Host "Removing existing backend images for rebuild..." -ForegroundColor White
|
||||
& docker-compose down --rmi local 2>$null
|
||||
Write-Host "Building and starting backend services..." -ForegroundColor White
|
||||
& docker-compose up -d --build
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# Regular startup
|
||||
if ($FullStack) {
|
||||
Write-Host "Starting full production stack (backend + frontend)..." -ForegroundColor Green
|
||||
if ($ComposeCmd -eq "docker compose") {
|
||||
& docker compose -f "docker-compose.production.yml" up -d
|
||||
} else {
|
||||
& docker-compose -f "docker-compose.production.yml" up -d
|
||||
}
|
||||
} else {
|
||||
Write-Host "Starting backend services..." -ForegroundColor Green
|
||||
if ($ComposeCmd -eq "docker compose") {
|
||||
& docker compose up -d
|
||||
} else {
|
||||
& docker-compose up -d
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Waiting for services to be ready..." -ForegroundColor Yellow
|
||||
Start-Sleep -Seconds 15
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
if ($FullStack) {
|
||||
Write-Host "Complete Stack is running!" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Backend Services are running!" -ForegroundColor Green
|
||||
}
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "API: http://localhost:8000" -ForegroundColor White
|
||||
Write-Host "API Docs: http://localhost:8000/docs" -ForegroundColor White
|
||||
Write-Host "MinIO Console: http://localhost:9001" -ForegroundColor White
|
||||
Write-Host " Username: minioadmin" -ForegroundColor Gray
|
||||
Write-Host " Password: minioadmin" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
|
||||
if ($FullStack) {
|
||||
Write-Host "Frontend: http://localhost:80" -ForegroundColor White
|
||||
Write-Host " (Production build with Nginx)" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
Write-Host "To view logs: $ComposeCmd -f docker-compose.production.yml logs -f" -ForegroundColor Yellow
|
||||
Write-Host "To stop: $ComposeCmd -f docker-compose.production.yml down" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host "To view logs: $ComposeCmd logs -f" -ForegroundColor Yellow
|
||||
Write-Host "To stop: $ComposeCmd down" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host "Frontend Options:" -ForegroundColor Cyan
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Development (with hot reload):" -ForegroundColor White
|
||||
Write-Host " .\dev-start.ps1" -ForegroundColor Green
|
||||
Write-Host " Frontend will be available at: http://localhost:4200" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
Write-Host "Or start full production stack:" -ForegroundColor White
|
||||
Write-Host " .\quickstart.ps1 -FullStack" -ForegroundColor Green
|
||||
Write-Host " Complete stack at: http://localhost:80" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host "Rebuild Options:" -ForegroundColor Cyan
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Force rebuild backend: .\quickstart.ps1 -Rebuild" -ForegroundColor Yellow
|
||||
Write-Host "Force rebuild full stack: .\quickstart.ps1 -Rebuild -FullStack" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host "Testing the API..." -ForegroundColor Cyan
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Wait a bit more for API to be fully ready
|
||||
Start-Sleep -Seconds 5
|
||||
|
||||
# Test health endpoint
|
||||
try {
|
||||
$response = Invoke-RestMethod -Uri "http://localhost:8000/health" -Method Get -TimeoutSec 10
|
||||
if ($response.status -eq "healthy") {
|
||||
Write-Host "[OK] API is healthy!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
if (-not $FullStack) {
|
||||
Write-Host "Ready for development!" -ForegroundColor Green
|
||||
Write-Host "Run '.\dev-start.ps1' to start the frontend with hot reload" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
}
|
||||
Write-Host "Example: Upload a test file" -ForegroundColor White
|
||||
Write-Host "----------------------------" -ForegroundColor Gray
|
||||
Write-Host 'echo "test,data" > test.csv' -ForegroundColor Green
|
||||
Write-Host 'curl -X POST "http://localhost:8000/api/v1/artifacts/upload"' -ForegroundColor Green
|
||||
Write-Host ' -F "file=@test.csv"' -ForegroundColor Green
|
||||
Write-Host ' -F "test_name=sample_test"' -ForegroundColor Green
|
||||
Write-Host ' -F "test_suite=demo"' -ForegroundColor Green
|
||||
Write-Host ' -F "test_result=pass"' -ForegroundColor Green
|
||||
Write-Host ""
|
||||
} else {
|
||||
Write-Host "[WARNING] API returned unexpected status. Please check http://localhost:8000/health" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "[WARNING] API is not responding yet. Please wait a moment and check http://localhost:8000/health" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host "Setup complete!" -ForegroundColor Green
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
189
scripts/quickstart.sh
Normal file
189
scripts/quickstart.sh
Normal file
@@ -0,0 +1,189 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "========================================="
|
||||
echo "Test Artifact Data Lake - Quick Start"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
|
||||
# Check if Docker is installed
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "Error: Docker is not installed. Please install Docker first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Docker Compose is installed
|
||||
COMPOSE_CMD=""
|
||||
if command -v docker-compose &> /dev/null; then
|
||||
COMPOSE_CMD="docker-compose"
|
||||
elif docker compose version &> /dev/null; then
|
||||
COMPOSE_CMD="docker compose"
|
||||
else
|
||||
echo "Error: Docker Compose is not installed. Please install Docker Compose first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Parse command line arguments
|
||||
REBUILD=false
|
||||
FULL_STACK=false
|
||||
DEV_MODE=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--rebuild)
|
||||
REBUILD=true
|
||||
shift
|
||||
;;
|
||||
--full-stack)
|
||||
FULL_STACK=true
|
||||
shift
|
||||
;;
|
||||
--dev)
|
||||
DEV_MODE=true
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --rebuild Force rebuild of all containers"
|
||||
echo " --full-stack Start complete stack including frontend (production build)"
|
||||
echo " --dev Start backend only, use separate dev server for frontend"
|
||||
echo " --help Show this help message"
|
||||
echo ""
|
||||
echo "Default: Starts backend services only (recommended for development)"
|
||||
echo ""
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
echo "Use --help for usage information"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Create .env file if it doesn't exist
|
||||
if [ ! -f .env ]; then
|
||||
echo "Creating .env file from .env.example..."
|
||||
cp .env.example .env
|
||||
echo "✓ .env file created"
|
||||
else
|
||||
echo "✓ .env file already exists"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Stop existing containers if rebuild is requested
|
||||
if [ "$REBUILD" = true ]; then
|
||||
echo "🔄 Rebuilding containers..."
|
||||
echo "Stopping existing containers..."
|
||||
$COMPOSE_CMD down
|
||||
|
||||
if [ "$FULL_STACK" = true ]; then
|
||||
echo "Removing existing images for full rebuild..."
|
||||
$COMPOSE_CMD -f docker-compose.production.yml down --rmi local 2>/dev/null || true
|
||||
echo "Building and starting full stack..."
|
||||
$COMPOSE_CMD -f docker-compose.production.yml up -d --build
|
||||
else
|
||||
echo "Removing existing backend images for rebuild..."
|
||||
$COMPOSE_CMD down --rmi local 2>/dev/null || true
|
||||
echo "Building and starting backend services..."
|
||||
$COMPOSE_CMD up -d --build
|
||||
fi
|
||||
else
|
||||
# Regular startup
|
||||
if [ "$FULL_STACK" = true ]; then
|
||||
echo "Starting full production stack (backend + frontend)..."
|
||||
$COMPOSE_CMD -f docker-compose.production.yml up -d
|
||||
else
|
||||
echo "Starting backend services..."
|
||||
$COMPOSE_CMD up -d
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Waiting for services to be ready..."
|
||||
sleep 15
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
if [ "$FULL_STACK" = true ]; then
|
||||
echo "Complete Stack is running! 🚀"
|
||||
else
|
||||
echo "Backend Services are running!"
|
||||
fi
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "API: http://localhost:8000"
|
||||
echo "API Docs: http://localhost:8000/docs"
|
||||
echo "MinIO Console: http://localhost:9001"
|
||||
echo " Username: minioadmin"
|
||||
echo " Password: minioadmin"
|
||||
echo ""
|
||||
|
||||
if [ "$FULL_STACK" = true ]; then
|
||||
echo "Frontend: http://localhost:80"
|
||||
echo " (Production build with Nginx)"
|
||||
echo ""
|
||||
echo "To view logs: $COMPOSE_CMD -f docker-compose.production.yml logs -f"
|
||||
echo "To stop: $COMPOSE_CMD -f docker-compose.production.yml down"
|
||||
else
|
||||
echo "To view logs: $COMPOSE_CMD logs -f"
|
||||
echo "To stop: $COMPOSE_CMD down"
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Frontend Options:"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "Development (with hot reload):"
|
||||
echo " ./dev-start.sh"
|
||||
echo " Frontend will be available at: http://localhost:4200"
|
||||
echo ""
|
||||
echo "Or start full production stack:"
|
||||
echo " ./quickstart.sh --full-stack"
|
||||
echo " Complete stack at: http://localhost:80"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Rebuild Options:"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "Force rebuild backend: ./quickstart.sh --rebuild"
|
||||
echo "Force rebuild full stack: ./quickstart.sh --rebuild --full-stack"
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Testing the API..."
|
||||
echo "========================================="
|
||||
echo ""
|
||||
|
||||
# Wait a bit more for API to be fully ready
|
||||
sleep 5
|
||||
|
||||
# Test health endpoint
|
||||
if curl -s http://localhost:8000/health | grep -q "healthy"; then
|
||||
echo "✓ API is healthy!"
|
||||
echo ""
|
||||
if [ "$FULL_STACK" = false ]; then
|
||||
echo "🎯 Ready for development!"
|
||||
echo "Run './dev-start.sh' to start the frontend with hot reload"
|
||||
echo ""
|
||||
fi
|
||||
echo "Example: Upload a test file"
|
||||
echo "----------------------------"
|
||||
echo 'echo "test,data" > test.csv'
|
||||
echo 'curl -X POST "http://localhost:8000/api/v1/artifacts/upload" \'
|
||||
echo ' -F "file=@test.csv" \'
|
||||
echo ' -F "test_name=sample_test" \'
|
||||
echo ' -F "test_suite=demo" \'
|
||||
echo ' -F "test_result=pass"'
|
||||
echo ""
|
||||
else
|
||||
echo "⚠ API is not responding yet. Please wait a moment and check http://localhost:8000/health"
|
||||
fi
|
||||
|
||||
echo "========================================="
|
||||
echo "Setup complete! 🚀"
|
||||
echo "========================================="
|
||||
Reference in New Issue
Block a user