RemiFabre commited on
Commit
e404c06
Β·
1 Parent(s): f23b735

Rename deploy.sh to deploy_wireless.sh, add stop_app.sh

Browse files

- deploy_wireless.sh: comprehensive comments for prerequisites (SSH key,
daemon, Wireless-only), --sync-only flag, live log tailing
- stop_app.sh: stops whatever app is running via daemon API
- Remove old deploy.sh and run_on_robot.sh (superseded)

Files changed (3) hide show
  1. deploy.sh β†’ deploy_wireless.sh +56 -15
  2. run_on_robot.sh +0 -35
  3. stop_app.sh +30 -0
deploy.sh β†’ deploy_wireless.sh RENAMED
@@ -1,11 +1,43 @@
1
  #!/usr/bin/env bash
2
- # Sync marionette to the robot and start it via the daemon.
3
- # Output from the app streams live to your terminal.
4
  #
5
- # Usage:
6
- # ./deploy.sh # default: reachy-mini.local
7
- # ./deploy.sh 192.168.1.42 # custom IP
8
- # ./deploy.sh --sync-only # sync without running
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  set -euo pipefail
11
 
@@ -23,7 +55,9 @@ USER="pollen"
23
  SITE_PACKAGES="/venvs/apps_venv/lib/python3.12/site-packages"
24
  REMOTE="${USER}@${HOST}"
25
  TARGET="${REMOTE}:${SITE_PACKAGES}/marionette/"
 
26
 
 
27
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
28
  SOURCE="${SCRIPT_DIR}/marionette/"
29
 
@@ -37,7 +71,9 @@ if ! ssh -o ConnectTimeout=5 "${REMOTE}" \
37
  fi
38
  echo " Daemon is running."
39
 
40
- # ── 2. Sync ──────────────────────────────────────────────────────────
 
 
41
  echo "==> Syncing marionette/ to ${HOST}..."
42
  rsync -az --delete \
43
  --exclude '__pycache__' \
@@ -50,17 +86,19 @@ if $SYNC_ONLY; then
50
  exit 0
51
  fi
52
 
53
- # ── 3. Start via daemon API ──────────────────────────────────────────
54
- DAEMON="http://127.0.0.1:8000/api/apps"
55
-
56
- # Stop any currently running app
57
  echo "==> Stopping current app (if any)..."
58
- ssh "${REMOTE}" "curl -sf -X POST ${DAEMON}/stop-current-app >/dev/null 2>&1 || true"
59
  sleep 1
60
 
61
- # Start marionette through the daemon (same as the dashboard)
 
 
 
62
  echo "==> Starting marionette via daemon..."
63
- RESP=$(ssh "${REMOTE}" "curl -sf -X POST ${DAEMON}/start-app/marionette 2>/dev/null")
64
  if [ $? -ne 0 ]; then
65
  echo " ERROR: Failed to start marionette via daemon API."
66
  echo " Response: ${RESP}"
@@ -72,7 +110,10 @@ echo ""
72
  echo "Web UI: http://${HOST}:8042"
73
  echo ""
74
 
75
- # ── 4. Tail the app logs live ────────────────────────────────────────
 
 
 
76
  echo "==> Tailing logs (Ctrl+C to detach β€” app keeps running)..."
77
  echo ""
78
  ssh "${REMOTE}" "journalctl -u reachy-mini-daemon -f --no-hostname -o cat" 2>/dev/null || true
 
1
  #!/usr/bin/env bash
2
+ # ─────────────────────────────────────────────────────────────────────
3
+ # Deploy marionette to Reachy Mini Wireless and start it via the daemon.
4
  #
5
+ # This is a development tool: it rsyncs your local source code to the
6
+ # robot's site-packages (the same place the dashboard installs to),
7
+ # then starts the app through the daemon API (same as clicking "Start"
8
+ # on the dashboard). Logs stream live to your terminal.
9
+ #
10
+ # PREREQUISITES:
11
+ # 1. Passwordless SSH access to the robot:
12
+ # ssh-copy-id pollen@reachy-mini.local (password: pollen)
13
+ #
14
+ # 2. The reachy-mini-daemon must be running on the robot.
15
+ # It starts automatically on boot. If stopped:
16
+ # ssh pollen@reachy-mini.local 'sudo systemctl start reachy-mini-daemon'
17
+ #
18
+ # 3. The robot must be powered on and on the same network as your laptop.
19
+ # If reachy-mini.local doesn't resolve, pass the IP address instead.
20
+ #
21
+ # WIRELESS ONLY:
22
+ # This script targets the Wireless version's shared venv at
23
+ # /venvs/apps_venv/ with Python 3.12. The Lite version uses a
24
+ # different venv layout β€” this script will NOT work on Lite as-is.
25
+ #
26
+ # HOW IT WORKS:
27
+ # 1. Checks the daemon is running (systemctl is-active)
28
+ # 2. Rsyncs marionette/ into site-packages (~1 second)
29
+ # 3. Stops any currently running app (POST /api/apps/stop-current-app)
30
+ # 4. Starts marionette via daemon (POST /api/apps/start-app/marionette)
31
+ # 5. Tails journalctl for live log output
32
+ #
33
+ # Ctrl+C detaches from logs β€” the app keeps running on the robot.
34
+ # You can also stop it from the dashboard, or with ./stop_app.sh.
35
+ #
36
+ # USAGE:
37
+ # ./deploy_wireless.sh # default: reachy-mini.local
38
+ # ./deploy_wireless.sh 192.168.1.42 # custom IP
39
+ # ./deploy_wireless.sh --sync-only # sync without starting
40
+ # ─────────────────────────────────────────────────────────────────────
41
 
42
  set -euo pipefail
43
 
 
55
  SITE_PACKAGES="/venvs/apps_venv/lib/python3.12/site-packages"
56
  REMOTE="${USER}@${HOST}"
57
  TARGET="${REMOTE}:${SITE_PACKAGES}/marionette/"
58
+ DAEMON_API="http://127.0.0.1:8000/api/apps"
59
 
60
+ # Resolve the directory this script lives in (the marionette project root)
61
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
62
  SOURCE="${SCRIPT_DIR}/marionette/"
63
 
 
71
  fi
72
  echo " Daemon is running."
73
 
74
+ # ── 2. Rsync source to site-packages ─────────────────────────────────
75
+ # This overwrites the installed package with your local source.
76
+ # The dashboard can still manage the app normally afterwards.
77
  echo "==> Syncing marionette/ to ${HOST}..."
78
  rsync -az --delete \
79
  --exclude '__pycache__' \
 
86
  exit 0
87
  fi
88
 
89
+ # ── 3. Stop any currently running app ─────────────────────────────────
90
+ # Uses the same daemon API as the dashboard's "Stop" button.
91
+ # This stops WHATEVER app is running (not just marionette).
 
92
  echo "==> Stopping current app (if any)..."
93
+ ssh "${REMOTE}" "curl -sf -X POST ${DAEMON_API}/stop-current-app >/dev/null 2>&1 || true"
94
  sleep 1
95
 
96
+ # ── 4. Start marionette via daemon API ────────────────────────────────
97
+ # Same as clicking "Start" on the dashboard. The daemon launches
98
+ # marionette as a managed subprocess with the correct venv and
99
+ # ReachyMini connection context.
100
  echo "==> Starting marionette via daemon..."
101
+ RESP=$(ssh "${REMOTE}" "curl -sf -X POST ${DAEMON_API}/start-app/marionette 2>/dev/null")
102
  if [ $? -ne 0 ]; then
103
  echo " ERROR: Failed to start marionette via daemon API."
104
  echo " Response: ${RESP}"
 
110
  echo "Web UI: http://${HOST}:8042"
111
  echo ""
112
 
113
+ # ── 5. Tail logs live ─────────────────────────────────────────────────
114
+ # Streams the daemon's journal output. Marionette's stdout/stderr
115
+ # appears here because it runs as a child of the daemon.
116
+ # Ctrl+C detaches from logs β€” the app keeps running on the robot.
117
  echo "==> Tailing logs (Ctrl+C to detach β€” app keeps running)..."
118
  echo ""
119
  ssh "${REMOTE}" "journalctl -u reachy-mini-daemon -f --no-hostname -o cat" 2>/dev/null || true
run_on_robot.sh DELETED
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Start marionette via the daemon. Run this ON the robot.
3
- #
4
- # Usage (on robot):
5
- # bash /tmp/run_marionette.sh
6
- #
7
- # Or from your laptop:
8
- # ssh pollen@reachy-mini.local 'bash /tmp/run_marionette.sh'
9
-
10
- set -euo pipefail
11
-
12
- DAEMON="http://127.0.0.1:8000/api/apps"
13
-
14
- # Check daemon is running
15
- if ! systemctl is-active --quiet reachy-mini-daemon 2>/dev/null; then
16
- echo "ERROR: reachy-mini-daemon is not running."
17
- echo "Start it with: sudo systemctl start reachy-mini-daemon"
18
- exit 1
19
- fi
20
-
21
- # Stop any currently running app
22
- echo "Stopping current app (if any)..."
23
- curl -sf -X POST "${DAEMON}/stop-current-app" >/dev/null 2>&1 || true
24
- sleep 1
25
-
26
- # Start marionette
27
- echo "Starting marionette..."
28
- curl -sf -X POST "${DAEMON}/start-app/marionette" >/dev/null 2>&1
29
- echo "Web UI: http://$(hostname -I | awk '{print $1}'):8042"
30
- echo ""
31
-
32
- # Tail logs
33
- echo "Tailing logs (Ctrl+C to detach β€” app keeps running)..."
34
- echo ""
35
- journalctl -u reachy-mini-daemon -f --no-hostname -o cat
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
stop_app.sh ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # ─────────────────────────────────────────────────────────────────────
3
+ # Stop whatever app is currently running on the robot via the daemon API.
4
+ #
5
+ # This is equivalent to clicking "Stop" on the dashboard.
6
+ #
7
+ # USAGE:
8
+ # ./stop_app.sh # default: reachy-mini.local
9
+ # ./stop_app.sh 192.168.1.42 # custom IP
10
+ # ─────────────────────────────────────────────────────────────────────
11
+
12
+ set -euo pipefail
13
+
14
+ HOST="${1:-reachy-mini.local}"
15
+ REMOTE="pollen@${HOST}"
16
+ DAEMON_API="http://127.0.0.1:8000/api/apps"
17
+
18
+ echo "==> Stopping current app on ${HOST}..."
19
+ RESP=$(ssh -o ConnectTimeout=5 "${REMOTE}" \
20
+ "curl -sf -X POST ${DAEMON_API}/stop-current-app 2>/dev/null" 2>/dev/null) || true
21
+
22
+ # Check what's running now
23
+ STATUS=$(ssh "${REMOTE}" \
24
+ "curl -sf ${DAEMON_API}/current-app-status 2>/dev/null" 2>/dev/null) || true
25
+
26
+ if [ "$STATUS" = "null" ] || [ -z "$STATUS" ]; then
27
+ echo " No app running."
28
+ else
29
+ echo " Status: ${STATUS}"
30
+ fi