ZMB Webui: Complete Project – Rebrand & Initial Clean Commit
ARCHITECTURE ============ Backend: FastAPI + uvicorn (port 8000) - JWT authentication with PAM system users - ZFS CLI wrapper with caching (30-60s TTL) - WebSocket pool status broadcaster (30s interval) - Services: auth, zfs_runner, file_manager, shares, identities, system_info - Routers: pools, datasets, snapshots, shares, identities, navigator, system Frontend: Next.js 15 + TypeScript (static export) - Incremental Static Regeneration (ISR) for weak hardware - Type-safe API client (lib/api.ts) - Dark mode + custom Tailwind theme - Pages: Dashboard, Login, Snapshots, Datasets, Shares, etc. DEPLOYMENT ========== Test Target: 192.168.1.179:8090 (Debian LXC) Production: 10.66.120.3:9090 (Raspberry Pi 4GB ARM64) Updater: Automated Gitea-based deployment (update-test.sh, update-pi.sh) FEATURES COMPLETED ================== Phase 3a: Dashboard Quick Stats (System, CPU, Memory, Storage) - Real-time stats with color-coded progress bars - Responsive grid layout (mobile: 1, tablet: 2, desktop: 4 columns) - ISR-optimized for fast loads on weak hardware REBRANDING ========== Renamed throughout: - Project: 'ZFS Manager' → 'ZMB Webui' - Services: 'zfs-manager' → 'zmb-webui' - Systemd units: zfs-manager-backend → zmb-webui-backend - Configuration files and documentation Co-Authored-By: Patrick <patrick@perlbach24.de>
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
# ZMB Webui Frontend Deployment Script
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== ZMB Webui Frontend Deployment ==="
|
||||
|
||||
# Configuration
|
||||
FRONTEND_DIR="/opt/zmb-webui/frontend"
|
||||
NODE_VERSION="v20.19.2"
|
||||
NPM_VERSION="9.2.0"
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Check Node.js and npm
|
||||
echo -e "${YELLOW}1. Checking Node.js and npm...${NC}"
|
||||
NODE_INSTALLED=$(node --version 2>/dev/null || echo "")
|
||||
if [ -z "$NODE_INSTALLED" ]; then
|
||||
echo -e "${RED}✗ Node.js not installed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${GREEN}✓ Node.js $NODE_INSTALLED installed${NC}"
|
||||
|
||||
NPM_INSTALLED=$(npm --version 2>/dev/null || echo "")
|
||||
if [ -z "$NPM_INSTALLED" ]; then
|
||||
echo -e "${RED}✗ npm not installed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${GREEN}✓ npm $NPM_INSTALLED installed${NC}"
|
||||
|
||||
# Check frontend directory
|
||||
echo -e "${YELLOW}2. Checking frontend directory...${NC}"
|
||||
if [ ! -d "$FRONTEND_DIR" ]; then
|
||||
echo -e "${RED}✗ Frontend directory not found: $FRONTEND_DIR${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${GREEN}✓ Frontend directory found${NC}"
|
||||
|
||||
# Install dependencies
|
||||
echo -e "${YELLOW}3. Installing dependencies...${NC}"
|
||||
cd "$FRONTEND_DIR"
|
||||
npm install --prefer-offline --no-audit
|
||||
echo -e "${GREEN}✓ Dependencies installed${NC}"
|
||||
|
||||
# Build project
|
||||
echo -e "${YELLOW}4. Building Next.js project...${NC}"
|
||||
npm run build
|
||||
echo -e "${GREEN}✓ Build successful${NC}"
|
||||
|
||||
# Create systemd service
|
||||
echo -e "${YELLOW}5. Setting up systemd service...${NC}"
|
||||
sudo cp /tmp/zmb-webui-frontend.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable zmb-webui-frontend
|
||||
echo -e "${GREEN}✓ Systemd service configured${NC}"
|
||||
|
||||
# Start service
|
||||
echo -e "${YELLOW}6. Starting frontend service...${NC}"
|
||||
sudo systemctl restart zmb-webui-frontend
|
||||
sleep 2
|
||||
|
||||
# Verify service
|
||||
if sudo systemctl is-active --quiet zmb-webui-frontend; then
|
||||
echo -e "${GREEN}✓ Frontend service running${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Frontend service failed to start${NC}"
|
||||
sudo systemctl status zmb-webui-frontend
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test connectivity
|
||||
echo -e "${YELLOW}7. Testing connectivity...${NC}"
|
||||
sleep 2
|
||||
if curl -s http://localhost:3000 > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ Frontend accessible at http://localhost:3000${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠ Frontend not yet responding (may be starting)${NC}"
|
||||
fi
|
||||
|
||||
# Summary
|
||||
echo ""
|
||||
echo -e "${GREEN}=== Deployment Complete ===${NC}"
|
||||
echo ""
|
||||
echo "Frontend is running at:"
|
||||
echo " Local: http://localhost:3000"
|
||||
echo " Remote: http://$(hostname -I | awk '{print $1}'):9090"
|
||||
echo ""
|
||||
echo "Admin credentials:"
|
||||
echo " Username: admin"
|
||||
echo " Password: testpass123"
|
||||
echo ""
|
||||
echo "Service management:"
|
||||
echo " systemctl status zmb-webui-frontend"
|
||||
echo " systemctl restart zmb-webui-frontend"
|
||||
echo " systemctl stop zmb-webui-frontend"
|
||||
echo ""
|
||||
echo "Logs:"
|
||||
echo " journalctl -u zmb-webui-frontend -f"
|
||||
Reference in New Issue
Block a user