Skip to content

Conversation

patrickelectric
Copy link
Member

@patrickelectric patrickelectric commented Jul 15, 2025

Signed-off-by: Patrick José Pereira patrickelectric@gmail.com

Summary by Sourcery

Add BlueOS recorder support by incorporating its binary into the Docker image, updating the static binaries installer, and supplying a versioned bootstrap installer for different CPU architectures.

New Features:

  • Include blueos-recorder binary in the core Docker image
  • Add recorder to the static binaries installation list
  • Provide a bootstrap.sh installer script to download and install blueos-recorder for multiple architectures

Copy link

sourcery-ai bot commented Jul 15, 2025

Reviewer's Guide

This PR introduces a bootstrap installer script for the BlueOS recorder that auto-detects Linux architecture, constructs the download URL, and installs the prebuilt binary into either the active virtual environment or /usr/bin with progress feedback. It also integrates the recorder binary into the existing Docker build and static installation tooling.

Class diagram for BlueOS recorder installer script structure

classDiagram
    class BootstrapInstaller {
        +VERSION: string
        +PROJECT_NAME: string
        +REPOSITORY_ORG: string
        +REPOSITORY_NAME: string
        +REPOSITORY_URL: string
        +install()
        +detect_architecture()
        +construct_download_url()
        +determine_bin_dir()
        +download_and_install()
    }
Loading

Flow diagram for BlueOS recorder bootstrap installer script

flowchart TD
    A[Start Installation] --> B[Detect Linux Architecture]
    B --> C{Supported Architecture?}
    C -- Yes --> D[Select Build Name]
    C -- No --> E[Exit with Error]
    D --> F[Construct Download URL]
    F --> G{Virtual Environment Active?}
    G -- Yes --> H[Set BIN_DIR to $VIRTUAL_ENV/bin]
    G -- No --> I[Set BIN_DIR to /usr/bin]
    H --> J[Download Binary]
    I --> J[Download Binary]
    J --> K[Set Executable Permissions]
    K --> L[Show File Type]
    L --> M[Finish Installation]
Loading

File-Level Changes

Change Details Files
Add bootstrap installer script for BlueOS recorder
  • Created core/tools/recorder/bootstrap.sh with bash shebang and error-exit behavior
  • Implemented architecture detection for x86_64, armv7, aarch64 with unsupported fallback
  • Built remote download URL based on version and artifact naming
  • Determined installation path (virtualenv or /usr/bin) and created directory
  • Downloaded binary via wget, set executable permission, and printed file type feedback
core/tools/recorder/bootstrap.sh
Integrate recorder binary into Docker and static installer
  • Added /usr/bin/blueos-recorder to Dockerfile COPY stage
  • Included 'recorder' in the TOOLS array of install-static-binaries.sh
core/Dockerfile
core/tools/install-static-binaries.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @patrickelectric - I've reviewed your changes - here's some feedback:

  • Consider adding a CLI flag or environment variable to override the hard-coded VERSION so users can install different releases without editing the script.
  • Installing to /usr/bin will fail without root privileges—either prompt for sudo, detect elevation, or fall back to a user‐writable location like ~/.local/bin when appropriate.
  • Improve portability by checking for wget or curl and using whichever is available rather than assuming wget is installed.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding a CLI flag or environment variable to override the hard-coded VERSION so users can install different releases without editing the script.
- Installing to /usr/bin will fail without root privileges—either prompt for sudo, detect elevation, or fall back to a user‐writable location like ~/.local/bin when appropriate.
- Improve portability by checking for wget or curl and using whichever is available rather than assuming wget is installed.

## Individual Comments

### Comment 1
<location> `core/tools/recorder/bootstrap.sh:28` </location>
<code_context>
+    BUILD_NAME="aarch64-unknown-linux-musl"
+    ;;
+  *)
+    echo "Architecture: $ARCH is unsupported, please create a new issue on https://github.com/bluerobotics/BlueOS/issues"
+    exit 1
+    ;;
</code_context>

<issue_to_address>
Exit code 1 is appropriate, but consider printing supported architectures.

Including supported architectures in the error message will make it easier for users to resolve compatibility issues.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

BUILD_NAME="aarch64-unknown-linux-musl"
;;
*)
echo "Architecture: $ARCH is unsupported, please create a new issue on https://github.com/bluerobotics/BlueOS/issues"
Copy link

Choose a reason for hiding this comment

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

suggestion: Exit code 1 is appropriate, but consider printing supported architectures.

Including supported architectures in the error message will make it easier for users to resolve compatibility issues.

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
'nginx',250,"nice -18 nginx -g \"daemon off;\" -c $TOOLS_PATH/nginx/nginx.conf"
'log_zipper',250,"nice -20 $SERVICES_PATH/log_zipper/main.py '/shortcuts/system_logs/\\\\*\\\\*/\\\\*.log' --max-age-minutes 60"
'bag_of_holding',250,"$SERVICES_PATH/bag_of_holding/main.py"
'recorder',250,"blueos-recorder --recorder-path /usr/blueos/userdata/recorder"
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we add --verbose in here?

Copy link
Member

@joaoantoniocardoso joaoantoniocardoso left a comment

Choose a reason for hiding this comment

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

This seems to be working well. Testedo n Pi5 w/ 1xUSBCam (1080p) + 1xRadcam (4k + 1080p);

  • ~5% CPU use

  • 341MB in 3.4 seconds, which gives us ~100MB/s for this case

  • A small limitation, that we must consider: FoxGlove format expects baseline profile, and radcam is by default using the main profile. In the end, Foxglove can't display it:

image
  • The USB camera video was fine

  • I started and ended many files by arming/disarming, and it seems solid!


With all that said, someone should test it on a Pi4 and check the CPU usage.

@patrickelectric patrickelectric merged commit 7cd22c3 into bluerobotics:master Aug 25, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants