-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdev-start.sh
More file actions
executable file
·127 lines (114 loc) · 4.58 KB
/
Copy pathdev-start.sh
File metadata and controls
executable file
·127 lines (114 loc) · 4.58 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
#!/usr/bin/env bash
# Quick start script for local development
# Usage: ./dev-start.sh [mode] [--run]
# Modes: lsp-only | websessions-only | service-only | full
# Use 'full --run' to launch all services in background
#
# After starting services, verify health with: ./dev-healthcheck.sh
set -euo pipefail
MODE="${1:-full}"
RUN_FLAG="${2:-}"
DB_PATH="${JL4_DB_PATH:-/tmp/sessions.db}"
WEBSESSIONS_PORT="${JL4_WEBSESSIONS_PORT:-8002}"
LSP_PORT="${JL4_LSP_PORT:-8000}"
LSP_CWD="${JL4_LSP_CWD:-jl4-core/libraries}"
SERVICE_PORT="${JL4_SERVICE_PORT:-8080}"
SERVICE_STORE="${JL4_SERVICE_STORE:-/tmp/jl4-store}"
PIDFILE="${JL4_PIDFILE:-/tmp/jl4-dev.pid}"
case "$MODE" in
websessions-only)
echo "Starting websessions only (port $WEBSESSIONS_PORT)..."
cd jl4-websessions
cabal run jl4-websessions -- "$WEBSESSIONS_PORT" "$DB_PATH"
;;
lsp-only)
echo "Starting LSP server only (port $LSP_PORT)..."
cabal run exe:jl4-lsp -- ws --host 0.0.0.0 --port "$LSP_PORT" --cwd "$LSP_CWD"
;;
service-only)
echo "Starting jl4-service only (port $SERVICE_PORT, store $SERVICE_STORE)..."
cabal run jl4-service -- --port "$SERVICE_PORT" --store-path "$SERVICE_STORE"
;;
full)
if [[ "$RUN_FLAG" == "--run" ]]; then
echo "Starting full stack in background..."
# Remove old PID file
rm -f "$PIDFILE"
# Start LSP Server
echo "Starting LSP server on port $LSP_PORT..."
cabal run exe:jl4-lsp -- ws --host 0.0.0.0 --port "$LSP_PORT" --cwd "$LSP_CWD" > /tmp/jl4-lsp.log 2>&1 &
echo "LSP_PID=$!" >> "$PIDFILE"
# Start Websessions
echo "Starting websessions on port $WEBSESSIONS_PORT..."
(cd jl4-websessions && cabal run jl4-websessions -- \
"$WEBSESSIONS_PORT" "$DB_PATH") > /tmp/jl4-websessions.log 2>&1 &
echo "WEBSESSIONS_PID=$!" >> "$PIDFILE"
# Start jl4-service (decision service)
echo "Starting jl4-service on port $SERVICE_PORT..."
cabal run jl4-service -- --port "$SERVICE_PORT" --store-path "$SERVICE_STORE" \
> /tmp/jl4-service.log 2>&1 &
echo "SERVICE_PID=$!" >> "$PIDFILE"
# Start Web Frontend (IDE)
echo "Starting web IDE frontend..."
(cd ts-apps/jl4-web && npm run dev) > /tmp/jl4-web.log 2>&1 &
echo "WEB_PID=$!" >> "$PIDFILE"
echo ""
echo "✓ All services started in background!"
echo ""
echo "Services:"
echo " LSP Server: http://localhost:$LSP_PORT (ws://localhost:$LSP_PORT)"
echo " Websessions: http://localhost:$WEBSESSIONS_PORT"
echo " jl4-service: http://localhost:$SERVICE_PORT"
echo " Web IDE: http://localhost:5173"
echo ""
echo "Logs:"
echo " LSP: tail -f /tmp/jl4-lsp.log"
echo " Websessions: tail -f /tmp/jl4-websessions.log"
echo " jl4-service: tail -f /tmp/jl4-service.log"
echo " Web IDE: tail -f /tmp/jl4-web.log"
echo ""
echo "PIDs saved to: $PIDFILE"
echo ""
echo "To verify all services are healthy:"
echo " ./dev-healthcheck.sh"
echo ""
echo "To stop all services:"
echo " ./dev-stop.sh"
echo " or: kill \$(cat $PIDFILE | cut -d= -f2)"
echo ""
echo "Open in your browser:"
echo " IDE: http://localhost:5173"
else
echo "Starting full stack with integration..."
echo "Note: Run these in separate terminals, or use a tool like tmux"
echo " Or run './dev-start.sh full --run' to start all in background"
echo ""
echo "Terminal 1 - LSP Server:"
echo " cabal run exe:jl4-lsp -- ws --host 0.0.0.0 --port $LSP_PORT --cwd $LSP_CWD"
echo ""
echo "Terminal 2 - Websessions:"
echo " cd jl4-websessions && cabal run jl4-websessions -- \\"
echo " $WEBSESSIONS_PORT $DB_PATH"
echo ""
echo "Terminal 3 - jl4-service (decision service):"
echo " cabal run jl4-service -- --port $SERVICE_PORT --store-path $SERVICE_STORE"
echo ""
echo "Terminal 4 - Web IDE Frontend:"
echo " cd ts-apps/jl4-web && npm run dev"
echo ""
echo "Then open in your browser:"
echo " IDE: http://localhost:5173"
fi
;;
*)
echo "Unknown mode: $MODE"
echo "Usage: $0 [mode] [--run]"
echo "Modes:"
echo " lsp-only - Start only LSP server (websocket)"
echo " websessions-only - Start only websessions"
echo " service-only - Start only jl4-service (decision service)"
echo " full - Show commands for full stack (default)"
echo " full --run - Launch all services in background"
exit 1
;;
esac