Skip to content

Commit c37234f

Browse files
authored
Merge pull request #209 from terraphim/feature/ci-optimization-bigbox
Feature/ci optimization bigbox
2 parents 91570be + be96dca commit c37234f

12 files changed

Lines changed: 471 additions & 54 deletions

.github/BIGBOX_RUNNER_SETUP.md

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
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

.github/workflows/ci-native.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency:
1919

2020
jobs:
2121
setup:
22-
runs-on: ubuntu-latest
22+
runs-on: [self-hosted, linux, bigbox]
2323
outputs:
2424
cache-key: ${{ steps.cache.outputs.key }}
2525
ubuntu-versions: ${{ steps.ubuntu.outputs.versions }}
@@ -55,8 +55,9 @@ jobs:
5555
fi
5656
5757
lint-and-format:
58-
runs-on: ubuntu-latest
58+
runs-on: [self-hosted, linux, bigbox]
5959
needs: [setup]
60+
timeout-minutes: 15 # Reduced timeout with faster runner
6061

6162
steps:
6263
- name: Checkout code
@@ -102,7 +103,7 @@ jobs:
102103

103104
build-rust:
104105
needs: [setup, build-frontend]
105-
runs-on: ubuntu-latest
106+
runs-on: [self-hosted, linux, bigbox]
106107
strategy:
107108
fail-fast: false
108109
matrix:
@@ -256,7 +257,7 @@ jobs:
256257
cache-key: ${{ needs.setup.outputs.cache-key }}
257258

258259
test-suite:
259-
runs-on: ubuntu-latest
260+
runs-on: [self-hosted, linux, bigbox]
260261
needs: [setup, build-rust]
261262

262263
steps:
@@ -310,7 +311,7 @@ jobs:
310311
run: ./scripts/ci-check-tests.sh
311312

312313
test-desktop:
313-
runs-on: ubuntu-latest
314+
runs-on: [self-hosted, linux, bigbox]
314315
needs: [setup, build-frontend]
315316
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'desktop')
316317

@@ -368,7 +369,7 @@ jobs:
368369
secrets: inherit # pragma: allowlist secret
369370

370371
package-repository:
371-
runs-on: ubuntu-latest
372+
runs-on: [self-hosted, linux, bigbox]
372373
needs: [setup, build-rust]
373374
if: github.event_name != 'pull_request'
374375
strategy:
@@ -403,7 +404,7 @@ jobs:
403404
retention-days: 90
404405

405406
security-scan:
406-
runs-on: ubuntu-latest
407+
runs-on: [self-hosted, linux, bigbox]
407408
needs: build-docker
408409
if: github.event_name != 'pull_request'
409410

@@ -422,7 +423,7 @@ jobs:
422423
sarif_file: 'trivy-results.sarif'
423424

424425
release:
425-
runs-on: ubuntu-latest
426+
runs-on: [self-hosted, linux, bigbox]
426427
needs: [build-rust, build-docker, build-tauri, test-suite, security-scan]
427428
if: startsWith(github.ref, 'refs/tags/')
428429

@@ -496,7 +497,7 @@ jobs:
496497
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
497498

498499
cleanup:
499-
runs-on: ubuntu-latest
500+
runs-on: [self-hosted, linux, bigbox]
500501
needs: [build-rust, build-docker, build-tauri, test-suite]
501502
if: always() && github.event_name == 'pull_request'
502503

@@ -512,7 +513,7 @@ jobs:
512513
continue-on-error: true
513514

514515
summary:
515-
runs-on: ubuntu-latest
516+
runs-on: [self-hosted, linux, bigbox]
516517
needs: [setup, build-frontend, build-rust, build-docker, build-tauri, test-suite]
517518
if: always()
518519

.github/workflows/ci-optimized.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency:
1919

2020
jobs:
2121
setup:
22-
runs-on: ubuntu-latest
22+
runs-on: [self-hosted, linux, bigbox]
2323
outputs:
2424
cache-key: ${{ steps.cache.outputs.key }}
2525
ubuntu-versions: ${{ steps.ubuntu.outputs.versions }}
@@ -70,7 +70,7 @@ jobs:
7070
fi
7171
7272
build-base-image:
73-
runs-on: ubuntu-latest
73+
runs-on: [self-hosted, linux, bigbox]
7474
needs: setup
7575
if: needs.setup.outputs.should-build == 'true'
7676
outputs:
@@ -114,7 +114,7 @@ jobs:
114114
retention-days: 1
115115

116116
lint-and-format:
117-
runs-on: ubuntu-latest
117+
runs-on: [self-hosted, linux, bigbox]
118118
needs: [setup, build-base-image]
119119
if: needs.setup.outputs.should-build == 'true'
120120

@@ -157,7 +157,7 @@ jobs:
157157
cache-key: ${{ needs.setup.outputs.cache-key }}
158158

159159
build-rust:
160-
runs-on: ubuntu-latest
160+
runs-on: [self-hosted, linux, bigbox]
161161
needs: [setup, build-base-image, build-frontend, lint-and-format]
162162
if: needs.setup.outputs.should-build == 'true'
163163
strategy:
@@ -235,7 +235,7 @@ jobs:
235235
retention-days: 30
236236

237237
test:
238-
runs-on: ubuntu-latest
238+
runs-on: [self-hosted, linux, bigbox]
239239
needs: [setup, build-base-image, build-rust]
240240
if: needs.setup.outputs.should-build == 'true'
241241

@@ -264,7 +264,7 @@ jobs:
264264
summary:
265265
needs: [lint-and-format, build-frontend, build-rust, test]
266266
if: always()
267-
runs-on: ubuntu-latest
267+
runs-on: [self-hosted, linux, bigbox]
268268

269269
steps:
270270
- name: Check all jobs succeeded

.github/workflows/claude-code-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
# github.event.pull_request.user.login == 'new-developer' ||
1919
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
2020

21-
runs-on: ubuntu-latest
21+
runs-on: [self-hosted, linux, bigbox]
2222
permissions:
2323
contents: read
2424
pull-requests: read

0 commit comments

Comments
 (0)