-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
58 lines (48 loc) · 2.1 KB
/
setup.ps1
File metadata and controls
58 lines (48 loc) · 2.1 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
# setup.ps1
$ErrorActionPreference = "Stop"
$BaseDir = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $BaseDir
if (-not (Test-Path .env)) { Copy-Item .env.example .env }
# Load .env
Get-Content .env | Where-Object { $_ -match "^([^#].+?)=(.*)$" } | ForEach-Object {
[Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process")
}
# Install uv
if (-not (Get-Command uv -ErrorAction SilentlyContinue)) {
Write-Host "Installing uv..."
iwr https://install.python.dev/uv -UseBasicParsing | iex
}
# Install tools
if (-not (Get-Command choco -ErrorAction SilentlyContinue)) {
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
}
choco install -y git python docker docker-desktop openjdk17 --no-progress
# Start Docker
# Start-Process "Docker Desktop" -ErrorAction SilentlyContinue
Start-Process "C:\Program Files\Docker\Docker\Docker Desktop.exe"
Start-Sleep -Seconds 15
# Ollama
if (-not (Get-Command ollama -ErrorAction SilentlyContinue)) {
winget install Ollama.Ollama --silent
}
Start-Process ollama serve
# Neo4j + Qdrant
docker run -d --name neo4j -p 7474:7474 -p 7687:7687 -v "$BaseDir\neo4j_data:/data" -e NEO4J_AUTH=neo4j/offline-ai-rules neo4j:5.24.0
docker run -d --name qdrant -p 6333:6333 -p 6334:6334 -v "$BaseDir\qdrant_storage:/qdrant/storage" qdrant/qdrant:latest
# Model
$model = if (Test-Path .selected-model) { Get-Content .selected-model } else {
$ram = (Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum).Sum / 1GB
$gpu = (Get-CimInstance Win32_VideoController).Name -join " "
if ($ram -ge 32 -and $gpu -match "NVIDIA") { "qwen2.5-coder:32b-q4_K_M" }
elseif ($ram -ge 16) { "qwen2.5-coder:14b-q4_K_M" }
else { "qwen2.5-coder:7b-q4_K_M" }
}
$model | Out-File -Encoding utf8 .selected-model
ollama pull $model
# uv env
uv venv .venv
.\.venv\Scripts\Activate.ps1
uv pip install -r template\requirements.txt
uv pip compile template\requirements.txt -o uv.lock
Write-Host "`nSetup complete!`nNext: .\src\create-project.ps1 my-app"