-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnuke-dev.sh
More file actions
executable file
·81 lines (69 loc) · 2.12 KB
/
nuke-dev.sh
File metadata and controls
executable file
·81 lines (69 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# =========================
# One-time teardown / cleanup script
# =========================
# This will REMOVE EVERYTHING created by your setup-dev.sh:
# - containers (sqlserver, azurite, mongodb, postgres, clickhouse, metabase, mailhog, openobserve, redis, minio, sentry, victorialogs)
# - volumes (sqlserver_data, azurite_data, mongodb_data, pg_data, clickhouse_data, metabase_data, openobserve_data, redis_data, minio_data, sentry_data, victorialogs_data)
# - network (devnet)
#
# Save as: ~/bin/nuke-dev.sh
# Run: chmod +x ~/bin/nuke-dev.sh && ~/bin/nuke-dev.sh
cat > ~/bin/nuke-dev.sh <<'BASH'
#!/usr/bin/env bash
set -euo pipefail
NET="devnet"
CONTAINERS=(
sqlserver
azurite
mongodb
postgres
clickhouse
metabase
mailhog
openobserve
redis
minio
sentry
victorialogs
)
VOLUMES=(
sqlserver_data
azurite_data
mongodb_data
pg_data
clickhouse_data
metabase_data
openobserve_data
redis_data
minio_data
sentry_data
victorialogs_data
)
echo "Stopping containers (if running)..."
for c in "${CONTAINERS[@]}"; do
docker stop "$c" >/dev/null 2>&1 || true
done
echo "Removing containers..."
for c in "${CONTAINERS[@]}"; do
docker rm -f "$c" >/dev/null 2>&1 || true
done
echo "Removing volumes (THIS DELETES DATA)..."
for v in "${VOLUMES[@]}"; do
docker volume rm "$v" >/dev/null 2>&1 || true
done
echo "Removing network..."
docker network rm "$NET" >/dev/null 2>&1 || true
echo ""
echo "Done."
echo "Remaining matching containers (should be none):"
docker ps -a --format '{{.Names}}' | grep -E '^(sqlserver|azurite|mongodb|postgres|clickhouse|metabase|mailhog|openobserve|redis|minio|sentry|victorialogs)$' || true
echo ""
echo "Remaining matching volumes (should be none):"
docker volume ls --format '{{.Name}}' | grep -E '^(sqlserver_data|azurite_data|mongodb_data|pg_data|clickhouse_data|metabase_data|openobserve_data|redis_data|minio_data|sentry_data|victorialogs_data)$' || true
echo ""
echo "Remaining network (should be none):"
docker network ls --format '{{.Name}}' | grep -E "^${NET}$" || true
BASH
chmod +x ~/bin/nuke-dev.sh
echo "Wrote ~/bin/nuke-dev.sh"
echo "Run it now with: ~/bin/nuke-dev.sh"