DEV Community

esteblock
esteblock

Posted on

Managing different Soroban CLI versions

Sometimes you might want to manage different soroban CLI versions, in order to work with different projects in your computer.

Or maybe, sometimes there is a last minute upgrade you want to try, but you don't want to change your computer's configuration.

How can we solve this?

The Soroban Preview Docker Image

The soroban-preview-docker images are Docker images with the 4 main necessary configurations in order to run soroban CLI: 1) An Ubuntu Linux manchine 2) Rust & Cargo installed, 3) Node installed, and 4) The desired soroban CLI version.

You can check how this images are built, by checking this esteblock/soroban-preview:20.1.0 Dockerfile

How to use this together with a Quickstart Image node?

Check how we do it in Soroswap: We have 3 files:

1.- The preview_version.json file, where we fix both the quickstart and the soroban-preview docker images versions

2.- The quickstart.sh bash script that Creates a common docker network and opens both Docker containers.

3.- The run.sh bash script that helps us open the desired (and already running) soroban preview docker container

Run the Containers:

bash scripts/quickstart.sh
bash scripts/run.sh

Enter fullscreen mode Exit fullscreen mode

Do it your self.

1) Create a common Docker Network, so both Docker containers (Stellar Quickstart & Soroban Preview) can talk to each other

docker network create soroban-network
Enter fullscreen mode Exit fullscreen mode

2) Open a Docker Container with the Soroban Preview Docker image

docker run -dti \
  --volume ${currentDir}:/workspace \
  --name soroban-preview-${previewVersion} \
  -p 8001:8000 \
  --ipc=host \
  --network soroban-network \
  esteblock/soroban-preview:${previewVersion}
Enter fullscreen mode Exit fullscreen mode

3) Open a Stellar Quickstart Docker Container

# Run the stellar quickstart image
docker run --rm -ti \
  --name stellar \
  --network soroban-network \
  -p 8000:8000 \
  stellar/quickstart:${quickstartHash} \
  $ARGS \
  --enable-soroban-rpc \
  --protocol-version 20 \
  --enable-soroban-diagnostic-events \
  "$@" # Pass through args from the CLI
Enter fullscreen mode Exit fullscreen mode

Top comments (0)