A relay on jai (server/bubble_relay.py, stdlib + SQLite, tailscale address only, bearer token) carries sealed blobs between the desktop and the Rabbit: AES-256-GCM with a key the desktop makes and hands over USB (Sync to Rabbit), so jai can neither read nor forge anything. It deletes what's been picked up, and anything after 14 days. - Desktop (src/main/relay.ts): "Rabbit SIM" is a number to text from, groups included; the SIM's history and new texts arrive; older photos are fetched when shown; names and read/unread/archived go both ways. Settings → Rabbit relay connects it. - Rabbit (Relay.java, RelayJob): no timer of its own for the battery; it rides along with the background checks, plus one network job after a text, a send or a swipe. Each send from the desktop goes out at most once and not after a day. Plain http only to jai and localhost (network_security_config). - scripts/deploy-jai.sh; tests: server unit tests, an end-to-end relay test, and DEVICE=1 relay.device.test.ts against the dev app.
34 lines
1.3 KiB
Bash
Executable File
34 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Deploy bubble-relay to jai (see ~/Documents/shared-resources/jai.html#run).
|
|
# jai is production: this only ever touches ~/Documents/bubble-server and its
|
|
# own screen session, and installs nothing.
|
|
#
|
|
# scripts/deploy-jai.sh copy the code and (re)start the service
|
|
# scripts/deploy-jai.sh --stop stop it
|
|
# scripts/deploy-jai.sh --token print the bearer token, for Settings → Rabbit relay on the desktop
|
|
#
|
|
# What runs is server/run.sh, also started by jai's ~/startup.sh (re-run by its
|
|
# watchdog every 5 minutes), so it comes back after a crash or a reboot.
|
|
set -euo pipefail
|
|
HOST=${JAI_HOST:-jai-ext}
|
|
DIR=/home/jai/Documents/bubble-server
|
|
NAME=bubble-relay
|
|
cd "$(dirname "$0")/.."
|
|
|
|
case "${1:-}" in
|
|
--token) ssh "$HOST" "cat $DIR/data/token"; echo; exit 0 ;;
|
|
--stop) ssh "$HOST" "screen -S $NAME -X quit || true"; echo "stopped"; exit 0 ;;
|
|
esac
|
|
|
|
ssh "$HOST" "mkdir -p $DIR/app $DIR/data ~/service-logs && chmod 700 $DIR $DIR/data"
|
|
rsync -a server/bubble_relay.py server/run.sh "$HOST:$DIR/app/"
|
|
ssh "$HOST" bash -s <<REMOTE
|
|
set -e
|
|
screen -S $NAME -X quit 2>/dev/null || true
|
|
sleep 1
|
|
screen -dmS $NAME bash -c 'bash $DIR/app/run.sh 2>&1 | tee ~/service-logs/$NAME.log'
|
|
sleep 2
|
|
for pid in \$(pgrep -f bubble_relay.py); do echo 1000 > /proc/\$pid/oom_score_adj; done
|
|
curl -s -m 5 http://100.69.139.40:8080/health; echo
|
|
REMOTE
|