-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·48 lines (38 loc) · 1.84 KB
/
Copy pathdev.sh
File metadata and controls
executable file
·48 lines (38 loc) · 1.84 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
#!/bin/bash
SESSION="rlx"
# Check if session already exists
if tmux has-session -t "$SESSION" 2>/dev/null; then
echo "Error: tmux session '$SESSION' already exists." >&2
echo "Use 'tmux attach -t $SESSION' to attach or 'tmux kill-session -t $SESSION' to kill it." >&2
exit 1
fi
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Create new session with first window (web)
tmux new-session -d -s "$SESSION" -n web -c "$SCRIPT_DIR/apps/web"
tmux send-keys -t "$SESSION:web" "pnpm dev" Enter
# Window 2: api
tmux new-window -t "$SESSION" -n api -c "$SCRIPT_DIR/apps/api"
tmux send-keys -t "$SESSION:api" "uv run uvicorn rlx_api.main:app --reload --port 8000" Enter
# Window 3: redis
tmux new-window -t "$SESSION" -n redis -c "$SCRIPT_DIR"
# Check if Redis is already running
if docker ps --format '{{.Names}}' | grep -q '^redis$'; then
tmux send-keys -t "$SESSION:redis" "echo 'Redis is already running. Use: docker logs -f redis'" Enter
else
# Remove stopped container if it exists
if docker ps -a --format '{{.Names}}' | grep -q '^redis$'; then
docker rm redis >/dev/null 2>&1
fi
tmux send-keys -t "$SESSION:redis" "docker run --rm --name redis -p 6379:6379 redis:7-alpine" Enter
fi
# Window 4: worker (wait a moment for redis to start)
tmux new-window -t "$SESSION" -n worker -c "$SCRIPT_DIR/apps/api"
tmux send-keys -t "$SESSION:worker" "sleep 2 && uv run celery -A rlx_api.celery_app:celery_app worker --loglevel=info -Q pod_ops,repo_ops" Enter
# Window 5: scheduler
tmux new-window -t "$SESSION" -n scheduler -c "$SCRIPT_DIR/apps/api"
tmux send-keys -t "$SESSION:scheduler" "sleep 2 && uv run celery -A rlx_api.celery_app:celery_app beat --loglevel=info" Enter
# Select first window (web)
tmux select-window -t "$SESSION:web"
# Attach to the session
tmux attach -t "$SESSION"