-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
163 lines (138 loc) · 5.45 KB
/
Copy pathsetup.ps1
File metadata and controls
163 lines (138 loc) · 5.45 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Setup script for Learning Path Designer
# Run this script to set up your local development environment
$ErrorActionPreference = "Stop"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Learning Path Designer - Setup" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Check prerequisites
Write-Host "Checking prerequisites..." -ForegroundColor Yellow
# Check Docker
try {
$dockerVersion = docker --version
Write-Host "[OK] Docker: $dockerVersion" -ForegroundColor Green
} catch {
Write-Host "[ERROR] Docker not found. Please install Docker Desktop." -ForegroundColor Red
exit 1
}
# Check Python
try {
$pythonVersion = python --version
Write-Host "[OK] Python: $pythonVersion" -ForegroundColor Green
} catch {
Write-Host "[ERROR] Python not found. Please install Python 3.11+." -ForegroundColor Red
exit 1
}
# Check Go
if (Get-Command go -ErrorAction SilentlyContinue) {
$goVersion = go version
Write-Host "[OK] Go: $goVersion" -ForegroundColor Green
} else {
Write-Host "[WARN] Go not found. Install Go 1.21+ to run gateway." -ForegroundColor Yellow
}
# Check Node
if (Get-Command node -ErrorAction SilentlyContinue) {
$nodeVersion = node --version
Write-Host "[OK] Node: $nodeVersion" -ForegroundColor Green
} else {
Write-Host "[WARN] Node.js not found. Install Node.js 20+ to run frontend." -ForegroundColor Yellow
}
# Check PostgreSQL client
if (Get-Command psql -ErrorAction SilentlyContinue) {
$psqlVersion = psql --version
Write-Host "[OK] PostgreSQL client: $psqlVersion" -ForegroundColor Green
} else {
Write-Host "[WARN] psql not found. Install PostgreSQL client tools." -ForegroundColor Yellow
}
Write-Host ""
# Create .env.local if it doesn't exist
if (-not (Test-Path ".env.local")) {
Write-Host "Creating .env.local from .env.example..." -ForegroundColor Yellow
Copy-Item ".env.example" ".env.local"
Write-Host "[OK] Created .env.local" -ForegroundColor Green
Write-Host "[WARN] Please update .env.local with your API keys" -ForegroundColor Yellow
} else {
Write-Host "[OK] .env.local already exists" -ForegroundColor Green
}
Write-Host ""
# Start Docker services
Write-Host "Starting Docker services..." -ForegroundColor Yellow
docker-compose up -d
Write-Host ""
Write-Host "Waiting for services to be ready..." -ForegroundColor Yellow
Start-Sleep -Seconds 5
# Check if services are running
$postgresRunning = docker ps --filter "name=learnpath-postgres" --filter "status=running" -q
$qdrantRunning = docker ps --filter "name=learnpath-qdrant" --filter "status=running" -q
$redisRunning = docker ps --filter "name=learnpath-redis" --filter "status=running" -q
if ($postgresRunning) {
Write-Host "[OK] Postgres is running" -ForegroundColor Green
} else {
Write-Host "[ERROR] Postgres failed to start" -ForegroundColor Red
}
if ($qdrantRunning) {
Write-Host "[OK] Qdrant is running" -ForegroundColor Green
} else {
Write-Host "[ERROR] Qdrant failed to start" -ForegroundColor Red
}
if ($redisRunning) {
Write-Host "[OK] Redis is running" -ForegroundColor Green
} else {
Write-Host "[ERROR] Redis failed to start" -ForegroundColor Red
}
Write-Host ""
# Run migrations
if (Get-Command psql -ErrorAction SilentlyContinue) {
Write-Host "Running database migrations..." -ForegroundColor Yellow
Start-Sleep -Seconds 3
try {
.\ops\migrate.ps1
Write-Host "[OK] Migrations completed" -ForegroundColor Green
} catch {
Write-Host "[WARN] Migrations failed. Run manually: .\ops\migrate.ps1" -ForegroundColor Yellow
}
} else {
Write-Host "[WARN] Skipping migrations (psql not found)" -ForegroundColor Yellow
}
Write-Host ""
# Setup virtual environment
if (-not (Test-Path ".venv")) {
Write-Host "Creating Python virtual environment..." -ForegroundColor Yellow
python -m venv .venv
Write-Host "[OK] Virtual environment created" -ForegroundColor Green
} else {
Write-Host "[OK] Virtual environment exists" -ForegroundColor Green
}
# Activate virtual environment and install dependencies
Write-Host "Installing Python dependencies..." -ForegroundColor Yellow
try {
& .\.venv\Scripts\Activate.ps1
pip install -r ingestion/requirements.txt --quiet
Write-Host "[OK] Python dependencies installed" -ForegroundColor Green
} catch {
Write-Host "[WARN] Failed to install Python dependencies" -ForegroundColor Yellow
}
Write-Host ""
# Seed skills
Write-Host "Seeding skills data..." -ForegroundColor Yellow
try {
& .\.venv\Scripts\python.exe -m ingestion.seed_skills
Write-Host "[OK] Skills seeded" -ForegroundColor Green
} catch {
Write-Host "[WARN] Failed to seed skills" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Setup Complete!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host "1. Update .env.local with your API keys" -ForegroundColor White
Write-Host "2. Review planning/implementation_steps.md" -ForegroundColor White
Write-Host "3. Start building Phase 1" -ForegroundColor White
Write-Host ""
Write-Host "Useful commands:" -ForegroundColor Yellow
Write-Host " docker-compose ps" -ForegroundColor White
Write-Host " docker-compose logs -f" -ForegroundColor White
Write-Host " docker-compose down" -ForegroundColor White
Write-Host ""