mirror of
https://github.com/OpenStaticFish/MicroServices.git
synced 2026-10-13 06:35:12 +00:00
Add Tilt reset commands
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cluster_name="openstaticfish"
|
||||
|
||||
echo "Nuking Tilt + Kind..."
|
||||
|
||||
# 1. Kill whatever is holding port 10350. Do not call `tilt down` here:
|
||||
# it can hang when the kube context points at a dead Kind API server.
|
||||
pid=$(ss -tlnp 'sport = :10350' 2>/dev/null | grep -oP 'pid=\K[0-9]+' | head -1 || true)
|
||||
if [ -n "$pid" ]; then
|
||||
echo "Killing process on port 10350: $pid"
|
||||
kill "$pid" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# 2. Delete the Kind cluster. This nukes all Tilt-managed resources too.
|
||||
echo "Deleting Kind cluster '$cluster_name'..."
|
||||
kind delete cluster --name "$cluster_name" 2>/dev/null || true
|
||||
|
||||
echo "Nuked."
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cluster_name="openstaticfish"
|
||||
|
||||
if [ "${1:-}" = "up" ]; then
|
||||
shift
|
||||
fi
|
||||
|
||||
echo "Nuking stale Tilt + Kind state..."
|
||||
|
||||
# 1. Nuke stale tilt + kind. Do not call `tilt down` here:
|
||||
# it can hang when the kube context points at a dead Kind API server.
|
||||
pid=$(ss -tlnp 'sport = :10350' 2>/dev/null | grep -oP 'pid=\K[0-9]+' | head -1 || true)
|
||||
if [ -n "$pid" ]; then
|
||||
echo "Killing process on port 10350: $pid"
|
||||
kill "$pid" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo "Deleting Kind cluster '$cluster_name'..."
|
||||
kind delete cluster --name "$cluster_name" 2>/dev/null || true
|
||||
|
||||
# 2. Ensure Docker is running
|
||||
docker info >/dev/null 2>&1 || { echo "Docker is not running."; exit 1; }
|
||||
|
||||
# 3. Fresh cluster
|
||||
echo "Creating Kind cluster '$cluster_name'..."
|
||||
kind create cluster --name "$cluster_name"
|
||||
kubectl config use-context "kind-$cluster_name"
|
||||
|
||||
# 4. Go
|
||||
echo "Starting Tilt..."
|
||||
exec tilt up "$@"
|
||||
Reference in New Issue
Block a user