File size: 3,469 Bytes
9c0b225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
@echo off
setlocal EnableDelayedExpansion
title MAC Platform β€” One-Click Setup
color 0A

echo.
echo  ╔══════════════════════════════════════════════════════╗
echo  β•‘         MAC Platform β€” One-Click Setup               β•‘
echo  β•‘   Multi-Agent Classroom  (c) 2025                    β•‘
echo  β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
echo.

:: ── Step 1: Check Docker Desktop is running ────────────────
echo [1/6] Checking Docker Desktop...
docker info >nul 2>&1
if %errorlevel% neq 0 (
    echo.
    echo  ERROR: Docker Desktop is not running.
    echo  Please start Docker Desktop and run this script again.
    echo.
    pause
    exit /b 1
)
echo  OK β€” Docker is running.

:: ── Step 2: Check Python ───────────────────────────────────
echo [2/6] Checking Python...
python --version >nul 2>&1
if %errorlevel% neq 0 (
    echo  ERROR: Python not found. Install Python 3.11+ from https://python.org
    pause
    exit /b 1
)
for /f "tokens=*" %%v in ('python --version 2^>^&1') do echo  OK β€” %%v

:: ── Step 3: Start Postgres + Redis via Docker Compose ──────
echo [3/6] Starting PostgreSQL and Redis...
docker compose up -d postgres redis
if %errorlevel% neq 0 (
    echo  ERROR: docker compose failed. Make sure docker-compose.yml is present.
    pause
    exit /b 1
)
echo  OK β€” Postgres and Redis started.
echo  Waiting 3 seconds for DB to be ready...
timeout /t 3 /nobreak >nul

:: ── Step 4: Install Python dependencies ───────────────────
echo [4/6] Installing Python dependencies...
pip install -r requirements.txt --quiet
if %errorlevel% neq 0 (
    echo  WARNING: Some packages may have failed. Check requirements.txt.
)
echo  OK β€” Dependencies installed.

:: ── Step 5: Detect LAN IP ──────────────────────────────────
echo [5/6] Detecting network address...
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| findstr /R "IPv4.*192\.\|IPv4.*10\.\|IPv4.*172\."') do (
    set LAN_IP=%%a
    set LAN_IP=!LAN_IP: =!
    goto :found_ip
)
set LAN_IP=localhost
:found_ip
echo  OK β€” LAN IP: %LAN_IP%

:: ── Step 6: Start the MAC server ──────────────────────────
echo [6/6] Starting MAC server...
echo.
echo  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
echo  β”‚  MAC is starting on:                              β”‚
echo  β”‚  Local:    http://localhost:8000                  β”‚
echo  β”‚  Network:  http://%LAN_IP%:8000                   β”‚
echo  β”‚                                                   β”‚
echo  β”‚  Press Ctrl+C to stop the server.                 β”‚
echo  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
echo.

uvicorn mac.main:app --host 0.0.0.0 --port 8000 --reload

endlocal