-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.ps1
More file actions
64 lines (50 loc) · 2.08 KB
/
start.ps1
File metadata and controls
64 lines (50 loc) · 2.08 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
# FermiURL Startup Script
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host " FermiURL - Setup & Start" -ForegroundColor Cyan
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host ""
# Check if in correct directory
if (-not (Test-Path "backend") -or -not (Test-Path "frontend")) {
Write-Host "Error: Please run this script from the smallurl root directory" -ForegroundColor Red
exit 1
}
# Start MariaDB
Write-Host "[1/4] Starting MariaDB Server..." -ForegroundColor Yellow
$mariadbPath = "C:\Program Files\MariaDB 12.0\bin\mariadbd.exe"
if (Test-Path $mariadbPath) {
Write-Host "Launching MariaDB in new window..." -ForegroundColor Green
Start-Process powershell -ArgumentList "-NoExit", "-Command", "& '$mariadbPath' --console"
Write-Host "Waiting for MariaDB to start..." -ForegroundColor Green
Start-Sleep -Seconds 5
} else {
Write-Host "Warning: MariaDB not found at $mariadbPath" -ForegroundColor Red
Write-Host "Please start MariaDB manually before continuing." -ForegroundColor Red
Read-Host "Press Enter when MariaDB is running"
}
# Backend setup
Write-Host ""
Write-Host "[2/4] Setting up Backend..." -ForegroundColor Yellow
cd backend
if (-not (Test-Path "venv")) {
Write-Host "Creating Python virtual environment..." -ForegroundColor Green
python -m venv venv
}
Write-Host "Activating virtual environment..." -ForegroundColor Green
& .\venv\Scripts\Activate.ps1
Write-Host "Installing Python dependencies..." -ForegroundColor Green
pip install -r requirements.txt
Write-Host ""
Write-Host "[3/4] Starting Backend Server..." -ForegroundColor Yellow
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$PWD'; .\venv\Scripts\Activate.ps1; python app.py"
cd ..
# Frontend setup
Write-Host ""
Write-Host "[4/4] Starting Frontend Server..." -ForegroundColor Yellow
cd frontend
if (-not (Test-Path "node_modules")) {
Write-Host "Installing npm dependencies..." -ForegroundColor Green
npm install
}
Write-Host "Starting Vite dev server..." -ForegroundColor Green
npm run dev
cd ..