Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 202 additions & 0 deletions .github/BIGBOX_RUNNER_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
# Bigbox GitHub Actions Runner Setup

This document explains how to set up the bigbox server as a self-hosted GitHub Actions runner for faster CI/CD pipeline execution.

## Overview

The bigbox runner is configured to use the following labels:
- `self-hosted` - Indicates it's not a GitHub-hosted runner
- `linux` - Indicates the operating system
- `bigbox` - Custom label for this specific runner

## Prerequisites

- Ubuntu 24.04 LTS server (bigbox.terraphim.cloud)
- Docker and Docker Compose installed
- Rust toolchain (1.87.0+)
- Node.js (18+)
- Sufficient disk space for caching
- SSH access for management

Comment on lines +15 to +20

Copilot AI Oct 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify whether Compose v2 (docker compose plugin) is required and add install/verification steps (e.g., docker compose version) so runner operators know how to satisfy this prerequisite.

Suggested change
- Docker and Docker Compose installed
- Rust toolchain (1.87.0+)
- Node.js (18+)
- Sufficient disk space for caching
- SSH access for management
- Docker and Docker Compose v2 (the Docker Compose plugin) installed
- Rust toolchain (1.87.0+)
- Node.js (18+)
- Sufficient disk space for caching
- SSH access for management
### Docker Compose v2 Installation & Verification
Ensure you have Docker Compose v2 (the Docker Compose plugin) installed. You can verify this by running:
```bash
docker compose version

The output should show a version starting with Docker Compose version v2.x.x. If you see docker-compose (with a hyphen) or a version below v2, you need to upgrade.

Install/Upgrade Docker Compose v2:

  • If you installed Docker via apt or the official Docker repository, Docker Compose v2 is usually included.
  • To manually install or upgrade, follow the official guide: https://docs.docker.com/compose/install/
  • On Ubuntu, you can ensure the plugin is installed with:
    sudo apt-get update
    sudo apt-get install docker-compose-plugin
  • After installation, verify again with docker compose version.

Copilot uses AI. Check for mistakes.
## Runner Registration

The runner should be registered with these labels:
```bash
./config.sh --url https://github.com/terraphim/terraphim-ai --token <TOKEN> --labels self-hosted,linux,bigbox
```

## System Requirements

### Minimum Resources
- **CPU**: 4 cores
- **Memory**: 8GB RAM
- **Storage**: 50GB available space
- **Network**: Stable internet connection

### Recommended Resources
- **CPU**: 8+ cores
- **Memory**: 16GB+ RAM
- **Storage**: 100GB+ SSD
- **Network**: High bandwidth for dependency downloads

## Installed Dependencies

The runner should have these dependencies pre-installed:

#### System Dependencies
```bash
sudo apt-get update
sudo apt-get install -y \
build-essential \
clang \
libclang-dev \
llvm-dev \
pkg-config \
libssl-dev \
python3 \
make \
g++ \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
libnss3-dev \
libatk-bridge2.0-dev \
libdrm2 \
libxkbcommon-dev \
libxcomposite-dev \
libxdamage-dev \
libxrandr-dev \
libgbm-dev \
libxss-dev \
libasound2-dev
```

#### Rust Toolchain
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
rustup default 1.87.0
Comment on lines +77 to +80

Copilot AI Oct 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinning the default toolchain here can drift from the project configuration; consider referencing the repo’s rust-toolchain(.toml) or using rustup default stable (and documenting the minimum supported Rust version) to keep the runner aligned with the codebase.

Suggested change
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
rustup default 1.87.0
> **Note:** The runner should use the Rust toolchain specified in the project's `rust-toolchain` or `rust-toolchain.toml` file if present. If not, use the stable toolchain. The minimum supported Rust version is 1.87.0.
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
# Use the toolchain file if present, otherwise default to stable
if [ -f rust-toolchain ] || [ -f rust-toolchain.toml ]; then
rustup show | grep -q "Default toolchain" || true
# This will automatically use the toolchain specified in the file when building
else
rustup default stable
fi

Copilot uses AI. Check for mistakes.
rustup component add rustfmt clippy
```

#### Node.js
```bash
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
```

## Workflow Optimizations

The bigbox runner enables several optimizations:

1. **Faster Build Times**: Local dependencies and toolchain
2. **Better Caching**: Persistent disk storage for Cargo and npm caches
3. **Reduced Network Overhead**: No need to download dependencies each run
4. **Parallel Execution**: Multiple jobs can run simultaneously

## Monitoring

### Runner Status
Check runner status in GitHub Actions settings or via:
```bash
./run.sh --status
```

### System Monitoring
Monitor system resources:
```bash
htop
df -h
free -h
```

## Troubleshooting

### Common Issues

1. **Runner not picking up jobs**
- Check runner status: `./run.sh --status`
- Verify labels match workflow requirements
- Check network connectivity to GitHub

2. **Out of disk space**
- Clean cargo cache: `cargo clean`
- Clean npm cache: `npm cache clean --force`
- Remove old Docker images: `docker system prune -a`

3. **Permission issues**
- Ensure runner has proper file permissions
- Check Docker socket access: `sudo usermod -aG docker $USER`

### Logs

Runner logs are located at:
```
/home/runner/_diag/
```

System logs:
```bash
journalctl -u github-runner -f
```

## Security Considerations

- Runner runs with the permissions of the configured user
- Ensure the runner user has minimum required permissions
- Regularly update runner software
- Monitor runner access and usage
- Use fine-grained personal access tokens (PATs)

## Performance Tuning

### Cargo Configuration
Create `~/.cargo/config.toml`:
```toml
[build]
jobs = 4

[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "target-cpu=native"]
```

### npm Configuration
```bash
npm config set cache ~/.npm-cache
npm config set prefer-offline true
```

### Docker Configuration
```bash
{
"storage-driver": "overlay2",
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
```

## Maintenance

### Weekly Tasks
- Update runner software
- Clean old caches and artifacts
- Check disk space usage
- Review runner performance metrics

### Monthly Tasks
- Update system dependencies
- Review and rotate access tokens
- Audit runner permissions
- Update Rust and Node.js versions

## Contact

For issues with the bigbox runner setup:
- Check GitHub Actions documentation
- Review system logs
- Contact the infrastructure team
21 changes: 11 additions & 10 deletions .github/workflows/ci-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:

jobs:
setup:
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
outputs:
cache-key: ${{ steps.cache.outputs.key }}
ubuntu-versions: ${{ steps.ubuntu.outputs.versions }}
Expand Down Expand Up @@ -55,8 +55,9 @@ jobs:
fi

lint-and-format:
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
needs: [setup]
timeout-minutes: 15 # Reduced timeout with faster runner

steps:
- name: Checkout code
Expand Down Expand Up @@ -102,7 +103,7 @@ jobs:

build-rust:
needs: [setup, build-frontend]
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -256,7 +257,7 @@ jobs:
cache-key: ${{ needs.setup.outputs.cache-key }}

test-suite:
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
needs: [setup, build-rust]

steps:
Expand Down Expand Up @@ -310,7 +311,7 @@ jobs:
run: ./scripts/ci-check-tests.sh

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

Expand Down Expand Up @@ -368,7 +369,7 @@ jobs:
secrets: inherit # pragma: allowlist secret

package-repository:
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
needs: [setup, build-rust]
if: github.event_name != 'pull_request'
strategy:
Expand Down Expand Up @@ -403,7 +404,7 @@ jobs:
retention-days: 90

security-scan:
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
needs: build-docker
if: github.event_name != 'pull_request'

Expand All @@ -422,7 +423,7 @@ jobs:
sarif_file: 'trivy-results.sarif'

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

Expand Down Expand Up @@ -496,7 +497,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

Expand All @@ -512,7 +513,7 @@ jobs:
continue-on-error: true

summary:
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
needs: [setup, build-frontend, build-rust, build-docker, build-tauri, test-suite]
if: always()

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci-optimized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:

jobs:
setup:
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
outputs:
cache-key: ${{ steps.cache.outputs.key }}
ubuntu-versions: ${{ steps.ubuntu.outputs.versions }}
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
fi

build-base-image:
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
needs: setup
if: needs.setup.outputs.should-build == 'true'
outputs:
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
retention-days: 1

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

Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
cache-key: ${{ needs.setup.outputs.cache-key }}

build-rust:
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
needs: [setup, build-base-image, build-frontend, lint-and-format]
if: needs.setup.outputs.should-build == 'true'
strategy:
Expand Down Expand Up @@ -235,7 +235,7 @@ jobs:
retention-days: 30

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

Expand Down Expand Up @@ -264,7 +264,7 @@ jobs:
summary:
needs: [lint-and-format, build-frontend, build-rust, test]
if: always()
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]

steps:
- name: Check all jobs succeeded
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

runs-on: ubuntu-latest
runs-on: [self-hosted, linux, bigbox]
permissions:
contents: read
pull-requests: read
Expand Down
Loading
Loading