-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
116 lines (99 loc) · 4.41 KB
/
setup.ps1
File metadata and controls
116 lines (99 loc) · 4.41 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# EEG/MEG Annotation Platform - Setup Script
# Run this script on first installation
Write-Host ""
Write-Host "===========================================================" -ForegroundColor Cyan
Write-Host " EEG/MEG Annotation Platform - Setup" -ForegroundColor Cyan
Write-Host "===========================================================" -ForegroundColor Cyan
Write-Host ""
# Check Python
Write-Host "Checking Python installation..." -ForegroundColor Yellow
try {
$pythonVersion = python --version 2>&1
Write-Host "[OK] Python found: $pythonVersion" -ForegroundColor Green
} catch {
Write-Host "[ERROR] Python not found. Please install Python 3.9+" -ForegroundColor Red
Write-Host " Download from: https://www.python.org/downloads/" -ForegroundColor Yellow
exit 1
}
# Check Node.js
Write-Host "Checking Node.js installation..." -ForegroundColor Yellow
try {
$nodeVersion = node --version 2>&1
Write-Host "[OK] Node.js found: $nodeVersion" -ForegroundColor Green
} catch {
Write-Host "[ERROR] Node.js not found. Please install Node.js 18+" -ForegroundColor Red
Write-Host " Download from: https://nodejs.org/" -ForegroundColor Yellow
exit 1
}
Write-Host ""
Write-Host "Setting up backend..." -ForegroundColor Cyan
# Create Python virtual environment
if (-not (Test-Path "backend\venv")) {
Write-Host "Creating Python virtual environment..." -ForegroundColor Yellow
Set-Location backend
python -m venv venv
Set-Location ..
Write-Host "[OK] Virtual environment created" -ForegroundColor Green
} else {
Write-Host "[OK] Virtual environment already exists" -ForegroundColor Green
}
# Install Python dependencies
Write-Host "Installing Python dependencies..." -ForegroundColor Yellow
Set-Location backend
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt
deactivate
Set-Location ..
Write-Host "[OK] Python dependencies installed" -ForegroundColor Green
Write-Host ""
Write-Host "Setting up frontend..." -ForegroundColor Cyan
# Install Node.js dependencies
Write-Host "Installing Node.js dependencies..." -ForegroundColor Yellow
Set-Location frontend
npm install
Set-Location ..
Write-Host "[OK] Node.js dependencies installed" -ForegroundColor Green
Write-Host ""
Write-Host "Configuring network settings..." -ForegroundColor Cyan
# Detect network IP
$networkIP = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object {
$_.IPAddress -notlike "127.*" -and $_.IPAddress -notlike "169.254.*"
} | Select-Object -First 1).IPAddress
if ($networkIP) {
Write-Host "[OK] Network IP detected: $networkIP" -ForegroundColor Green
# Create .env file
$envPath = "frontend\.env"
$envContent = "# Backend API URL - Auto-configured`nVITE_API_URL=http://${networkIP}:8000`n"
Set-Content -Path $envPath -Value $envContent
Write-Host "[OK] Created frontend/.env" -ForegroundColor Green
# Create uploads directory
if (-not (Test-Path "backend\uploads")) {
New-Item -ItemType Directory -Path "backend\uploads" | Out-Null
Write-Host "[OK] Created uploads directory" -ForegroundColor Green
}
Write-Host ""
Write-Host "===========================================================" -ForegroundColor Green
Write-Host " Setup Complete!" -ForegroundColor Green
Write-Host "===========================================================" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host "1. Configure Windows Firewall (run as Administrator):" -ForegroundColor White
Write-Host " .\configure-firewall.ps1" -ForegroundColor Yellow
Write-Host ""
Write-Host "2. Start the application:" -ForegroundColor White
Write-Host " .\start.ps1" -ForegroundColor Yellow
Write-Host ""
Write-Host "Access URLs:" -ForegroundColor Cyan
Write-Host " Local: http://localhost:3000" -ForegroundColor White
Write-Host " Network: http://${networkIP}:3000" -ForegroundColor Green
Write-Host " Backend: http://${networkIP}:8000" -ForegroundColor Green
Write-Host ""
} else {
Write-Host "[WARNING] Could not detect network IP" -ForegroundColor Yellow
Write-Host " Using localhost configuration" -ForegroundColor Yellow
$envPath = "frontend\.env"
Set-Content -Path $envPath -Value "# Backend API URL`nVITE_API_URL=http://localhost:8000`n"
Write-Host ""
Write-Host "Setup complete! Run .\start.ps1 to start the application." -ForegroundColor Green
}
Write-Host ""