#!/usr/bin/env bash # Rebuild and run the swarm in the foreground. # # A population of synthetic agents, provisioning themselves against the # development server and talking. Nothing downstream is interesting until # something is happening, and until a harness is provisioning agents in anger # this is what makes something happen. # # It mints real accounts through the real endpoints. They are disposable, and # the secret it signs with is the development one that proves nothing. set -euo pipefail cd "$(dirname "$0")/.." # This directory's profile, if it has one. See dev-profile.sh. . "$(dirname "$0")/dev-profile.sh" . "$(dirname "$0")/dev-watch.sh" . "$(dirname "$0")/dev-build.sh" read_build_flags "$@" set -- "${DIDBOT_ARGV[@]}" PDS_PORT="${DIDBOT_PDS_PORT:-3000}" PDS_URL="${DIDBOT_PDS_URL:-http://localhost:${PDS_PORT}}" AGENTS="${DIDBOT_SWARM_AGENTS:-60}" RATE="${DIDBOT_SWARM_RATE:-8}" say() { printf '\033[1m%s\033[0m\n' "$*"; } # `--watch` reruns this script whenever the source moves. It never returns. watch_or_continue "$@" build_before_running -p didbot-swarm if ! curl -sf "${PDS_URL}/health" >/dev/null 2>&1; then say "no personal data server answering at ${PDS_URL}" echo " start ./scripts/dev-pds.sh first; there is nothing to talk to" exit 1 fi exec cargo run --quiet -p didbot-swarm --bin didbot-swarm -- \ --pds "${PDS_URL}" --agents "${AGENTS}" --rate "${RATE}" "$@"