-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathdev-with-frontend
More file actions
executable file
·59 lines (47 loc) · 1.46 KB
/
dev-with-frontend
File metadata and controls
executable file
·59 lines (47 loc) · 1.46 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
#!/usr/bin/env bash
# frozen_string_literal: true
# Development server startup script with frontend hot reload
set -e
# Load environment variables if .env file exists
if [ -f .env ]; then
export $(cat .env | grep -v '^#' | xargs)
fi
# Set default environment
export RACK_ENV=${RACK_ENV:-development}
echo "Starting html2rss-web development environment..."
echo "Environment: $RACK_ENV"
echo "Ruby server: http://localhost:4000"
echo "Vite dev server: http://localhost:4001 (with live reload)"
echo "Main development URL: http://localhost:4001"
echo ""
# Function to cleanup background processes
cleanup() {
echo ""
echo "Shutting down servers..."
kill $RUBY_PID 2>/dev/null || true
kill $FRONTEND_PID 2>/dev/null || true
kill $WATCHER_PID 2>/dev/null || true
wait $RUBY_PID 2>/dev/null || true
wait $FRONTEND_PID 2>/dev/null || true
wait $WATCHER_PID 2>/dev/null || true
echo "Servers stopped."
exit 0
}
# Set up signal handlers
trap cleanup SIGINT SIGTERM
# Start Ruby server in background
echo "Starting Ruby server..."
bundle exec puma -p ${PORT:-4000} -C config/puma.rb &
RUBY_PID=$!
# Wait a moment for Ruby server to start
sleep 3
# Start frontend dev server with API proxy
echo "Starting frontend dev server with API proxy..."
cd frontend
# Start frontend dev server (it will proxy API calls to Ruby server)
pnpm run dev &
FRONTEND_PID=$!
# Wait a moment for the frontend server to start
sleep 3
# Wait for both processes
wait $RUBY_PID $FRONTEND_PID