1 #!/usr/bin/env bash
2 # Run the musiquay end-to-end lab in Docker.
3 #
4 # test/musiquay-lab.sh
5 #
6 # The lab starts a relay + Blossom host, a Cashu mint with a fake Lightning
7 # backend, and a one-shot client that drives the protocol over the network.
8 set -euo pipefail
9 10 cd "$(dirname "$0")/.."
11 12 COMPOSE_FILE=docker-compose.musiquay-lab.yml
13 for arg in "$@"; do
14 case "$arg" in
15 -h|--help)
16 sed -n '2,9p' "$0" | sed 's/^# \{0,1\}//'
17 exit 0
18 ;;
19 *)
20 echo "unknown argument: $arg" >&2
21 exit 2
22 ;;
23 esac
24 done
25 26 cleanup() {
27 docker compose -f "$COMPOSE_FILE" down -v --remove-orphans >/dev/null 2>&1 || true
28 }
29 trap cleanup EXIT
30 31 # A previous run may have left volumes with spent ecash and old wraps.
32 docker compose -f "$COMPOSE_FILE" down -v --remove-orphans >/dev/null 2>&1 || true
33 34 echo "==> building images (first run pulls Go/Debian/Alpine layers)"
35 docker compose -f "$COMPOSE_FILE" build
36 37 echo "==> starting relay and mint"
38 docker compose -f "$COMPOSE_FILE" up --abort-on-container-exit --exit-code-from lab
39