diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0b1db76..8ececdc 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -54,6 +54,26 @@ jobs: docker images | grep testnet-docker-image echo "Docker image built successfully" + - name: Build Dingo Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile.dingo + tags: | + testnet-dingo-image:${{ steps.meta.outputs.tag }} + testnet-dingo-image:${{ steps.meta.outputs.sha }} + cache-from: type=gha + cache-to: type=gha,mode=max + push: false + load: true + + - name: Test Dingo Docker image + shell: bash + run: | + set -euo pipefail + docker images | grep testnet-dingo-image + echo "Dingo Docker image built successfully" + - name: Cleanup if: always() shell: bash diff --git a/.github/workflows/test-start-node.yml b/.github/workflows/test-start-node.yml index 541c774..0a3f3c6 100644 --- a/.github/workflows/test-start-node.yml +++ b/.github/workflows/test-start-node.yml @@ -38,8 +38,8 @@ jobs: timeout-minutes: 10 run: | set -euo pipefail - # connection=1 (Docker), network=3 (preprod), version=1 (latest) - printf "1\n3\n1\n" | ./start-node.sh 2>&1 | tee preprod_output.txt & + # connection=1 (Docker), impl=1 (cardano-node), network=3 (preprod), version=1 (latest) + printf "1\n1\n3\n1\n" | ./start-node.sh 2>&1 | tee preprod_output.txt & START_PID=$! sleep 30 if ! kill -0 $START_PID 2>/dev/null; then @@ -59,15 +59,15 @@ jobs: run: | set -euo pipefail ./stop-nodes.sh || true - docker ps -a --filter "name=node-" --format "{{.Names}}" | xargs -r docker rm -f || true + docker ps -a --filter "label=managed-by=testnet-docker-node" --format "{{.Names}}" | xargs -r docker rm -f || true - name: Test Preview node shell: bash timeout-minutes: 3 run: | set -euo pipefail - # connection=1 (Docker), network=2 (preview), version=1 (latest) - printf "1\n2\n1\n" | ./start-node.sh 2>&1 | tee preview_output.txt & + # connection=1 (Docker), impl=1 (cardano-node), network=2 (preview), version=1 (latest) + printf "1\n1\n2\n1\n" | ./start-node.sh 2>&1 | tee preview_output.txt & START_PID=$! sleep 30 if ! kill -0 $START_PID 2>/dev/null; then @@ -87,15 +87,15 @@ jobs: run: | set -euo pipefail ./stop-nodes.sh || true - docker ps -a --filter "name=node-" --format "{{.Names}}" | xargs -r docker rm -f || true + docker ps -a --filter "label=managed-by=testnet-docker-node" --format "{{.Names}}" | xargs -r docker rm -f || true - name: Test SanchoNet node shell: bash timeout-minutes: 3 run: | set -euo pipefail - # connection=1 (Docker), network=1 (sanchonet), version=1 (latest) - printf "1\n1\n1\n" | ./start-node.sh 2>&1 | tee sancho_output.txt & + # connection=1 (Docker), impl=1 (cardano-node), network=1 (sanchonet), version=1 (latest) + printf "1\n1\n1\n1\n" | ./start-node.sh 2>&1 | tee sancho_output.txt & START_PID=$! sleep 30 if ! kill -0 $START_PID 2>/dev/null; then @@ -109,13 +109,41 @@ jobs: cat sancho_output.txt fi + - name: Cleanup after SanchoNet + if: always() + shell: bash + run: | + set -euo pipefail + ./stop-nodes.sh || true + docker ps -a --filter "label=managed-by=testnet-docker-node" --format "{{.Names}}" | xargs -r docker rm -f || true + + - name: Test Dingo SanchoNet node + shell: bash + timeout-minutes: 3 + run: | + set -euo pipefail + # connection=1 (Docker), impl=2 (dingo), network=1 (sanchonet), version=1 (latest) + printf "1\n2\n1\n1\n" | ./start-node.sh 2>&1 | tee dingo_sancho_output.txt & + START_PID=$! + sleep 30 + if ! kill -0 $START_PID 2>/dev/null; then + echo "Error: start-node.sh process died unexpectedly" + exit 1 + fi + ./stop-nodes.sh + wait $START_PID || true + if [ -f dingo_sancho_output.txt ]; then + echo "=== Dingo SanchoNet Node Output ===" + cat dingo_sancho_output.txt + fi + - name: Final cleanup if: always() shell: bash run: | set -euo pipefail ./stop-nodes.sh || true - docker ps -a --filter "name=node-" --format "{{.Names}}" | xargs -r docker rm -f || true + docker ps -a --filter "label=managed-by=testnet-docker-node" --format "{{.Names}}" | xargs -r docker rm -f || true docker system prune -f || true - name: Upload logs on failure diff --git a/.gitignore b/.gitignore index a28265c..16f07e8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ node/ secrets/ utilities/ node-*/ +dingo-*/ /scripts/poison /scripts/poison/ /plutus diff --git a/Dockerfile b/Dockerfile index 7c6129c..fa544e8 100755 --- a/Dockerfile +++ b/Dockerfile @@ -14,4 +14,4 @@ ENV CARDANO_NODE_PORT=${CARDANO_NODE_PORT} ENV IPFS_GATEWAY_URI="https://ipfs.io/" # Use shell form to allow variable expansion -ENTRYPOINT /usr/local/bin/cardano-node run +RTS -N -A16m -qg -qb -RTS --topology /config/topology.json --database-path /data/db --socket-path /ipc/node.socket --host-addr 0.0.0.0 --port ${CARDANO_NODE_PORT} --config /config/config.json \ No newline at end of file +ENTRYPOINT /usr/local/bin/cardano-node run +RTS -N -A16m -qg -qb -RTS --topology /config/topology.json --database-path /data/db --socket-path /ipc/node.socket --host-addr 0.0.0.0 --port ${CARDANO_NODE_PORT} --config /config/config.json diff --git a/Dockerfile.dingo b/Dockerfile.dingo new file mode 100644 index 0000000..31f2386 --- /dev/null +++ b/Dockerfile.dingo @@ -0,0 +1,15 @@ +# Define build-time variables for FROM statement +ARG DINGO_VERSION=0.13.0 + +FROM ghcr.io/blinklabs-io/dingo:${DINGO_VERSION} + +# Redefine build arguments for use in this stage +ARG CARDANO_NETWORK=preview +ARG CARDANO_NODE_PORT=4001 +ARG CARDANO_NODE_NETWORK_ID + +# Set environment variables +ENV CARDANO_NETWORK=${CARDANO_NETWORK} +ENV CARDANO_CONFIG=/config/config.json +ENV CARDANO_NODE_NETWORK_ID=${CARDANO_NODE_NETWORK_ID} +ENV CARDANO_NODE_PORT=${CARDANO_NODE_PORT} diff --git a/docker-compose.yml b/docker-compose.yml index 1f0c58d..666ddf7 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,25 @@ version: "3.5" services: - cardano-node-${NETWORK}-${NODE_VERSION}: - container_name: node-${NETWORK}-${NODE_VERSION}-container + ${DIR_PREFIX}-${NETWORK}-${SERVICE_VERSION}: + container_name: ${DIR_PREFIX}-${NETWORK}-${SERVICE_VERSION}-container network_mode: "host" build: context: ./ + dockerfile: ${DOCKERFILE} args: - CARDANO_NODE_VERSION: ${NODE_VERSION} + CARDANO_NODE_VERSION: ${SERVICE_VERSION} + DINGO_VERSION: ${SERVICE_VERSION} + CARDANO_NETWORK: ${NETWORK} CARDANO_NODE_NETWORK_ID: ${NETWORK_ID} CARDANO_NODE_PORT: ${NODE_PORT} labels: - "managed-by=testnet-docker-node" restart: always volumes: - - ./node-${NETWORK}-${NODE_VERSION}/db:/data/db - - ./node-${NETWORK}-${NODE_VERSION}/config:/config - - ./node-${NETWORK}-${NODE_VERSION}/ipc:/ipc + - ./${DIR_PREFIX}-${NETWORK}-${SERVICE_VERSION}/db:/data/db + - ./${DIR_PREFIX}-${NETWORK}-${SERVICE_VERSION}/config:/config + - ./${DIR_PREFIX}-${NETWORK}-${SERVICE_VERSION}/ipc:/ipc - ./keys:/keys - ./txs:/txs - ./dumps:/dumps diff --git a/scripts/helper/cardano-cli-wrapper.sh b/scripts/helper/cardano-cli-wrapper.sh index 8d36f01..8424881 100755 --- a/scripts/helper/cardano-cli-wrapper.sh +++ b/scripts/helper/cardano-cli-wrapper.sh @@ -32,6 +32,41 @@ convert_to_container_path() { echo "$path" } +# Default cardano-node image used to run cardano-cli for Dingo containers +CARDANO_CLI_IMAGE="${CARDANO_CLI_IMAGE:-ghcr.io/intersectmbo/cardano-node:10.7.0}" + +# Check if a container is a Dingo container +is_dingo_container() { + [[ "$1" == dingo-* ]] +} + +# Get the host IPC volume path for a container +get_ipc_volume_path() { + docker inspect "$1" --format '{{range .Mounts}}{{if eq .Destination "/ipc"}}{{.Source}}{{end}}{{end}}' 2>/dev/null +} + +# Get the CARDANO_NODE_NETWORK_ID from a Dingo container +get_dingo_network_id() { + docker inspect "$1" --format '{{range .Config.Env}}{{println .}}{{end}}' 2>/dev/null | grep '^CARDANO_NODE_NETWORK_ID=' | cut -d= -f2 +} + +# Run cardano-cli for a Dingo container using the cardano-node image with shared socket +dingo_cardano_cli() { + local ipc_path="$1" + local network_id="$2" + shift 2 + docker run --rm \ + -v "$ipc_path:/ipc" \ + -v "$base_dir/keys:/keys" \ + -v "$base_dir/txs:/txs" \ + -v "$base_dir/dumps:/dumps" \ + -e CARDANO_NODE_SOCKET_PATH=/ipc/dingo.socket \ + -e CARDANO_NODE_NETWORK_ID="$network_id" \ + --entrypoint="" \ + "$CARDANO_CLI_IMAGE" \ + cardano-cli "$@" +} + # Display version info for a given container name display_version_info() { local container_name="$1" @@ -39,21 +74,28 @@ display_version_info() { return fi - # Extract network and version from container name (pattern: node-{network}-{version}-container) + # Extract impl, network and version from container name (pattern: {node|dingo}-{network}-{version}-container) + local impl="" local network="" local node_version="" - if [[ "$container_name" =~ ^node-([^-]+)-([^-]+)-container$ ]]; then - network="${BASH_REMATCH[1]}" - node_version="${BASH_REMATCH[2]}" + if [[ "$container_name" =~ ^(node|dingo)-([^-]+)-([^-]+)-container$ ]]; then + impl="${BASH_REMATCH[1]}" + network="${BASH_REMATCH[2]}" + node_version="${BASH_REMATCH[3]}" + fi + + # Get cardano-cli version from container (Dingo containers use docker run with cardano-node image) + local cli_version="" + if is_dingo_container "$container_name"; then + cli_version=$(docker run --rm --entrypoint="" "$CARDANO_CLI_IMAGE" cardano-cli version 2>/dev/null | head -n 1 || echo "unknown") + else + cli_version=$(docker exec "$container_name" cardano-cli version 2>/dev/null | head -n 1 || echo "unknown") fi - - # Get cardano-cli version from container - local cli_version=$(docker exec "$container_name" cardano-cli version 2>/dev/null | head -n 1 || echo "unknown") # Clean up version string (remove "cardano-cli" prefix if present) cli_version=$(echo "$cli_version" | sed 's/^cardano-cli //') - + if [ -n "$network" ] && [ -n "$node_version" ]; then - echo -e "${CYAN}Info:${NC} ${YELLOW}node v$node_version${NC} | ${GREEN}$network${NC} | ${BLUE}cardano-cli $cli_version${NC}" >&2 + echo -e "${CYAN}Info:${NC} ${YELLOW}$impl v$node_version${NC} | ${GREEN}$network${NC} | ${BLUE}cardano-cli $cli_version${NC}" >&2 else echo -e "${CYAN}Info:${NC} ${YELLOW}Docker container: $container_name${NC} | ${BLUE}cardano-cli $cli_version${NC}" >&2 fi @@ -85,9 +127,9 @@ check_cardano_cli_version() { container_name="$CARDANO_CONTAINER_NAME_OVERRIDE" else # Only try to get container name if there's exactly one running container (non-interactive) - local running_count=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -E '^node-' | wc -l | tr -d ' ') + local running_count=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -E '^(node|dingo)-' | wc -l | tr -d ' ') if [ "$running_count" -eq 1 ]; then - container_name=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -E '^node-' | head -n 1) + container_name=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -E '^(node|dingo)-' | head -n 1) fi fi @@ -195,7 +237,7 @@ cardano_cli() { # Display version info for the selected container # Only show if multiple containers are running (selection happened) to avoid duplicate when single container - local running_count=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -E '^node-' | wc -l | tr -d ' ') + local running_count=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -E '^(node|dingo)-' | wc -l | tr -d ' ') if [ "$running_count" -gt 1 ]; then display_version_info "$container_name" fi @@ -216,10 +258,25 @@ cardano_cli() { prev_arg="$arg" done - if [ ${#network_flag_args[@]} -gt 0 ]; then - docker exec -ti "$container_name" cardano-cli "${network_flag_args[@]}" "${converted_args[@]}" + if is_dingo_container "$container_name"; then + # Dingo containers: run cardano-cli via docker run with shared socket + local ipc_path=$(get_ipc_volume_path "$container_name") + if [ -z "$ipc_path" ]; then + echo "Error: Could not determine IPC volume path for container '$container_name'." >&2 + exit 1 + fi + local dingo_network_id=$(get_dingo_network_id "$container_name") + if [ ${#network_flag_args[@]} -gt 0 ]; then + dingo_cardano_cli "$ipc_path" "$dingo_network_id" "${network_flag_args[@]}" "${converted_args[@]}" + else + dingo_cardano_cli "$ipc_path" "$dingo_network_id" "${converted_args[@]}" + fi else - docker exec -ti "$container_name" cardano-cli "${converted_args[@]}" + if [ ${#network_flag_args[@]} -gt 0 ]; then + docker exec -ti "$container_name" cardano-cli "${network_flag_args[@]}" "${converted_args[@]}" + else + docker exec -ti "$container_name" cardano-cli "${converted_args[@]}" + fi fi fi } diff --git a/scripts/helper/load-config.sh b/scripts/helper/load-config.sh index 61e5d77..68b0a4e 100755 --- a/scripts/helper/load-config.sh +++ b/scripts/helper/load-config.sh @@ -38,7 +38,7 @@ docker_compose_file="$base_dir/docker-compose.yml" # Get running containers running_containers="" if command -v docker &> /dev/null; then - running_containers=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -E '^node-' || true) + running_containers=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -E '^(node|dingo)-' || true) fi # Safety check: If docker-compose.yml exists but no containers are running and no socket is set, diff --git a/start-node.sh b/start-node.sh index bc90933..6c0c922 100755 --- a/start-node.sh +++ b/start-node.sh @@ -52,38 +52,43 @@ list_existing_node_directories() { local node_dirs local found_any=false - # Find all node-* directories - node_dirs=$(find "$project_root" -maxdepth 1 -type d -name "node-*" 2>/dev/null | sort || true) - + # Find all node-* and dingo-* directories + node_dirs=$(find "$project_root" -maxdepth 1 -type d \( -name "node-*" -o -name "dingo-*" \) 2>/dev/null | sort || true) + if [ -n "$node_dirs" ]; then echo -e "${CYAN}Existing Node directories:${NC}" while IFS= read -r dir; do [ -z "$dir" ] && continue local dirname=$(basename "$dir") - # Extract network and version from directory name - # Pattern: node-network-version or node-network - if [[ "$dirname" =~ ^node-(.+)-([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then - # Has version: node-network-version - local network="${BASH_REMATCH[1]}" - local version="${BASH_REMATCH[2]}" + # Extract impl, network and version from directory name + # Pattern: {node|dingo}-network-version or {node|dingo}-network + if [[ "$dirname" =~ ^(node|dingo)-(.+)-([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + local impl="${BASH_REMATCH[1]}" + local network="${BASH_REMATCH[2]}" + local version="${BASH_REMATCH[3]}" # Capitalize first letter of network network=$(echo "$network" | awk '{print toupper(substr($0,1,1)) substr($0,2)}') - # Handle special case: sanchonet -> SanchoNet if [ "$network" = "Sanchonet" ]; then network="SanchoNet" fi - echo -e " ${GREEN}-${NC} ${CYAN}$network $version${NC}" + local label="" + if [ "$impl" = "dingo" ]; then + label=" (dingo)" + fi + echo -e " ${GREEN}-${NC} ${CYAN}$network $version$label${NC}" found_any=true - elif [[ "$dirname" =~ ^node-(.+)$ ]]; then - # No version: node-network - local network="${BASH_REMATCH[1]}" - # Capitalize first letter of network + elif [[ "$dirname" =~ ^(node|dingo)-(.+)$ ]]; then + local impl="${BASH_REMATCH[1]}" + local network="${BASH_REMATCH[2]}" network=$(echo "$network" | awk '{print toupper(substr($0,1,1)) substr($0,2)}') - # Handle special case: sanchonet -> SanchoNet if [ "$network" = "Sanchonet" ]; then network="SanchoNet" fi - echo -e " ${GREEN}-${NC} ${CYAN}$network${NC}" + local label="" + if [ "$impl" = "dingo" ]; then + label=" (dingo)" + fi + echo -e " ${GREEN}-${NC} ${CYAN}$network$label${NC}" found_any=true fi done <<< "$node_dirs" @@ -102,9 +107,13 @@ show_running_nodes() { if [ -n "$running_nodes" ]; then echo -e "${CYAN}Currently running Cardano node(s):${NC}" echo "$running_nodes" | while read -r container; do - # Extract network and version from container name (node-network-version-container) - local network_version=$(echo "$container" | sed 's/node-\(.*\)-container/\1/') - echo -e " ${GREEN}✓${NC} ${CYAN}$container${NC} (${YELLOW}$network_version${NC})" + # Extract network and version from container name ({node|dingo}-network-version-container) + local network_version=$(echo "$container" | sed -E 's/^(node|dingo)-(.+)-container$/\2/') + local impl_label="" + if [[ "$container" == dingo-* ]]; then + impl_label=" (dingo)" + fi + echo -e " ${GREEN}✓${NC} ${CYAN}$container${NC} (${YELLOW}$network_version$impl_label${NC})" done echo "" else @@ -134,6 +143,9 @@ done # Define the list of available networks available_networks=("sanchonet" "preview" "preprod" "mainnet") +# Narrow networks for Dingo (set after node_impl selection, used before network selection) +# This variable is checked after node_impl is chosen below + # If user selected external node configuration if [ "$connection_type" = "Configure connection to an external node via socket file" ]; then @@ -232,6 +244,30 @@ fi echo echo -e "${CYAN}Setting up Docker node...${NC}" +# Select node implementation +node_impl="" +node_impl_options=("cardano-node" "dingo") +if [ ! -t 0 ]; then + read -r impl_choice || true + if [ -n "$impl_choice" ] && [ "$impl_choice" -ge 1 ] && [ "$impl_choice" -le ${#node_impl_options[@]} ]; then + node_impl="${node_impl_options[$((impl_choice - 1))]}" + echo -e "${GREEN}Selected node implementation: $node_impl${NC}" + else + echo -e "${RED}Error: Invalid node implementation selection: $impl_choice${NC}" + exit 1 + fi +else + echo -e "${CYAN}Please select a node implementation:${NC}" + select node_impl in "${node_impl_options[@]}"; do + if [ -n "$node_impl" ]; then + echo -e "${GREEN}You have selected: $node_impl${NC}" + break + else + echo -e "${RED}Invalid selection. Please try again.${NC}" + fi + done +fi + # ---------------------------------------- # Define available node versions per network # ---------------------------------------- @@ -239,8 +275,17 @@ versions_sanchonet=( "10.7.0" "10.6.2" "10.5.4" ) versions_preview=( "10.6.2" "10.5.4" ) versions_preprod=( "10.6.2" "10.5.4" ) versions_mainnet=( "10.6.2" "10.5.4" ) + +# Dingo versions per network +dingo_versions_sanchonet=( "0.13.0" ) +dingo_networks=( "sanchonet" ) # ---------------------------------------- +# Narrow available networks for Dingo +if [ "$node_impl" = "dingo" ]; then + available_networks=("${dingo_networks[@]}") +fi + # Initialize variables to avoid unbound variable errors network="" node_version="" @@ -270,7 +315,11 @@ else fi # Load the available versions for the selected network -versions_var="versions_${network}" +if [ "$node_impl" = "dingo" ]; then + versions_var="dingo_versions_${network}" +else + versions_var="versions_${network}" +fi available_versions=() eval 'available_versions=("${'"$versions_var"'[@]}")' @@ -309,6 +358,9 @@ network_normalized="$network" assign_port_for_version() { local version=$1 local base_port=3001 + if [ "$node_impl" = "dingo" ]; then + base_port=4001 + fi # Create a simple hash from version string to get consistent port assignment # Convert version like "10.5.1" to a number for port offset @@ -353,7 +405,11 @@ check_running_nodes() { # Check if the specific node is already running or exists check_duplicate_node() { - local target_container="node-$network_normalized-$node_version-container" + local container_prefix="node" + if [ "$node_impl" = "dingo" ]; then + container_prefix="dingo" + fi + local target_container="$container_prefix-$network_normalized-$node_version-container" local is_running local exists @@ -391,7 +447,11 @@ project_root=$(cd "$script_dir" && pwd) # Set directory locations base_dir="$project_root" -node_dir="$base_dir/node-$network_normalized-$node_version" +if [ "$node_impl" = "dingo" ]; then + node_dir="$base_dir/dingo-$network_normalized-$node_version" +else + node_dir="$base_dir/node-$network_normalized-$node_version" +fi config_dir="$node_dir/config" db_dir="$node_dir/db" ipc_dir="$node_dir/ipc" @@ -453,7 +513,7 @@ create_dir "$dumps_dir" # Utilities dir create_dir "$utilities_dir" -# List of JSON files to download +# Download config files config_files=( "config.json" "topology.json" @@ -465,8 +525,10 @@ config_files=( ) # add dijkstra-genesis.json for 10.6.2 and 10.7.0 -if [ "$node_version" = "10.6.2" ] || [ "$node_version" = "10.7.0" ]; then - config_files+=("dijkstra-genesis.json") +if [ "$node_impl" != "dingo" ]; then + if [ "$node_version" = "10.6.2" ] || [ "$node_version" = "10.7.0" ]; then + config_files+=("dijkstra-genesis.json") + fi fi # add checkpoints.json for preview and mainnet (not available for sanchonet or preprod) @@ -474,7 +536,6 @@ if [ "$network" = "preview" ] || [ "$network" = "mainnet" ]; then config_files+=("checkpoints.json") fi -# Change directory to the config directory and download files echo -e "${CYAN}Downloading configuration files...${NC}" cd "$config_dir" || exit for file in "${config_files[@]}"; do @@ -487,13 +548,22 @@ cd "$base_dir" || exit # Export environment variables for use in docker-compose.yml export NETWORK=$network_normalized -export NODE_VERSION=$node_version export NODE_PORT=$NODE_PORT +export SERVICE_VERSION=$node_version -# Get the network magic from the shelley-genesis.json file and pass it into the container +# Get the network magic from the shelley-genesis.json file export NETWORK_ID=$(jq -r '.networkMagic' "$config_dir/shelley-genesis.json") -# Substitute the variables in the docker-compose.yml file and start the Docker container +# Set implementation-specific env vars +if [ "$node_impl" = "dingo" ]; then + export DIR_PREFIX="dingo" + export DOCKERFILE="Dockerfile.dingo" +else + export DIR_PREFIX="node" + export DOCKERFILE="Dockerfile" +fi + +# Substitute the variables in docker-compose.yml and start the Docker container echo -e "${CYAN}Starting the Docker container...${NC}" # Use docker compose (plugin) if available, fallback to docker-compose (standalone) if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1; then @@ -506,7 +576,11 @@ else fi # Verify the container started successfully -container_name="node-$network_normalized-$node_version-container" +if [ "$node_impl" = "dingo" ]; then + container_name="dingo-$network_normalized-$node_version-container" +else + container_name="node-$network_normalized-$node_version-container" +fi # Give the container a moment to start or fail sleep 3 @@ -526,11 +600,9 @@ if [ "$container_status" != "running" ]; then # Stop and remove the failed container echo -e "${YELLOW}Cleaning up failed container...${NC}" if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1; then - NETWORK=$network_normalized NODE_VERSION=$node_version NODE_PORT=$NODE_PORT NETWORK_ID=$NETWORK_ID \ - envsubst < docker-compose.yml | docker compose -f - down 2>/dev/null || true + envsubst < docker-compose.yml | docker compose -f - down 2>/dev/null || true elif command -v docker-compose >/dev/null 2>&1; then - NETWORK=$network_normalized NODE_VERSION=$node_version NODE_PORT=$NODE_PORT NETWORK_ID=$NETWORK_ID \ - envsubst < docker-compose.yml | docker-compose -f - down 2>/dev/null || true + envsubst < docker-compose.yml | docker-compose -f - down 2>/dev/null || true fi docker rm -f "$container_name" 2>/dev/null || true