Skip to content

Commit 6832461

Browse files
committed
Separate dev scripts: web-only by default, with-worker optional
1 parent ea8664d commit 6832461

4 files changed

Lines changed: 31 additions & 7 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ A private journaling app that sends daily email prompts and creates entries from
1616
# Setup
1717
./bin/setup
1818

19-
# Run server (use timeout to capture boot errors)
19+
# Run server (web only, use timeout to capture boot errors)
2020
timeout 10 ./bin/dev || true
2121

22+
# Run server with Sidekiq worker (requires Redis)
23+
timeout 10 ./bin/dev-with-worker || true
24+
2225
# Run all tests (copy .env.sample to .env first)
2326
cp .env.sample .env # if not already done
2427
mise exec -- bundle exec rspec

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ After setting up, you can run the application:
6060

6161
% ./bin/dev
6262

63+
This starts just the web server. If you need background job processing (requires Redis):
64+
65+
% ./bin/dev-with-worker
66+
6367
Guidelines
6468
----------
6569

bin/dev

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ set -e
33

44
cleanup() {
55
echo "Shutting down..."
6-
kill $WEB_PID $WORKER_PID 2>/dev/null
7-
wait $WEB_PID $WORKER_PID 2>/dev/null
6+
kill $WEB_PID 2>/dev/null
7+
wait $WEB_PID 2>/dev/null
88
exit 0
99
}
1010

@@ -14,8 +14,4 @@ echo "Starting web server on port ${PORT:-5000}..."
1414
bundle exec puma -C config/puma.rb &
1515
WEB_PID=$!
1616

17-
echo "Starting Sidekiq worker..."
18-
bundle exec sidekiq &
19-
WORKER_PID=$!
20-
2117
wait

bin/dev-with-worker

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
cleanup() {
5+
echo "Shutting down..."
6+
kill $WEB_PID $WORKER_PID 2>/dev/null
7+
wait $WEB_PID $WORKER_PID 2>/dev/null
8+
exit 0
9+
}
10+
11+
trap cleanup INT TERM
12+
13+
echo "Starting web server on port ${PORT:-5000}..."
14+
bundle exec puma -C config/puma.rb &
15+
WEB_PID=$!
16+
17+
echo "Starting Sidekiq worker..."
18+
bundle exec sidekiq &
19+
WORKER_PID=$!
20+
21+
wait

0 commit comments

Comments
 (0)