6ed905b9f3f77dfcda2cab812b1fec5c0fe00ce5
SPORE Registry
The SPORE registry is a storage backend and update server for managing versioned firmware binaries in the SPORE embedded system ecosystem.
Overview
The registry provides:
- Hierarchical Storage: Firmware binaries stored as
registry/{name}/{version}/firmware.bin - SQLite Database: Metadata storage with labels for flexible querying
- REST API: Simple HTTP endpoints for upload, listing, and download
- Version Management: Semantic versioning support
Quick Start
Prerequisites
- Go 1.22 or later
Installation
- Clone the repository:
git clone <repository-url>
cd spore-registry
- Install dependencies:
go mod download
- Run the server:
go run main.go
The server will start on port 3002 by default (or use PORT environment variable to change it).
API Endpoints
Upload Firmware
curl -X POST http://localhost:3002/firmware \
-F "metadata={\"name\":\"base\",\"version\":\"1.0.0\",\"labels\":{\"app\":\"base\"}}" \
-F "firmware=@firmware.bin"
List Firmware
# Get all firmware
curl http://localhost:3002/firmware
# Filter by name
curl "http://localhost:3002/firmware?name=base"
# Filter by version
curl "http://localhost:3002/firmware?version=1.0.0"
Download Firmware
curl http://localhost:3002/firmware/base/1.0.0 -o firmware.bin
Health Check
curl http://localhost:3002/health
Storage Structure
Firmware binaries are stored hierarchically:
registry/
├── base/
│ ├── 1.0.0/
│ │ └── firmware.bin
│ └── 1.1.0/
│ └── firmware.bin
└── sensor/
└── 2.0.0/
└── firmware.bin
Configuration
The registry uses the following environment variables:
PORT: Server port (default: 3002)
Database Schema
The SQLite database contains a firmware table:
CREATE TABLE firmware (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
version TEXT NOT NULL,
size INTEGER NOT NULL,
labels TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
UNIQUE(name, version)
);
API Documentation
Full OpenAPI specification is available in api/openapi.yaml.
Development
Building
go build -o spore-registry main.go
Testing
go test ./...
Code Structure
main.go- Main application with HTTP server and API handlersapi/openapi.yaml- OpenAPI specificationregistry/- Firmware storage directory (created automatically)registry.db- SQLite database (created automatically)
License
MIT License - see LICENSE file for details.
Description
Languages
Go
93.6%
Makefile
4%
Dockerfile
2.4%