For Localnet, which is focused on development and operator workloads, we want to avoid having to BUILD FROM SOURCE every time we spin up a new docker container, since the build process itself is very resource intensive and slows down the development REPL. For this reason, all Localnet deployments are done from pre-compiled binaries.
Anza publishes new releases of Agave at https://github.com/anza-xyz/agave/releases. However, they don't publish pre-built binaries for Apple Silicon running virtualized hosts, which is not an uncommon setup for developer workstations.
To accomodate these developers and operators, we pre-compile binaries for Ubuntu on Apple Silicon ARM architecture and store them in an accessible place so Docker and Ansible can use them in their Localnet.
Storage Setup
We'll use an AWS S3 bucket and IAM user for storing the Solana CLI binaries.
Create S3 Bucket
Go to your AWS account and create an S3 bucket. We named ours solv-store . We'll use this bucket to upload and download our binaries.
IAM Credentials Setup
To securely create AWS credentials for uploading files to your S3 bucket, you need to setup a policy, a user, credentials and link them together, like this:
Create an IAM Policy with Least Privilege
Define a policy that grants access only to the specific S3 bucket and the required actions. The policy shown below allows uploading (PutObject) and downloading (GetObject) files to/from the bucket, which is what we need:
If you are user 1Password as your password manager, you have the great security option of installing the 1Password CLI to manage access to your credentials. This is the recommended way to store and access credentials, and the guide to install the CLI is HERE.
Not Using 1Password
If you are NOT using 1Password because you are using another password manager... okay:
Download URL
After a the scrip runs, the new build will be uploaded to the S3 bucket and available to download at this address and accessible to you. For example, the build binaries for Agave 2.1.21 live here:
If the binaries for this version already exist in the S3 bucket, the script will exit without changes.
Note that the binaries are not downloaded into any particular Localnet node. Instead, they are ready to be downloaded and installed into any node we want in the cluster without needing to build-from-source every time.
# Navigate to the script dir
cd solana-local-cluster/build-solana-cli
# Set credentials for script
export SOLANA_BINARY_UPLOAD_AWS_ACCESS_KEY_ID="op://Solana Validator/Hayek Validator Solana Local Cluster/SOLANA_BINARY_UPLOAD_AWS_ACCESS_KEY_ID"
export SOLANA_BINARY_UPLOAD_AWS_SECRET_ACCESS_KEY="op://Solana Validator/Hayek Validator Solana Local Cluster/SOLANA_BINARY_UPLOAD_AWS_SECRET_ACCESS_KEY"
# Run script with the 1Password CLI op run command
op run -- ./run-build-in-container.sh agave 2.1.21
# Navigate to the script dir
cd solana-local-cluster/build-solana-cli
# Set credentials for script
export SOLANA_BINARY_UPLOAD_AWS_ACCESS_KEY_ID="<YOUR_AWS_ACCESS_KEY_ID_HERE>"
export SOLANA_BINARY_UPLOAD_AWS_SECRET_ACCESS_KEY="<YOUR_AWS_SECRET_ACCESS_KEY_HERE>"
# Run script
./run-build-in-container.sh jito-solana 2.1.21