|
| 1 | +# Bigbox GitHub Actions Runner Setup |
| 2 | + |
| 3 | +This document explains how to set up the bigbox server as a self-hosted GitHub Actions runner for faster CI/CD pipeline execution. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The bigbox runner is configured to use the following labels: |
| 8 | +- `self-hosted` - Indicates it's not a GitHub-hosted runner |
| 9 | +- `linux` - Indicates the operating system |
| 10 | +- `bigbox` - Custom label for this specific runner |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | + |
| 14 | +- Ubuntu 24.04 LTS server (bigbox.terraphim.cloud) |
| 15 | +- Docker and Docker Compose installed |
| 16 | +- Rust toolchain (1.87.0+) |
| 17 | +- Node.js (18+) |
| 18 | +- Sufficient disk space for caching |
| 19 | +- SSH access for management |
| 20 | + |
| 21 | +## Runner Registration |
| 22 | + |
| 23 | +The runner should be registered with these labels: |
| 24 | +```bash |
| 25 | +./config.sh --url https://github.com/terraphim/terraphim-ai --token <TOKEN> --labels self-hosted,linux,bigbox |
| 26 | +``` |
| 27 | + |
| 28 | +## System Requirements |
| 29 | + |
| 30 | +### Minimum Resources |
| 31 | +- **CPU**: 4 cores |
| 32 | +- **Memory**: 8GB RAM |
| 33 | +- **Storage**: 50GB available space |
| 34 | +- **Network**: Stable internet connection |
| 35 | + |
| 36 | +### Recommended Resources |
| 37 | +- **CPU**: 8+ cores |
| 38 | +- **Memory**: 16GB+ RAM |
| 39 | +- **Storage**: 100GB+ SSD |
| 40 | +- **Network**: High bandwidth for dependency downloads |
| 41 | + |
| 42 | +## Installed Dependencies |
| 43 | + |
| 44 | +The runner should have these dependencies pre-installed: |
| 45 | + |
| 46 | +#### System Dependencies |
| 47 | +```bash |
| 48 | +sudo apt-get update |
| 49 | +sudo apt-get install -y \ |
| 50 | + build-essential \ |
| 51 | + clang \ |
| 52 | + libclang-dev \ |
| 53 | + llvm-dev \ |
| 54 | + pkg-config \ |
| 55 | + libssl-dev \ |
| 56 | + python3 \ |
| 57 | + make \ |
| 58 | + g++ \ |
| 59 | + libcairo2-dev \ |
| 60 | + libpango1.0-dev \ |
| 61 | + libjpeg-dev \ |
| 62 | + libgif-dev \ |
| 63 | + librsvg2-dev \ |
| 64 | + libnss3-dev \ |
| 65 | + libatk-bridge2.0-dev \ |
| 66 | + libdrm2 \ |
| 67 | + libxkbcommon-dev \ |
| 68 | + libxcomposite-dev \ |
| 69 | + libxdamage-dev \ |
| 70 | + libxrandr-dev \ |
| 71 | + libgbm-dev \ |
| 72 | + libxss-dev \ |
| 73 | + libasound2-dev |
| 74 | +``` |
| 75 | + |
| 76 | +#### Rust Toolchain |
| 77 | +```bash |
| 78 | +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 79 | +source ~/.cargo/env |
| 80 | +rustup default 1.87.0 |
| 81 | +rustup component add rustfmt clippy |
| 82 | +``` |
| 83 | + |
| 84 | +#### Node.js |
| 85 | +```bash |
| 86 | +curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - |
| 87 | +sudo apt-get install -y nodejs |
| 88 | +``` |
| 89 | + |
| 90 | +## Workflow Optimizations |
| 91 | + |
| 92 | +The bigbox runner enables several optimizations: |
| 93 | + |
| 94 | +1. **Faster Build Times**: Local dependencies and toolchain |
| 95 | +2. **Better Caching**: Persistent disk storage for Cargo and npm caches |
| 96 | +3. **Reduced Network Overhead**: No need to download dependencies each run |
| 97 | +4. **Parallel Execution**: Multiple jobs can run simultaneously |
| 98 | + |
| 99 | +## Monitoring |
| 100 | + |
| 101 | +### Runner Status |
| 102 | +Check runner status in GitHub Actions settings or via: |
| 103 | +```bash |
| 104 | +./run.sh --status |
| 105 | +``` |
| 106 | + |
| 107 | +### System Monitoring |
| 108 | +Monitor system resources: |
| 109 | +```bash |
| 110 | +htop |
| 111 | +df -h |
| 112 | +free -h |
| 113 | +``` |
| 114 | + |
| 115 | +## Troubleshooting |
| 116 | + |
| 117 | +### Common Issues |
| 118 | + |
| 119 | +1. **Runner not picking up jobs** |
| 120 | + - Check runner status: `./run.sh --status` |
| 121 | + - Verify labels match workflow requirements |
| 122 | + - Check network connectivity to GitHub |
| 123 | + |
| 124 | +2. **Out of disk space** |
| 125 | + - Clean cargo cache: `cargo clean` |
| 126 | + - Clean npm cache: `npm cache clean --force` |
| 127 | + - Remove old Docker images: `docker system prune -a` |
| 128 | + |
| 129 | +3. **Permission issues** |
| 130 | + - Ensure runner has proper file permissions |
| 131 | + - Check Docker socket access: `sudo usermod -aG docker $USER` |
| 132 | + |
| 133 | +### Logs |
| 134 | + |
| 135 | +Runner logs are located at: |
| 136 | +``` |
| 137 | +/home/runner/_diag/ |
| 138 | +``` |
| 139 | + |
| 140 | +System logs: |
| 141 | +```bash |
| 142 | +journalctl -u github-runner -f |
| 143 | +``` |
| 144 | + |
| 145 | +## Security Considerations |
| 146 | + |
| 147 | +- Runner runs with the permissions of the configured user |
| 148 | +- Ensure the runner user has minimum required permissions |
| 149 | +- Regularly update runner software |
| 150 | +- Monitor runner access and usage |
| 151 | +- Use fine-grained personal access tokens (PATs) |
| 152 | + |
| 153 | +## Performance Tuning |
| 154 | + |
| 155 | +### Cargo Configuration |
| 156 | +Create `~/.cargo/config.toml`: |
| 157 | +```toml |
| 158 | +[build] |
| 159 | +jobs = 4 |
| 160 | + |
| 161 | +[target.x86_64-unknown-linux-gnu] |
| 162 | +rustflags = ["-C", "target-cpu=native"] |
| 163 | +``` |
| 164 | + |
| 165 | +### npm Configuration |
| 166 | +```bash |
| 167 | +npm config set cache ~/.npm-cache |
| 168 | +npm config set prefer-offline true |
| 169 | +``` |
| 170 | + |
| 171 | +### Docker Configuration |
| 172 | +```bash |
| 173 | +{ |
| 174 | + "storage-driver": "overlay2", |
| 175 | + "log-driver": "json-file", |
| 176 | + "log-opts": { |
| 177 | + "max-size": "10m", |
| 178 | + "max-file": "3" |
| 179 | + } |
| 180 | +} |
| 181 | +``` |
| 182 | + |
| 183 | +## Maintenance |
| 184 | + |
| 185 | +### Weekly Tasks |
| 186 | +- Update runner software |
| 187 | +- Clean old caches and artifacts |
| 188 | +- Check disk space usage |
| 189 | +- Review runner performance metrics |
| 190 | + |
| 191 | +### Monthly Tasks |
| 192 | +- Update system dependencies |
| 193 | +- Review and rotate access tokens |
| 194 | +- Audit runner permissions |
| 195 | +- Update Rust and Node.js versions |
| 196 | + |
| 197 | +## Contact |
| 198 | + |
| 199 | +For issues with the bigbox runner setup: |
| 200 | +- Check GitHub Actions documentation |
| 201 | +- Review system logs |
| 202 | +- Contact the infrastructure team |
0 commit comments