# VM Deployment Scripts This directory contains scripts for deploying and managing Besu nodes on Azure Virtual Machines (VMs) or Virtual Machine Scale Sets (VMSS). ## Scripts ### Deployment Scripts - **`deploy-vm-network.sh`** - Deploy Besu network on VMs using Terraform - **`setup-vm.sh`** - Setup individual VM with Docker and Besu - **`setup-cloud-init.sh`** - Generate cloud-init configuration ### Management Scripts - **`monitor-vm.sh`** - Monitor all VMs and Besu containers - **`update-vm-config.sh`** - Update Besu configuration on a VM - **`get-vm-ips.sh`** - Get IP addresses of all VMs - **`scale-vmss.sh`** - Scale VM Scale Set up or down ### Validation Scripts - **`validate-vm-deployment.sh`** - Validate VM deployment - **`health-check-vm.sh`** - Health check for VM-based Besu nodes - **`run-all-checks.sh`** - Run all validation and health checks ### Backup/Restore Scripts - **`backup-vm.sh`** - Backup Besu data from a VM - **`restore-vm.sh`** - Restore Besu data to a VM ## Usage ### Deploy Network ```bash ./scripts/vm-deployment/deploy-vm-network.sh ``` ### Setup Individual VM ```bash ./scripts/vm-deployment/setup-vm.sh validator 0 ``` ### Monitor VMs ```bash ./scripts/vm-deployment/monitor-vm.sh ``` ### Validate Deployment ```bash ./scripts/vm-deployment/validate-vm-deployment.sh ``` ### Health Check ```bash ./scripts/vm-deployment/health-check-vm.sh ``` ### Get VM IPs ```bash ./scripts/vm-deployment/get-vm-ips.sh ``` ### Scale VMSS ```bash ./scripts/vm-deployment/scale-vmss.sh besu-rpc-vmss 5 ``` ### Backup VM ```bash ./scripts/vm-deployment/backup-vm.sh ``` ### Restore VM ```bash ./scripts/vm-deployment/restore-vm.sh ``` ### Run All Checks ```bash ./scripts/vm-deployment/run-all-checks.sh ``` ## Environment Variables Most scripts support the following environment variables: - `RESOURCE_GROUP` - Azure resource group name (default: `defi-oracle-mainnet-rg`) - `CLUSTER_NAME` - Cluster name (default: `defi-oracle-aks`) - `KEY_VAULT_NAME` - Key Vault name (default: `defi-oracle-kv`) - `VALIDATOR_COUNT` - Number of validators (default: `2`) - `SENTRY_COUNT` - Number of sentries (default: `2`) - `RPC_COUNT` - Number of RPC nodes (default: `2`) ## Prerequisites - Azure CLI installed and configured - SSH key pair for VM access - Terraform >= 1.0 (for deployment scripts) - `jq` for JSON parsing - `curl` for HTTP requests ## Examples ### Deploy Network ```bash export RESOURCE_GROUP="defi-oracle-mainnet-rg" export SSH_PUBLIC_KEY=$(cat ~/.ssh/id_rsa.pub) ./scripts/vm-deployment/deploy-vm-network.sh ``` ### Monitor Specific VM ```bash export VM_IP="20.123.45.67" ./scripts/vm-deployment/monitor-vm.sh ``` ### Scale RPC VMSS ```bash export RESOURCE_GROUP="defi-oracle-mainnet-rg" ./scripts/vm-deployment/scale-vmss.sh besu-rpc-vmss 5 ``` ## Troubleshooting See [VM Deployment Troubleshooting Guide](../docs/VM_DEPLOYMENT_TROUBLESHOOTING.md) for common issues and solutions. ## Related Documentation - [VM Deployment Guide](../docs/VM_DEPLOYMENT.md) - [VM Deployment Quickstart](../docs/VM_DEPLOYMENT_QUICKSTART.md) - [VM Deployment Checklist](../docs/VM_DEPLOYMENT_CHECKLIST.md) - [Deployment Comparison](../docs/DEPLOYMENT_COMPARISON.md)