Skip to content

Commit 0237c3a

Browse files
committed
chore: add dev.sh one-command startup script
1 parent d4618c3 commit 0237c3a

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

dev.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
# dev.sh — Start the full Nexus dev stack in one command.
3+
# Usage: ./dev.sh
4+
set -e
5+
6+
PROJECT_ROOT="$(cd "$(dirname "$0")" && pwd)"
7+
8+
echo "==> Starting Nexus dev stack..."
9+
10+
# 1) Ensure containers are running (PostgreSQL, Redis, Meilisearch, MinIO)
11+
echo "--> Starting containers..."
12+
cd "$PROJECT_ROOT"
13+
podman compose up -d 2>&1 | tail -6
14+
15+
# Wait for PostgreSQL to accept connections
16+
echo "--> Waiting for PostgreSQL..."
17+
for i in $(seq 1 30); do
18+
if podman exec nexus-postgres pg_isready -U nexus >/dev/null 2>&1; then
19+
echo " PostgreSQL ready"
20+
break
21+
fi
22+
sleep 2
23+
if [ "$i" -eq 30 ]; then
24+
echo " WARNING: PostgreSQL didn't respond in 60s, continuing anyway..."
25+
fi
26+
done
27+
28+
# 2) Start the API server (if not already running)
29+
if ! curl -sf http://localhost:8080/api/v1/health >/dev/null 2>&1; then
30+
echo "--> Starting Nexus API server..."
31+
"$PROJECT_ROOT/target/debug/nexus" serve > /tmp/nexus-api.log 2>&1 &
32+
API_PID=$!
33+
echo " API PID: $API_PID"
34+
35+
# Wait for it to be healthy
36+
for i in $(seq 1 20); do
37+
if curl -sf http://localhost:8080/api/v1/health >/dev/null 2>&1; then
38+
echo " API ready ✓"
39+
break
40+
fi
41+
sleep 2
42+
if [ "$i" -eq 20 ]; then
43+
echo " ERROR: API server failed to start. Check /tmp/nexus-api.log"
44+
exit 1
45+
fi
46+
done
47+
else
48+
echo "--> API server already running ✓"
49+
fi
50+
51+
# 3) Launch Tauri dev (Vite + hot-reload desktop) in the foreground so logs are visible
52+
echo "--> Starting nexus-desktop (tauri dev)..."
53+
echo " Logs: /tmp/nexus-tauri-dev.log"
54+
echo " Press Ctrl+C to stop everything."
55+
echo ""
56+
cd "$PROJECT_ROOT/crates/nexus-desktop"
57+
exec npm run tauri dev

0 commit comments

Comments
 (0)