|
| 1 | +# SVM Deploy Action |
| 2 | + |
| 3 | +This GitHub Action deploys Solana Virtual Machine (SVM) nodes using the openSVM CLI tool. It abstracts away the complexity of SVM deployments, making it easy to integrate SVM node deployment into your CI/CD pipelines. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- 🚀 **Simple Integration**: One-step SVM deployment with minimal configuration |
| 8 | +- 🔒 **Secure**: Uses GitHub Secrets for sensitive data like SSH keys and Solana keypairs |
| 9 | +- 🎯 **Configurable**: Support for different networks, node types, and deployment options |
| 10 | +- 📊 **Detailed Logging**: Comprehensive logs for troubleshooting and monitoring |
| 11 | +- 🔄 **Flexible**: Supports additional CLI arguments for advanced use cases |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +### Basic Example |
| 16 | + |
| 17 | +```yaml |
| 18 | +name: Deploy SVM |
| 19 | + |
| 20 | +on: |
| 21 | + push: |
| 22 | + branches: [ main ] |
| 23 | + |
| 24 | +jobs: |
| 25 | + deploy: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Deploy SVM Node |
| 31 | + uses: ./.github/actions/svm-deploy |
| 32 | + with: |
| 33 | + svm-name: 'my-svm' |
| 34 | + |
| 35 | + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 36 | + network: 'devnet' |
| 37 | + node-type: 'validator' |
| 38 | +``` |
| 39 | +
|
| 40 | +### Advanced Example |
| 41 | +
|
| 42 | +```yaml |
| 43 | +name: Deploy SVM with Custom Configuration |
| 44 | + |
| 45 | +on: |
| 46 | + workflow_dispatch: |
| 47 | + inputs: |
| 48 | + svm_name: |
| 49 | + description: 'SVM name to deploy' |
| 50 | + required: true |
| 51 | + default: 'my-svm' |
| 52 | + target_host: |
| 53 | + description: 'Target host for deployment' |
| 54 | + required: true |
| 55 | + |
| 56 | + network: |
| 57 | + description: 'Network to deploy on' |
| 58 | + required: true |
| 59 | + default: 'devnet' |
| 60 | + type: choice |
| 61 | + options: |
| 62 | + - mainnet |
| 63 | + - testnet |
| 64 | + - devnet |
| 65 | + |
| 66 | +jobs: |
| 67 | + deploy: |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v4 |
| 71 | + |
| 72 | + - name: Deploy SVM Node |
| 73 | + uses: ./.github/actions/svm-deploy |
| 74 | + with: |
| 75 | + svm-name: ${{ github.event.inputs.svm_name }} |
| 76 | + host: ${{ github.event.inputs.target_host }} |
| 77 | + network: ${{ github.event.inputs.network }} |
| 78 | + node-type: 'validator' |
| 79 | + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 80 | + keypair: ${{ secrets.SOLANA_KEYPAIR }} |
| 81 | + rpc-url: ${{ secrets.RPC_URL }} |
| 82 | + verbose: true |
| 83 | + deploy-args: '--custom-flag value' |
| 84 | +``` |
| 85 | +
|
| 86 | +## Inputs |
| 87 | +
|
| 88 | +| Input | Description | Required | Default | |
| 89 | +|-------|-------------|----------|---------| |
| 90 | +| `svm-name` | Name of the SVM to deploy | ✅ | - | |
| 91 | +| `host` | Remote host to deploy to (format: user@host[:port]) | ✅ | - | |
| 92 | +| `network` | Target Solana network (mainnet, testnet, devnet) | ❌ | `mainnet` | |
| 93 | +| `node-type` | Type of node to deploy (validator, rpc) | ❌ | `validator` | |
| 94 | +| `ssh-private-key` | SSH private key for connecting to remote host | ✅ | - | |
| 95 | +| `keypair` | Solana keypair JSON content | ❌ | - | |
| 96 | +| `rpc-url` | JSON RPC URL for the cluster | ❌ | - | |
| 97 | +| `verbose` | Enable verbose logging | ❌ | `false` | |
| 98 | +| `deploy-args` | Additional CLI flags for deployment | ❌ | - | |
| 99 | + |
| 100 | +## Outputs |
| 101 | + |
| 102 | +| Output | Description | |
| 103 | +|--------|-------------| |
| 104 | +| `status` | Deployment status (success or failure) | |
| 105 | +| `logs` | Complete deployment logs | |
| 106 | + |
| 107 | +## Secrets Setup |
| 108 | + |
| 109 | +### Required Secrets |
| 110 | + |
| 111 | +1. **SSH_PRIVATE_KEY**: Private SSH key for connecting to your remote host |
| 112 | + ```bash |
| 113 | + # Generate a new SSH key pair |
| 114 | + ssh-keygen -t ed25519 -C "github-actions" -f ~/.ssh/github_actions |
| 115 | + |
| 116 | + # Add the private key to GitHub Secrets as SSH_PRIVATE_KEY |
| 117 | + cat ~/.ssh/github_actions |
| 118 | + |
| 119 | + # Add the public key to your remote host's authorized_keys |
| 120 | + cat ~/.ssh/github_actions.pub >> ~/.ssh/authorized_keys |
| 121 | + ``` |
| 122 | + |
| 123 | +### Optional Secrets |
| 124 | + |
| 125 | +2. **SOLANA_KEYPAIR**: Solana keypair JSON content |
| 126 | + ```bash |
| 127 | + # Generate a new Solana keypair |
| 128 | + solana-keygen new --no-bip39-passphrase -o keypair.json |
| 129 | + |
| 130 | + # Add the keypair content to GitHub Secrets as SOLANA_KEYPAIR |
| 131 | + cat keypair.json |
| 132 | + ``` |
| 133 | + |
| 134 | +3. **RPC_URL**: Custom RPC endpoint URL |
| 135 | + ``` |
| 136 | + # Example RPC URLs |
| 137 | + https://api.mainnet-beta.solana.com |
| 138 | + https://api.devnet.solana.com |
| 139 | + https://api.testnet.solana.com |
| 140 | + ``` |
| 141 | + |
| 142 | +## Security Considerations |
| 143 | + |
| 144 | +- **Never commit private keys or secrets** to your repository |
| 145 | +- Use GitHub Secrets for all sensitive data |
| 146 | +- Ensure your SSH private key has appropriate permissions (600) |
| 147 | +- Consider using dedicated keypairs for CI/CD deployments |
| 148 | +- Regularly rotate your SSH keys and Solana keypairs |
| 149 | + |
| 150 | +## Troubleshooting |
| 151 | + |
| 152 | +### Common Issues |
| 153 | + |
| 154 | +1. **SSH Connection Failed** |
| 155 | + - Verify the SSH private key is correct |
| 156 | + - Check that the public key is added to the remote host's authorized_keys |
| 157 | + - Ensure the host format is correct (user@host[:port]) |
| 158 | + |
| 159 | +2. **SVM Installation Failed** |
| 160 | + - Check the verbose logs for detailed error messages |
| 161 | + - Verify the SVM name is correct and available |
| 162 | + - Ensure the remote host meets system requirements |
| 163 | + |
| 164 | +3. **Network Issues** |
| 165 | + - Verify the network parameter is correct (mainnet, testnet, devnet) |
| 166 | + - Check if the specified RPC URL is accessible |
| 167 | + - Ensure firewall rules allow the necessary connections |
| 168 | + |
| 169 | +### Getting Help |
| 170 | + |
| 171 | +If you encounter issues: |
| 172 | + |
| 173 | +1. Enable verbose logging by setting `verbose: true` |
| 174 | +2. Check the action logs for detailed error messages |
| 175 | +3. Verify your secrets are correctly configured |
| 176 | +4. Consult the [openSVM CLI documentation](https://github.com/openSVM/osvm-cli) |
| 177 | + |
| 178 | +## Examples Repository |
| 179 | + |
| 180 | +For more examples and use cases, check out the [examples directory](../../../examples/) in the main repository. |
| 181 | + |
| 182 | +## Contributing |
| 183 | + |
| 184 | +Contributions are welcome! Please: |
| 185 | + |
| 186 | +1. Fork the repository |
| 187 | +2. Create a feature branch |
| 188 | +3. Make your changes |
| 189 | +4. Add tests if applicable |
| 190 | +5. Submit a pull request |
| 191 | + |
| 192 | +## License |
| 193 | + |
| 194 | +This action is licensed under the MIT License. See the [LICENSE](../../../LICENSE) file for details. |
0 commit comments