#!/bin/bash # Run the probe on this host: start werkdock's API socket, let # Testcontainers use it, stop it again. Meant for a host that has a JVM # and werkdock but no build tool — a managed webspace. Lives beside the # jars it runs (tools/deploy.sh puts it there). # # run-probe.sh [IMAGE] the plain Probe, container code and all # run-probe.sh --spring the Spring Boot application, whose database # is the jdbc:tc URL in application.yml set -u main=werkprobe.Probe if [ "${1:-}" = "--spring" ]; then main=werkprobe.WerkprobeApplication shift fi here="$(cd "$(dirname "$0")" && pwd)" export PATH="$HOME/opt/werkdock/bin:$PATH" if ! command -v werkdock > /dev/null; then echo "werkdock is not in PATH (looked in \$HOME/opt/werkdock/bin)" >&2 exit 1 fi socket="${XDG_RUNTIME_DIR:-$HOME}/werkdock.sock" log="$here/service.log" echo "== $(werkdock version), socket $socket, main $main" werkdock system service "$socket" > "$log" 2>&1 & service=$! trap 'kill $service 2> /dev/null' EXIT for _ in $(seq 1 100); do [ -S "$socket" ] && break sleep 0.1 done if [ ! -S "$socket" ]; then echo "the service did not come up:" >&2 cat "$log" >&2 exit 1 fi export DOCKER_HOST="unix://$socket" export TESTCONTAINERS_RYUK_DISABLED=true java -cp "$here/*" "$main" "$@" status=$? echo echo "== what the client asked werkdock for ==" cat "$log" exit $status