Skip to content

Commit 460f0b7

Browse files
authored
add node 10.6.2 and redo stop script (#88)
* add node 10.6.2 * set pipefail * improve stop script * redo stop nodes for ci * reorder versions to fix ci * add 10.5.4 * add checkpoints.json to config
1 parent 0aca93d commit 460f0b7

File tree

2 files changed

+66
-65
lines changed

2 files changed

+66
-65
lines changed

start-node.sh

Lines changed: 14 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# errors are handled gracefully to tell the user
4-
# set -euo pipefail
4+
set -euo pipefail
55

66
# ----------------------------------------
77
ALLOW_MAINNET_EXTERNAL="false"
@@ -132,7 +132,7 @@ select connection_type in "${connection_options[@]}"; do
132132
done
133133

134134
# Define the list of available networks
135-
available_networks=("mainnet" "preprod" "preview" "sanchonet-pig" "sanchonet-chicken")
135+
available_networks=("mainnet" "preprod" "preview" "sanchonet")
136136

137137

138138
# If user selected external node configuration
@@ -233,7 +233,7 @@ echo
233233
echo -e "${CYAN}Setting up Docker node...${NC}"
234234

235235
# Define the list of available node versions
236-
available_versions=( "10.5.3" "10.5.1")
236+
available_versions=( "10.5.3" "10.5.4" "10.6.2" )
237237

238238
# Initialize variables to avoid unbound variable errors
239239
network=""
@@ -283,11 +283,7 @@ else
283283
fi
284284

285285
# Normalize network name for directory/container naming
286-
# sanchonet-pig and sanchonet-chicken both normalize to sanchonet
287286
network_normalized="$network"
288-
if [ "$network" = "sanchonet-pig" ] || [ "$network" = "sanchonet-chicken" ]; then
289-
network_normalized="sanchonet"
290-
fi
291287

292288
# Function to assign a unique port based on version
293289
# This ensures different versions on the same network use different ports
@@ -395,7 +391,7 @@ dumps_dir="$base_dir/dumps/$network_normalized"
395391
utilities_dir="$base_dir/utilities"
396392

397393
# Base URL for node config files
398-
if [ "$network" = "sanchonet-pig" ] || [ "$network" = "sanchonet-chicken" ]; then
394+
if [ "$network" = "sanchonet" ]; then
399395
config_base_url="https://raw.githubusercontent.com/Hornan7/SanchoNet-Tutorials/refs/heads/main/genesis/"
400396
else
401397
config_base_url="https://book.play.dev.cardano.org/environments/$network/"
@@ -447,9 +443,18 @@ config_files=(
447443
"alonzo-genesis.json"
448444
"conway-genesis.json"
449445
"peer-snapshot.json"
450-
"guardrails-script.plutus"
451446
)
452447

448+
# add dijkstra-genesis.json for 10.6.2
449+
if [ "$node_version" = "10.6.2" ]; then
450+
config_files+=("dijkstra-genesis.json")
451+
fi
452+
453+
# add checkpoints.json for preview and mainnet (not available for sanchonet or preprod)
454+
if [ "$network" = "preview" ] || [ "$network" = "mainnet" ]; then
455+
config_files+=("checkpoints.json")
456+
fi
457+
453458
# Change directory to the config directory and download files
454459
echo -e "${CYAN}Downloading configuration files...${NC}"
455460
cd "$config_dir" || exit
@@ -463,53 +468,6 @@ for file in "${config_files[@]}"; do
463468
curl --silent -O -J -L "${config_base_url}${file}"
464469
done
465470

466-
# Create custom topology.json for sanchonet-chicken
467-
if [ "$network" = "sanchonet-chicken" ]; then
468-
echo -e "${BLUE}Creating custom topology.json for sanchonet-chicken${NC}"
469-
cat > topology.json << 'EOF'
470-
{
471-
"bootstrapPeers": [
472-
{
473-
"address": "sanchorelay1.intertreecryptoconsultants.com",
474-
"port": 6002
475-
}
476-
],
477-
"localRoots": [
478-
{
479-
"accessPoints": [
480-
{
481-
"address": "sanchorelay1.intertreecryptoconsultants.com",
482-
"port": 6002
483-
},
484-
{
485-
"address": "9.tcp.eu.ngrok.io",
486-
"port": 20802
487-
},
488-
{
489-
"address": "34.19.153.32",
490-
"port": 6002
491-
},
492-
{
493-
"address": "relay.hephy.io",
494-
"port": 9000
495-
}
496-
],
497-
"advertise": false,
498-
"trustable": true,
499-
"valency": 4
500-
}
501-
],
502-
"publicRoots": [
503-
{
504-
"accessPoints": [],
505-
"advertise": false
506-
}
507-
],
508-
"useLedgerAfterSlot": -1
509-
}
510-
EOF
511-
fi
512-
513471
# Return to the base directory
514472
cd "$base_dir" || exit
515473

stop-nodes.sh

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,66 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
# Stop all cardano node containers matching the pattern node-*-*-container
5-
# This handles versioned containers (e.g., node-preprod-10.5.3-container)
6-
echo "Stopping all Cardano node containers..."
4+
# Define colors
5+
RED='\033[0;31m'
6+
GREEN='\033[0;32m'
7+
YELLOW='\033[0;33m'
8+
BLUE='\033[0;34m'
9+
CYAN='\033[0;36m'
10+
NC='\033[0m' # No color
711

8-
# Get all running containers and filter for node-*-*-container pattern
12+
# Get all running containers matching the node pattern
913
containers=$(docker ps --format "{{.Names}}" | grep -E "^node-[^-]+-[^-]+-container$" || true)
1014

1115
if [ -z "$containers" ]; then
12-
echo "No Cardano node containers found running."
16+
echo -e "${YELLOW}No Cardano node containers found running.${NC}"
1317
exit 0
1418
fi
1519

16-
# Stop each container
17-
for container in $containers; do
18-
echo "Stopping container: $container"
20+
# Convert to array (compatible with Bash 3.x on macOS)
21+
container_list=()
22+
while IFS= read -r line; do
23+
container_list+=("$line")
24+
done <<< "$containers"
25+
count=${#container_list[@]}
26+
27+
# Non-interactive mode (CI or piped input): stop all containers automatically
28+
if [ ! -t 0 ] && [ ! -t 1 ]; then
29+
echo "Stopping all Cardano node containers..."
30+
stop_list=("${container_list[@]}")
31+
else
32+
# Interactive mode: let user choose
33+
echo -e "${CYAN}Running Cardano node containers:${NC}"
34+
for i in "${!container_list[@]}"; do
35+
echo -e " ${GREEN}$((i + 1))${NC}) ${BLUE}${container_list[$i]}${NC}"
36+
done
37+
echo -e " ${GREEN}$((count + 1))${NC}) ${RED}Stop all${NC}"
38+
echo
39+
40+
echo -e "${CYAN}Select a container to stop (1-$((count + 1))):${NC}"
41+
read -r choice < /dev/tty
42+
43+
# Validate input
44+
if ! [[ "$choice" =~ ^[0-9]+$ ]] || [ "$choice" -lt 1 ] || [ "$choice" -gt $((count + 1)) ]; then
45+
echo -e "${RED}Invalid selection.${NC}"
46+
exit 1
47+
fi
48+
49+
# Build list of containers to stop
50+
if [ "$choice" -eq $((count + 1)) ]; then
51+
stop_list=("${container_list[@]}")
52+
else
53+
stop_list=("${container_list[$((choice - 1))]}")
54+
fi
55+
fi
56+
57+
# Stop and remove selected containers
58+
for container in "${stop_list[@]}"; do
59+
echo -e "${YELLOW}Stopping: $container${NC}"
1960
docker stop "$container" 2>/dev/null || true
2061
docker rm "$container" 2>/dev/null || true
62+
echo -e "${GREEN}Stopped: $container${NC}"
2163
done
2264

23-
echo "All Cardano node containers stopped."
65+
echo
66+
echo -e "${GREEN}Done.${NC}"

0 commit comments

Comments
 (0)