Infrastructure: Implement master/dev/vX branching, save git path, and fix username casing
This commit is contained in:
70
start_server.sh
Executable file
70
start_server.sh
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
# --- CONFIGURATION ---
|
||||
BACKEND_PORT=8000
|
||||
FRONTEND_PORT=3001
|
||||
BACKEND_SSL_PORT=3002
|
||||
FRONTEND_SSL_PORT=3003
|
||||
|
||||
echo "🚀 Starting TFM aInventory Stack with Dual Proxy..."
|
||||
|
||||
# 1. Kill potentially hanging processes
|
||||
echo "Sweep: Cleaning up old processes..."
|
||||
pkill -f "uvicorn" || true
|
||||
pkill -f "next-server" || true
|
||||
pkill -f "local-ssl-proxy" || true
|
||||
|
||||
# 2. Setup/Activate Virtual Environment
|
||||
if [ ! -d ".venv" ]; then
|
||||
echo "🌑 Creating virtual environment (.venv)..."
|
||||
python3 -m venv .venv
|
||||
fi
|
||||
source .venv/bin/activate
|
||||
|
||||
# 3. Check and Install Backend Dependencies
|
||||
echo "📦 Updating Python dependencies..."
|
||||
pip install -q -r backend/requirements.txt
|
||||
|
||||
# 4. Start Backend (Python/FastAPI)
|
||||
echo "🔥 Starting Backend on port $BACKEND_PORT..."
|
||||
python3 -m uvicorn backend.main:app --host 0.0.0.0 --port $BACKEND_PORT --reload &
|
||||
|
||||
# 5. Start Frontend (Next.js)
|
||||
echo "💻 Starting Frontend on port $FRONTEND_PORT..."
|
||||
cd frontend
|
||||
npm run dev -- -p $FRONTEND_PORT &
|
||||
cd ..
|
||||
|
||||
# 6. Start Proxies (Crucial for Mobile/Tablet Camera & Sync)
|
||||
npx local-ssl-proxy --source $BACKEND_SSL_PORT --target $BACKEND_PORT --hostname 0.0.0.0 > /dev/null 2>&1 &
|
||||
npx local-ssl-proxy --source $FRONTEND_SSL_PORT --target $FRONTEND_PORT --hostname 0.0.0.0 > /dev/null 2>&1 &
|
||||
|
||||
# 7. Get Local IP
|
||||
LOCAL_IP=$(ipconfig getifaddr en0 || ipconfig getifaddr en1 || echo "<YOUR-IP>")
|
||||
|
||||
# 8. Printing Unified Access Banner
|
||||
LOCAL_IP=$(ipconfig getifaddr en0 || ipconfig getifaddr en1 || echo "<YOUR-IP>")
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BOLD='\033[1m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}=======================================================${NC}"
|
||||
echo -e "${GREEN}${BOLD} 🚀 TFM aInventory UNIFIED ACCESS${NC}"
|
||||
echo -e "${GREEN}=======================================================${NC}"
|
||||
echo ""
|
||||
echo -e " USE THIS URL ON BOTH DESKTOP & MOBILE:"
|
||||
echo -e " 👉 ${GREEN}${BOLD}https://$LOCAL_IP:3003${NC}"
|
||||
echo -e " (Or ${GREEN}https://localhost:3003${NC} on this Mac)"
|
||||
echo ""
|
||||
echo -e " ${YELLOW}${BOLD}NOTE:${NC} If you see a 'Not Private' warning,"
|
||||
echo -e " Click 'Advanced' -> 'Proceed' to continue."
|
||||
echo -e "${GREEN}=======================================================${NC}"
|
||||
echo "Keep this window open while working."
|
||||
echo -e "${GREEN}=======================================================${NC}"
|
||||
|
||||
# Wait for background processes
|
||||
wait
|
||||
Reference in New Issue
Block a user