Files
3Dviewer/start.sh
likegears 7af9c323f6 Initial commit: 3D Viewer application
Features:
- Vue 3 frontend with Three.js/Online3DViewer
- Node.js API with PostgreSQL and Redis
- Python worker for model conversion
- Docker Compose for deployment
- ViewCube navigation with drag rotation and 90° snap
- Cross-section, exploded view, and render settings
- Parts tree with visibility controls

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 14:00:17 +08:00

67 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# 3D Viewer Startup Script
# Automatically detects the host IP address for network access
set -e
# Detect the host IP address
detect_ip() {
local ip=""
# macOS
if [[ "$OSTYPE" == "darwin"* ]]; then
# Try en0 (Wi-Fi) first, then en1 (Ethernet)
ip=$(ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null || echo "")
# Linux
else
# Get the first non-localhost IP
ip=$(hostname -I 2>/dev/null | awk '{print $1}' || echo "")
fi
# Fallback to localhost if no IP found
if [[ -z "$ip" ]]; then
ip="localhost"
fi
echo "$ip"
}
# Main
export HOST_IP=$(detect_ip)
echo "========================================"
echo " 3D Viewer Startup"
echo "========================================"
echo ""
echo "Detected HOST_IP: $HOST_IP"
echo ""
# Check if we need to rebuild frontend (first time or --rebuild flag)
if [[ "$1" == "--rebuild" ]] || [[ "$1" == "-r" ]]; then
echo "Rebuilding frontend..."
docker compose build --no-cache frontend
fi
# Stop existing containers
echo "Stopping existing containers..."
docker compose down
# Start all services
echo "Starting services..."
docker compose up -d
echo ""
echo "========================================"
echo " 3D Viewer is running!"
echo "========================================"
echo ""
echo " Local access: http://localhost"
echo " Network access: http://$HOST_IP"
echo ""
echo " MinIO Console: http://$HOST_IP:9001"
echo " API Health: http://$HOST_IP:4000/api/health"
echo ""
echo "To view logs: docker compose logs -f"
echo "To stop: docker compose down"
echo ""