Skip to main content

A simplistic, opinionated remote update server implementing hawkBit™'s DDI API

Project description

gooseBit

OpenSSF Scorecard


A simplistic, opinionated remote update server implementing hawkBit™'s DDI API.

Deployment

Docker Compose Demo

The Docker Compose demo docker/demo/docker-compose.yml may serve as inspiration for a containerized (cloud) deployment. It uses PostgreSQL as the database and NGINX as a reverse proxy.

[!WARNING] Do not use the demo (as-is) in production!

Make sure you have Docker (and Docker Compose) installed. Then run:

docker compose -f docker/demo/docker-compose.yml up

Visit gooseBit at: https://localhost

Configuration

gooseBit can be configured through a configuration file (/etc/goosebit.yaml) or by setting environment variables. For the available options and their defaults, see goosebit.yaml. The environment variable corresponding to e.g. the poll_time YAML setting would be GOOSEBIT_POLL_TIME. Environment variables for nested settings are constructed using __ as the separator:

GOOSEBIT_DEVICE_AUTH__ENABLE=true

Alternatively, a JSON string can be assigned:

GOOSEBIT_DEVICE_AUTH='{"enable": true}'

Database

By default, SQLite is used as the database. For more sophisticated setups, PostgreSQL is supported. To use PostgreSQL, set db_uri or the GOSSEBIT_DB_URI environment variable to something like:

postgres://user:password@host:5432/db_name

Artifact Storage

The software packages managed by gooseBit are either stored on the local filesystem (artifacts_dir setting) or an S3-compatible object storage.

Assumptions

  • Devices use SWUpdate or RAUC + RAUC hawkBit Updater for managing software updates.
  • Devices send certain attributes (sw_version, hw_model, hw_revision).
  • Semantic versions are used.
  • With RAUC and multiple hardware revisions, compatible in manifest.raucm is set to something like my-board-rev4.2 or Some Board 2b.

Features

Device Registry

When a device connects to gooseBit for the first time, it is automatically added to the device registry. The server will then request the device's configuration data, including:

  • hw_model and hw_revision: Used to match compatible software.
  • sw_version: Indicates the currently installed software version.

The registry tracks each device's status, including the last online timestamp, installed software version, update state, and more.

Software Repository

Software packages (*.swu/*.raucb files) can be hosted directly on the gooseBit server or on an external server. gooseBit parses the software metadata to determine compatibility with specific hardware models and revisions.

Device Update Modes

Devices can be configured with different update modes. The default mode is Rollout.

1. Manual Update to Specified Software

Assign specific software to a device manually. Once installed, no further updates will be triggered.

2. Automatic Update to Latest Software

Automatically updates the device to the latest compatible software, based on the reported hw_model and hw_revision. Note: versions are interpreted as SemVer versions.

3. Software Rollout

Rollouts target all devices with a specified "feed" value, ensuring that the assigned software is installed on all matching devices. Rollouts also track success and error rates, with future plans for automatic aborts. If multiple rollouts exist for the same feed, the most recent rollout takes precedence.

Pause Updates

Devices can be pinned to their current software version, preventing any updates from being applied.

Real-time Update Logs

While updates are in progress, gooseBit captures real-time logs, which are accessible through the device repository.

Development with Poetry

Initial Setup

Install Poetry as described here.

Then, to install gooseBit's dependencies, run:

poetry install

Initialize the database:

poetry run aerich upgrade

Launch gooseBit:

poetry run python -m goosebit

The service is now available at: http://localhost:60053

Database

Initialize or migrate database:

poetry run aerich upgrade

After a model change create the migration:

poetry run aerich migrate

To seed some sample data (attention: drops all current data) use:

poetry run generate-sample-data

Code formatting and linting

Code is formatted using different tools

  • black and isort for *.py
  • biomejs for *.js, *.json
  • prettier for *.html, *.md, *.yml, *.yaml

Code is linted using different tools as well

  • flake8 for *.py
  • biomejs for *.js

Best to have pre-commit install git hooks that run all those tools before a commit:

poetry run pre-commit install

To manually apply the hooks to all files use:

poetry run pre-commit run --all-files

Testing

Tests are implemented using pytest. You can run all the tests with:

poetry run pytest

To run only the unit tests:

poetry run pytest tests/unit

To run only the end-to-end tests:

poetry run pytest tests/e2e

Development with Docker (and PostgreSQL)

Running the Containers

docker compose -f docker/docker-compose-dev.yml up --build

Applying the Migrations

docker exec goosebit-dev python -m aerich upgrade

Using the Interactive Debugger

You might need rlwrap to fix readline support.

Place breakpoint() before the code you want to debug. The server will reload automatically. Then, connect to remote PDB (when the breakpoint has been hit):

rlwrap telnet localhost 4444

To exit the debugger, press Ctrl + ] and then q.

Architecture

Structure

The structure of gooseBit is as follows:

  • api: Files for the API.
  • ui: Files for the UI.
    • bff: Backend for frontend API.
    • static: Static files.
    • templates: Jinja2 formatted templates.
    • nav: Navbar handler.
  • updater: DDI API handler and device update manager.
  • updates: SWUpdate/RAUC file parsing.
  • auth: Authentication functions and permission handling.
  • models: Database models.
  • db: Database config and initialization.
  • schema: Pydantic models used for API type hinting.
  • settings: Settings loader and handler.
  • storage: Storage for software artifacts.
  • telemetry: Telemetry data handlers.
  • routes: Routes for a giving endpoint, including the router.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goosebit-0.2.9.tar.gz (65.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

goosebit-0.2.9-py3-none-any.whl (108.4 kB view details)

Uploaded Python 3

File details

Details for the file goosebit-0.2.9.tar.gz.

File metadata

  • Download URL: goosebit-0.2.9.tar.gz
  • Upload date:
  • Size: 65.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.1 Linux/6.11.0-1018-azure

File hashes

Hashes for goosebit-0.2.9.tar.gz
Algorithm Hash digest
SHA256 1284bed811334af07644c42224e8f1e556646fcdd783a1351d7f16fcd45e13b4
MD5 b17fc47cd2d63e5cf8a9bcae9e173d8f
BLAKE2b-256 903225a2a09f9145c218fa1e06eb4a1c6d3228f7024f0786fd45b92f59996f43

See more details on using hashes here.

File details

Details for the file goosebit-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: goosebit-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 108.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.1 Linux/6.11.0-1018-azure

File hashes

Hashes for goosebit-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c790dcc4a6bab8fedf75d18600552fdeac90f255dea1c4507103289ae93620c0
MD5 e71ad3556434a0beb74aa538e20cb859
BLAKE2b-256 5f955cce923f791bb900e6b1cd121465902ddc149478f1bed00f4fded2b4a2cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page