Files
Infra-Management/setup.ps1
I-Fun c649f055d8 feat: initialize Infra Manager with React, Tailwind CSS, and Inertia.js
- Added main application entry point (app.jsx) and bootstrap file for React setup.
- Created Wiki index page (Index.jsx) for documentation and file management.
- Implemented utility functions for formatting and status handling in utils.js.
- Set up Blade template (app.blade.php) for Inertia.js integration.
- Defined API routes for metrics and terminal access in api.php.
- Established console commands for scheduled tasks in console.php.
- Created web routes for various application features including authentication, hypervisors, containers, cloud accounts, security, backups, and wiki management in web.php.
- Developed setup scripts for Windows (setup.ps1) and Linux (setup.sh) environments.
- Configured Tailwind CSS for styling with custom themes and animations in tailwind.config.js.
- Set up Vite for asset bundling and development server in vite.config.js.
2026-04-07 20:29:32 +07:00

74 lines
3.5 KiB
PowerShell

# Infra Manager — Windows PowerShell Setup Script
$ErrorActionPreference = "Stop"
Write-Host ""
Write-Host "╔════════════════════════════════════════╗" -ForegroundColor Cyan
Write-Host "║ Infra Manager — Setup Script ║" -ForegroundColor Cyan
Write-Host "╚════════════════════════════════════════╝" -ForegroundColor Cyan
Write-Host ""
# Check Docker
try { docker --version | Out-Null } catch { Write-Error "Docker not found. Install Docker Desktop first."; exit 1 }
Write-Host "[OK] Docker found" -ForegroundColor Green
# Copy .env
if (-not (Test-Path ".env")) {
Copy-Item ".env.example" ".env"
Write-Host "[INFO] Created .env from .env.example" -ForegroundColor Cyan
} else {
Write-Host "[WARN] .env already exists" -ForegroundColor Yellow
}
# Create SQLite DB
New-Item -ItemType Directory -Force -Path "database" | Out-Null
if (-not (Test-Path "database\database.sqlite")) {
New-Item -ItemType File -Path "database\database.sqlite" | Out-Null
Write-Host "[INFO] Created SQLite database" -ForegroundColor Cyan
}
# Create dirs
@("storage\logs", "storage\framework\sessions", "storage\framework\views", "storage\framework\cache",
"bootstrap\cache", "public\build", "docker\nginx\ssl") | ForEach-Object {
New-Item -ItemType Directory -Force -Path $_ | Out-Null
}
# Generate self-signed cert (requires OpenSSL in PATH)
if (-not (Test-Path "docker\nginx\ssl\cert.pem")) {
try {
& openssl req -x509 -nodes -days 365 -newkey rsa:2048 `
-keyout "docker\nginx\ssl\key.pem" `
-out "docker\nginx\ssl\cert.pem" `
-subj "/CN=localhost" 2>&1 | Out-Null
Write-Host "[OK] SSL certificate generated" -ForegroundColor Green
} catch {
Write-Host "[WARN] Could not generate SSL cert. HTTPS will not work." -ForegroundColor Yellow
}
}
# Build and start
Write-Host "[INFO] Building and starting Docker containers..." -ForegroundColor Cyan
docker compose build php
docker compose up -d nginx redis
Start-Sleep -Seconds 8
# Laravel setup
Write-Host "[INFO] Running Laravel setup..." -ForegroundColor Cyan
docker compose exec php composer install --optimize-autoloader --no-interaction
docker compose exec php php artisan key:generate --force
docker compose exec php php artisan migrate --force
docker compose exec php php artisan db:seed --force
docker compose exec php php artisan storage:link
docker compose exec php php artisan config:cache
docker compose exec php php artisan route:cache
Write-Host ""
Write-Host "╔════════════════════════════════════════════════╗" -ForegroundColor Green
Write-Host "║ Infra Manager is ready! ║" -ForegroundColor Green
Write-Host "║ ║" -ForegroundColor Green
Write-Host "║ URL: http://localhost:8080 ║" -ForegroundColor Green
Write-Host "║ HTTPS: https://localhost:8443 ║" -ForegroundColor Green
Write-Host "║ Email: admin@infra.local ║" -ForegroundColor Green
Write-Host "║ Password: Admin@123456 ║" -ForegroundColor Green
Write-Host "╚════════════════════════════════════════════════╝" -ForegroundColor Green
Write-Host ""