-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-dev.ps1
More file actions
83 lines (74 loc) · 6.25 KB
/
Copy pathinit-dev.ps1
File metadata and controls
83 lines (74 loc) · 6.25 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
# =============================================================================
# NextFlow — Local Development Bootstrap Script (PowerShell)
# =============================================================================
# Usage: .\init-dev.ps1
#
# This script:
# 1. Starts Docker containers (Postgres + pgvector, MinIO)
# 2. Waits for PostgreSQL health check to pass
# 3. Enables the pgvector extension
# 4. Pushes the Prisma schema to the database
# 5. Starts the Next.js development server
# =============================================================================
$ErrorActionPreference = "Stop"
function Log($msg) { Write-Host "[NextFlow] $msg" -ForegroundColor Cyan }
function Ok($msg) { Write-Host "[ OK ] $msg" -ForegroundColor Green }
function Warn($msg) { Write-Host "[ WARN ] $msg" -ForegroundColor Yellow }
function Fail($msg) { Write-Host "[FAILED] $msg" -ForegroundColor Red; exit 1 }
# ─────────────────────────────────────────────────────────────────────────────
# Step 1: Ensure Docker is running
# ─────────────────────────────────────────────────────────────────────────────
Log "Checking Docker daemon..."
try {
docker info 2>&1 | Out-Null
Ok "Docker daemon is active."
} catch {
Fail "Docker is not running. Please start Docker Desktop and try again."
}
# ─────────────────────────────────────────────────────────────────────────────
# Step 2: Start containers and wait for health checks
# ─────────────────────────────────────────────────────────────────────────────
Log "Starting infrastructure containers..."
docker compose up -d --wait
if ($LASTEXITCODE -ne 0) { Fail "Failed to start Docker containers." }
Ok "All containers are up and healthy."
# ─────────────────────────────────────────────────────────────────────────────
# Step 3: Enable pgvector extension (idempotent)
# ─────────────────────────────────────────────────────────────────────────────
Log "Enabling pgvector extension..."
docker exec nextflow-postgres psql -U nextflow -d nextflow_dev -c "CREATE EXTENSION IF NOT EXISTS vector;" 2>&1 | Out-Null
if ($LASTEXITCODE -ne 0) { Fail "Failed to enable pgvector extension." }
Ok "pgvector extension is enabled."
# ─────────────────────────────────────────────────────────────────────────────
# Step 4: Push Prisma schema
# ─────────────────────────────────────────────────────────────────────────────
Log "Synchronizing Prisma schema with database..."
npx prisma db push --skip-generate
if ($LASTEXITCODE -ne 0) { Fail "Prisma schema push failed." }
Ok "Prisma schema synchronized."
# ─────────────────────────────────────────────────────────────────────────────
# Step 5: Generate Prisma Client
# ─────────────────────────────────────────────────────────────────────────────
Log "Generating Prisma Client..."
npx prisma generate
if ($LASTEXITCODE -ne 0) { Fail "Prisma Client generation failed." }
Ok "Prisma Client generated."
# ─────────────────────────────────────────────────────────────────────────────
# Step 6: Start Next.js dev server
# ─────────────────────────────────────────────────────────────────────────────
Log "Starting Next.js development server..."
Write-Host ""
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Green
Write-Host " NextFlow Development Environment Ready" -ForegroundColor Green
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Green
Write-Host ""
Write-Host " App: " -NoNewline; Write-Host "http://localhost:3000" -ForegroundColor Cyan
Write-Host " PostgreSQL: " -NoNewline; Write-Host "localhost:5432 (nextflow_dev)" -ForegroundColor Cyan
Write-Host " MinIO API: " -NoNewline; Write-Host "http://localhost:9000" -ForegroundColor Cyan
Write-Host " MinIO Console: " -NoNewline; Write-Host "http://localhost:9001" -ForegroundColor Cyan
Write-Host ""
Write-Host " Trigger.dev: Run " -NoNewline; Write-Host "npx trigger.dev@latest dev" -ForegroundColor Yellow -NoNewline; Write-Host " in a separate terminal"
Write-Host ""
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Green
Write-Host ""
npm run dev