- 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.
103 lines
3.8 KiB
Bash
103 lines
3.8 KiB
Bash
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
GREEN='\033[0;32m'
|
|
CYAN='\033[0;36m'
|
|
YELLOW='\033[1;33m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m'
|
|
|
|
info() { echo -e "${CYAN}[INFO]${NC} $1"; }
|
|
success() { echo -e "${GREEN}[OK]${NC} $1"; }
|
|
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
|
error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; }
|
|
|
|
echo ""
|
|
echo -e "${CYAN}╔════════════════════════════════════════╗${NC}"
|
|
echo -e "${CYAN}║ Infra Manager — Setup Script ║${NC}"
|
|
echo -e "${CYAN}╚════════════════════════════════════════╝${NC}"
|
|
echo ""
|
|
|
|
# Check Docker
|
|
command -v docker >/dev/null 2>&1 || error "Docker is not installed. Please install Docker first."
|
|
command -v docker compose >/dev/null 2>&1 || error "Docker Compose is not installed."
|
|
|
|
success "Docker found: $(docker --version)"
|
|
|
|
# Copy .env
|
|
if [ ! -f .env ]; then
|
|
cp .env.example .env
|
|
info "Created .env from .env.example"
|
|
else
|
|
warn ".env already exists — skipping copy"
|
|
fi
|
|
|
|
# Create SQLite database
|
|
mkdir -p database
|
|
if [ ! -f database/database.sqlite ]; then
|
|
touch database/database.sqlite
|
|
info "Created SQLite database"
|
|
fi
|
|
|
|
# Create required directories
|
|
mkdir -p storage/logs storage/framework/sessions storage/framework/views storage/framework/cache
|
|
mkdir -p bootstrap/cache public/build
|
|
chmod -R 775 storage bootstrap/cache
|
|
info "Created storage directories"
|
|
|
|
# Generate SSL self-signed cert for HTTPS
|
|
mkdir -p docker/nginx/ssl
|
|
if [ ! -f docker/nginx/ssl/cert.pem ]; then
|
|
info "Generating self-signed SSL certificate..."
|
|
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
|
-keyout docker/nginx/ssl/key.pem \
|
|
-out docker/nginx/ssl/cert.pem \
|
|
-subj "/C=US/ST=Local/L=Local/O=InfraManager/CN=localhost" 2>/dev/null
|
|
success "SSL certificate generated"
|
|
fi
|
|
|
|
# Build and start containers
|
|
info "Building Docker containers (this may take a few minutes)..."
|
|
docker compose build --no-cache php
|
|
|
|
info "Starting services..."
|
|
docker compose up -d nginx redis
|
|
|
|
info "Waiting for services to be healthy..."
|
|
sleep 5
|
|
|
|
# Run Laravel setup inside container
|
|
info "Installing PHP dependencies..."
|
|
docker compose exec php composer install --optimize-autoloader --no-interaction
|
|
|
|
info "Generating application key..."
|
|
docker compose exec php php artisan key:generate --force
|
|
|
|
info "Running database migrations..."
|
|
docker compose exec php php artisan migrate --force
|
|
|
|
info "Seeding database (default admin user)..."
|
|
docker compose exec php php artisan db:seed --force
|
|
|
|
info "Creating storage link..."
|
|
docker compose exec php php artisan storage:link
|
|
|
|
info "Caching routes and config..."
|
|
docker compose exec php php artisan config:cache
|
|
docker compose exec php php artisan route:cache
|
|
|
|
success "Setup complete!"
|
|
echo ""
|
|
echo -e "${GREEN}╔════════════════════════════════════════════════╗${NC}"
|
|
echo -e "${GREEN}║ Infra Manager is ready! ║${NC}"
|
|
echo -e "${GREEN}║ ║${NC}"
|
|
echo -e "${GREEN}║ URL: http://localhost:8080 ║${NC}"
|
|
echo -e "${GREEN}║ HTTPS: https://localhost:8443 ║${NC}"
|
|
echo -e "${GREEN}║ Email: admin@infra.local ║${NC}"
|
|
echo -e "${GREEN}║ Password: Admin@123456 ║${NC}"
|
|
echo -e "${GREEN}║ ║${NC}"
|
|
echo -e "${GREEN}║ Run dev mode (with HMR): ║${NC}"
|
|
echo -e "${GREEN}║ docker compose --profile dev up ║${NC}"
|
|
echo -e "${GREEN}╚════════════════════════════════════════════════╝${NC}"
|
|
echo ""
|