#!/bin/bash # Demo Reset Script (Linux/macOS) # Resets the demo instance to a clean state with fresh seed data set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR/.." echo "=== Likwid Demo Reset ===" if [ "$1" != "--force" ] && [ "$1" != "-f" ]; then read -p "This will DELETE all demo data and reset to initial state. Continue? (y/N) " confirm if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then echo "Aborted." exit 0 fi fi echo -e "\n[1/4] Stopping demo containers..." podman-compose -f compose/demo.yml down || docker-compose -f compose/demo.yml down echo -e "\n[2/4] Removing demo database volume..." podman volume rm likwid_demo_data -f 2>/dev/null || docker volume rm likwid_demo_data -f 2>/dev/null || true echo -e "\n[3/4] Starting fresh demo instance..." podman-compose -f compose/demo.yml up -d || docker-compose -f compose/demo.yml up -d echo -e "\n[4/4] Waiting for services to be ready..." sleep 5 max_retries=30 retry=0 while [ $retry -lt $max_retries ]; do if curl -s http://localhost:3001/health > /dev/null 2>&1; then echo -e "\n=== Demo Reset Complete ===" echo -e "\nDemo is ready at:" echo " Frontend: http://localhost:4322" echo " Backend: http://localhost:3001" echo -e "\nDemo accounts (password: demo123):" echo " - contributor (standard member)" echo " - moderator (can moderate)" echo " - observer (read-only)" exit 0 fi retry=$((retry + 1)) echo -n "." sleep 1 done echo -e "\nWarning: Backend health check timed out. Check logs with:" echo " podman-compose -f compose/demo.yml logs backend"