/ scripts / deploy-voice-client.sh
deploy-voice-client.sh
 1  #!/bin/bash
 2  # Deploy voice web client from canonical source to all serving locations
 3  # Source: /home/rig/bob/services/pipecat-agent/web-client.html
 4  # Targets:
 5  #   1. /srv/bob/web/voice.html (rig local Caddy — voice.rig.lan)
 6  #   2. nuclide:/home/nuclide/docker/caddy/srv/voice/index.html (nuclide Caddy — voice.genexergy.org)
 7  
 8  set -euo pipefail
 9  
10  SOURCE="/home/rig/bob/services/pipecat-agent/web-client.html"
11  SSH_OPTS="-F /dev/null -i /home/rig/.ssh/id_ed25519 -o StrictHostKeyChecking=no"
12  
13  if [ ! -f "$SOURCE" ]; then
14    echo "ERROR: Source file not found: $SOURCE"
15    exit 1
16  fi
17  
18  echo "Deploying voice web client..."
19  echo "  Source: $SOURCE ($(wc -c < "$SOURCE") bytes)"
20  
21  # Target 1: rig local (needs sudo if run as rig user)
22  if [ "$(id -u)" -eq 0 ]; then
23    cp "$SOURCE" /srv/bob/web/voice.html
24  else
25    cp "$SOURCE" /srv/bob/web/voice.html 2>/dev/null || echo "  NOTE: /srv/bob/web/ needs sudo — skipping rig copy"
26  fi
27  echo "  → /srv/bob/web/voice.html (rig)"
28  
29  # Target 2: nuclide (external) — use rig user's SSH key
30  scp $SSH_OPTS -q "$SOURCE" nuclide@nuclide-amd.lan:/tmp/voice-client.html
31  ssh $SSH_OPTS nuclide@nuclide-amd.lan "cp /tmp/voice-client.html /home/nuclide/docker/caddy/srv/voice/index.html && rm /tmp/voice-client.html"
32  echo "  → nuclide:/home/nuclide/docker/caddy/srv/voice/index.html"
33  
34  echo "Done. Both locations updated."