-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-dev.sh
More file actions
86 lines (76 loc) · 5.65 KB
/
Copy pathinit-dev.sh
File metadata and controls
86 lines (76 loc) · 5.65 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
#!/usr/bin/env bash
# =============================================================================
# NextFlow — Local Development Bootstrap Script
# =============================================================================
# Usage: bash init-dev.sh
#
# 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
# =============================================================================
set -euo pipefail
# Colors
CYAN='\033[0;36m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
log() { echo -e "${CYAN}[NextFlow]${NC} $1"; }
ok() { echo -e "${GREEN}[ OK ]${NC} $1"; }
warn() { echo -e "${YELLOW}[ WARN ]${NC} $1"; }
fail() { echo -e "${RED}[FAILED]${NC} $1"; exit 1; }
# ─────────────────────────────────────────────────────────────────────────────
# Step 1: Ensure Docker is running
# ─────────────────────────────────────────────────────────────────────────────
log "Checking Docker daemon..."
if ! docker info > /dev/null 2>&1; then
fail "Docker is not running. Please start Docker Desktop and try again."
fi
ok "Docker daemon is active."
# ─────────────────────────────────────────────────────────────────────────────
# Step 2: Start containers
# ─────────────────────────────────────────────────────────────────────────────
log "Starting infrastructure containers..."
docker compose up -d --wait
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;' > /dev/null 2>&1
ok "pgvector extension is enabled."
# ─────────────────────────────────────────────────────────────────────────────
# Step 4: Push Prisma schema
# ─────────────────────────────────────────────────────────────────────────────
log "Synchronizing Prisma schema with database..."
npx prisma db push --skip-generate
ok "Prisma schema synchronized."
# ─────────────────────────────────────────────────────────────────────────────
# Step 5: Generate Prisma Client
# ─────────────────────────────────────────────────────────────────────────────
log "Generating Prisma Client..."
npx prisma generate
ok "Prisma Client generated."
# ─────────────────────────────────────────────────────────────────────────────
# Step 6: Start Next.js dev server
# ─────────────────────────────────────────────────────────────────────────────
log "Starting Next.js development server..."
echo ""
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN} NextFlow Development Environment Ready${NC}"
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo -e " App: ${CYAN}http://localhost:3000${NC}"
echo -e " PostgreSQL: ${CYAN}localhost:5432${NC} (nextflow_dev)"
echo -e " MinIO API: ${CYAN}http://localhost:9000${NC}"
echo -e " MinIO Console:${CYAN}http://localhost:9001${NC}"
echo ""
echo -e " Trigger.dev: Run ${YELLOW}npx trigger.dev@latest dev${NC} in a separate terminal"
echo ""
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
npm run dev