Files
scadalink-design/infra/teardown.sh
Joseph Doherty 652378b470 Add test infrastructure with Docker services, CLI tools, and resolve Phase 0 questions
Stand up local dev infrastructure (OPC UA, LDAP, MS SQL) with Docker Compose,
Python CLI tools for service interaction, and teardown script. Fix GLAuth config
mount, OPC PLC node format, and document actual DN/namespace behavior discovered
during testing. Resolve Q1-Q8,Q10: .NET 10, Akka.NET 1.5.x, monorepo with slnx,
appsettings JWT, Windows Server 2022 site target.
2026-03-16 14:03:12 -04:00

48 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Tear down ScadaLink test infrastructure.
#
# Usage:
# ./teardown.sh Stop containers and delete the SQL data volume
# ./teardown.sh --images Also remove downloaded Docker images
# ./teardown.sh --all Remove volumes, images, and the Python venv
set -euo pipefail
cd "$(dirname "$0")"
REMOVE_IMAGES=false
REMOVE_VENV=false
for arg in "$@"; do
case "$arg" in
--images) REMOVE_IMAGES=true ;;
--all) REMOVE_IMAGES=true; REMOVE_VENV=true ;;
-h|--help)
echo "Usage: ./teardown.sh [--images] [--all]"
echo " (no flags) Stop containers, delete SQL data volume"
echo " --images Also remove downloaded Docker images"
echo " --all Remove volumes, images, and Python venv"
exit 0
;;
*)
echo "Unknown option: $arg" >&2
exit 1
;;
esac
done
echo "Stopping containers and removing SQL data volume..."
if $REMOVE_IMAGES; then
docker compose down -v --rmi all
else
docker compose down -v
fi
if $REMOVE_VENV && [ -d tools/.venv ]; then
echo "Removing Python virtual environment..."
rm -rf tools/.venv
fi
echo ""
echo "Teardown complete."
echo "To start fresh: docker compose up -d && python tools/mssql_tool.py setup --script mssql/setup.sql"