Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bootc-api

A lightweight REST API that exposes bootc status --json over HTTP, making it easy for dashboards, monitoring systems, or other services to query the status of a bootc-managed system without direct shell access.

Built with Rust using Axum, with auto-generated OpenAPI documentation and embedded Swagger UI.

Features

  • Full bootc status exposed as structured JSON
  • Individual endpoints for booted, staged, and rollback entries
  • Computed update-availability check
  • Auto-generated OpenAPI spec with Swagger UI at /swagger-ui/
  • Prebuilt binaries for linux/amd64 and linux/arm64

API Endpoints

Method Path Description
GET /health Health check
GET /api/v1/status Full bootc host status
GET /api/v1/status/booted Currently booted image details
GET /api/v1/status/staged Staged update (pending reboot)
GET /api/v1/status/rollback Rollback image entry
GET /api/v1/status/update-available Whether an update is available
GET /swagger-ui/ Interactive Swagger UI
GET /api-docs/openapi.json Raw OpenAPI spec

The service listens on port 8005. See API.md for full request/response examples.

Quick Start

Run from prebuilt binary

Download the latest release from GitHub Releases:

curl -fsSL -o /usr/local/bin/bootc-api \
  "https://github.com/kubealex/bootc-api/releases/latest/download/bootc-api-linux-amd64"
chmod +x /usr/local/bin/bootc-api

Build from source

cargo build --release

The binary will be at target/release/bootc-api.

Run as a systemd service

sudo cp target/release/bootc-api /usr/local/bin/
sudo cp bootc-api.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now bootc-api

Verify:

curl http://localhost:8005/health
# {"status":"ok"}

Usage in Image Mode (bootc Containerfile)

To include bootc-api in a bootc image, add the following to your Containerfile:

# Install bootc-api status service
ARG TARGETARCH=amd64
RUN curl -fsSL -o /usr/local/bin/bootc-api \
    "https://github.com/kubealex/bootc-api/releases/latest/download/bootc-api-linux-${TARGETARCH}" && \
    chmod +x /usr/local/bin/bootc-api

COPY bootc-api.service /etc/systemd/system/bootc-api.service
RUN systemctl enable bootc-api.service
RUN firewall-offline-cmd --zone=public --add-port=8005/tcp

This requires a copy of bootc-api.service alongside your Containerfile with the following content:

[Unit]
Description=Bootc API Status Service
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/usr/local/bin/bootc-api
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

The TARGETARCH build arg defaults to amd64 and can be overridden for arm64 builds.

The snippet:

  1. Downloads the prebuilt binary from GitHub Releases into /usr/local/bin/
  2. Installs the systemd unit file
  3. Enables the service so it starts automatically on boot
  4. Opens port 8005/tcp in the firewall

After building and deploying the image, the API will be available at http://<host>:8005.

License

This project is open source. See the repository for license details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages