Files
spinifex/scripts/reset-dev-env.sh
T
Julian Sommer b7678ab7c5 feat: fix silent failures across spinifex (P2 audit H-25 through H-43)
- PID file failures now prevent service start instead of logging and continuing
- Status() methods use PID-based health checks instead of returning empty string
- NewResourceManager returns error instead of silently defaulting to 8GB
- Crash recovery re-allocates resources before relaunch
- restoreInstances stops after failed resource allocation
- Cluster manager bind errors propagated to Start()
- NATS disconnect/reconnect logged at Warn level
- VPC CIDR fallback logs warning about overbroad rule
- vpcd respond() handles json.Marshal failure
- Network cleanup failures logged instead of silently discarded
- fmt.Println replaced with slog.Debug in NATS service
- Signature mismatch no longer logs expected signature
- extractDiskImagePath uses errors.Is for EOF
- validateDiskImagePath checks file command error
- os.Stat uncommented in admin image import
- net.SplitHostPort errors checked
- Gateway response write errors logged
- vpcd OVN NB address uses leader IP on non-primary nodes
- Release workflow parallelized with native arm64 runner
2026-03-19 13:37:41 +10:00

58 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Reset dev environment (will purge all data)
set -euo pipefail
echo "Shutting down services"
if ! ./scripts/stop-dev.sh; then
echo "❌ Failed to stop services. Aborting reset to prevent data loss."
exit 1
fi
echo "Removing data"
rm -rf ~/spinifex/predastore/
rm -rf ~/spinifex/spinifex/*
rm -rf ~/spinifex/viperblock/*
rm -rf ~/spinifex/nats/*
rm -rf ~/spinifex/images/*
# Enable pprof for development
PPROF_ENABLED=1 PPROF_OUTPUT=/tmp/spinifex-vm.prof ./scripts/start-dev.sh --build
# Follow INSTALL.md steps
echo "Importing AMI"
export AWS_PROFILE=spinifex
# Step 1 SSH key
aws ec2 import-key-pair --key-name "spinifex-key" --public-key-material fileb://~/.ssh/spinifex-key.pub
echo "Validating key pair imported"
aws ec2 describe-key-pairs
# Detect architecture
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
IMAGE_NAME="ubuntu-24.04-x86_64"
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
IMAGE_NAME="ubuntu-24.04-arm64"
else
echo "Warning: Unknown architecture $ARCH, defaulting to x86_64"
IMAGE_NAME="ubuntu-24.04-x86_64"
fi
echo "Detected architecture: $ARCH, using image: $IMAGE_NAME"
./bin/spx admin images import --name "$IMAGE_NAME"
aws ec2 describe-images
echo "Reset successful, fresh AMI imported, proceed to creating instances"