#!/usr/bin/env bash
# Run on disposable Linux with sudo, Node, vp, Python 3, curl and ffmpeg.
# Supply two checkouts at the commits below; every server uses a new empty home.
# Base: 44ebb2fe57465d32f2bd07c5eb3d8e871bdf5ed5
# Head: ffde5b01c37ccc82a86c9727dc70d9fc889f8cc3
set -euo pipefail
sudo ip addr add 169.254.77.2/32 dev lo
trap 'sudo ip addr del 169.254.77.2/32 dev lo' EXIT
for checkout in "$1" "$2"; do
  (cd "$checkout" && vp i && vp run --filter @t3tools/web build)
  (cd "$checkout/apps/server" && vp run build:bundle)
done
python3 driver.py before "$1" 44ebb2fe57465d32f2bd07c5eb3d8e871bdf5ed5
python3 driver.py after "$2" ffde5b01c37ccc82a86c9727dc70d9fc889f8cc3
# Optional: with Pillow installed, run render.py on each output directory to
# render the timestamped live request/log recording as a 1600x1000 dark video.
