Skip to content

hardwareOS Deployment

This guide covers the complete deployment workflow for hardwareOS, from building firmware images to over-the-air updates.

┌─────────────────────────────────────────────────────────────────┐
│ Deployment Pipeline │
│ │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────────┐ │
│ │ Build │───▶│ Test │───▶│ Sign │───▶│ Deploy │ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────────┘ │
│ │ │ │ │ │
│ ▼ ▼ ▼ ▼ │
│ firmware.bin Test Suite signed.bin OTA / Flash │
│ │
└─────────────────────────────────────────────────────────────────┘
Build TypePurposeSigningTarget
debugDevelopmentNoneDev devices
stagingQA testingStaging keyTest devices
productionCustomer releaseProduction keyAll devices

Ensure you have completed the Development Setup.

Terminal window
# Debug build
./tools/build.sh --type debug
# Staging build
./tools/build.sh --type staging
# Production build (requires signing key)
./tools/build.sh --type production --sign
dist/
├── firmware-debug-v1.2.3.bin # Debug firmware
├── firmware-staging-v1.2.3.bin # Staging firmware
├── firmware-v1.2.3.bin # Production firmware
├── manifest.json # Update manifest
└── checksums.sha256 # File checksums

For devices without existing firmware:

Terminal window
# Connect RS-1 via USB (hold BOOT button while powering on)
./tools/flash.sh --initial dist/firmware-v1.2.3.bin
# Verify successful flash
./tools/verify.sh --device /dev/ttyUSB0

If a device is bricked:

Terminal window
# Enter recovery mode (hold BOOT + RESET)
./tools/flash.sh --recovery dist/firmware-v1.2.3.bin
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Device │ │ CDN/R2 │ │ Update │
│ Fleet │◀───────▶│ Storage │◀───────▶│ Service │
└─────────────┘ └─────────────┘ └─────────────┘
│ │
│ Check for updates │
│──────────────────────────────────────────────▶│
│ │
│ Update manifest │
│◀──────────────────────────────────────────────│
│ │
│ Download firmware │
│◀─────────────────────┤ │
│ │
│ Report status │
│──────────────────────────────────────────────▶│
Terminal window
# Upload to staging
./tools/publish.sh --env staging dist/firmware-staging-v1.2.3.bin
# Verify staging deployment
./tools/rollout.sh --env staging --check
# Promote to production (phased rollout)
./tools/publish.sh --env production \
--firmware dist/firmware-v1.2.3.bin \
--rollout 10% # Start with 10% of devices
Terminal window
# Check rollout status
./tools/rollout.sh --status
# Increase rollout percentage
./tools/rollout.sh --increase 25% # Now at 25%
# Complete rollout
./tools/rollout.sh --complete
# Emergency rollback
./tools/rollout.sh --rollback

The update manifest describes available firmware versions:

{
"version": "1.2.3",
"channel": "stable",
"firmware": {
"url": "https://files.optic.works/firmware/v1.2.3/firmware.bin",
"sha256": "abc123...",
"size": 12345678
},
"signature": "ed25519:...",
"releaseNotes": "Bug fixes and performance improvements",
"minVersion": "1.0.0",
"rolloutPercentage": 100
}
Key TypeUsageStorage
DevelopmentDebug buildsLocal .keys/ directory
StagingQA buildsGitHub Secrets
ProductionCustomer buildsHardware Security Module (HSM)
Terminal window
# Debug (local key)
./tools/sign.sh --key dev dist/firmware-debug.bin
# Production (requires HSM access)
./tools/sign.sh --key production --hsm dist/firmware.bin
Terminal window
# Verify firmware signature
./tools/verify-sig.sh dist/firmware-v1.2.3.bin
# Output:
# Signature: VALID
# Signed by: production-key-2024
# Timestamp: 2024-01-15T10:30:00Z
Update Server: https://updates-staging.optic.works
CDN: https://files-staging.optic.works
Update Server: https://updates.optic.works
CDN: https://files.optic.works
  • All tests passing in CI
  • Code review approved
  • Version number updated in VERSION
  • Release notes prepared
  • QA sign-off on staging
  • Build production firmware
  • Sign with production key
  • Upload to CDN
  • Publish update manifest
  • Start phased rollout (10%)
  • Monitor error rates
  • Check device telemetry
  • Verify update success rate >99%
  • Complete rollout to 100%

Monitor device health during rollout:

Terminal window
# View real-time device status
./tools/monitor.sh --env production
# Check specific device
./tools/device-status.sh --id DEVICE123
MetricThresholdAction if Exceeded
Update failure rate>2%Pause rollout
Device crash rate>0.5%Rollback immediately
CPU usage>80%Investigate
Memory usage>90%Investigate

If issues are detected:

Terminal window
# Immediate rollback
./tools/rollout.sh --rollback
# Devices will revert to previous version
# Check status
./tools/rollout.sh --status

GitHub Actions handles automated builds:

.github/workflows/build.yml
name: Build Firmware
on:
push:
branches: [main]
release:
types: [published]
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Build
run: ./tools/build.sh --type staging
- name: Test
run: ./tools/test.sh
- name: Sign
run: ./tools/sign.sh --key staging
env:
SIGNING_KEY: ${{ secrets.STAGING_SIGNING_KEY }}
- name: Upload
run: ./tools/publish.sh --env staging
  1. Check device connectivity:

    Terminal window
    ./tools/device-status.sh --id DEVICE123
  2. Force update check:

    Terminal window
    ssh root@device-ip '/opt/hardwareos/bin/update-check --force'
  3. Review device logs:

    Terminal window
    ssh root@device-ip 'journalctl -u hardwareos-updater'
Terminal window
# Reset update state
ssh root@device-ip '/opt/hardwareos/bin/update-reset'
# Retry update
ssh root@device-ip '/opt/hardwareos/bin/update-check'
  • Runbook: docs/runbooks/deployment.md
  • Incident Response: docs/runbooks/incident-response.md
  • On-Call Schedule: Check PagerDuty