From 13f094c7861d91bcf7d520f3e689b66e513bd234 Mon Sep 17 00:00:00 2001 From: Remco Ros Date: Thu, 28 May 2026 13:03:54 +0200 Subject: [PATCH] feat: add NVIDIA and AMD (Mesa Rusticl/OpenCL) GPU variants, bump to 1.5.2.1-beta.4 --- Makefile | 10 +++- README.md | 42 +++++++++++--- instructions.md | 2 +- s9pk.mk | 35 +++++++++++- startos/manifest/index.ts | 66 +++++++++++++++++++--- startos/versions/{v1.5.2.ts => current.ts} | 6 +- startos/versions/index.ts | 6 +- 7 files changed, 141 insertions(+), 26 deletions(-) rename startos/versions/{v1.5.2.ts => current.ts} (65%) diff --git a/Makefile b/Makefile index c2cf7f8..6d4c079 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,11 @@ # overrides to s9pk.mk must precede the include statement ARCHES := x86 arm -include s9pk.mk \ No newline at end of file +TARGETS := generic nvidia amd + +include s9pk.mk + +.PHONY += generic nvidia amd + +generic: ; VARIANT=generic $(MAKE) arches +nvidia: ; VARIANT=nvidia $(MAKE) arches ARCHES=x86 +amd: ; VARIANT=amd $(MAKE) arches ARCHES=x86 diff --git a/README.md b/README.md index b3591db..ea9b9b2 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,21 @@ | Property | Value | | ------------- | ------------------------------------------------------------------------ | | Image | `ghcr.io/remcoros/frigate-docker` (custom image, see frigate-docker repo) | -| Architectures | x86_64, aarch64 | +| Architectures | x86_64, aarch64 for the default image; x86_64 for AMD | | Entrypoint | Upstream entrypoint (unmodified) | -| GPU runtime | Nvidia container runtime enabled (`nvidiaContainer: true`) | +| GPU runtime | NVIDIA runtime for the NVIDIA variant; OpenCL runtimes in the image | -Hardware acceleration is declared (`hardwareAcceleration: true`). On systems with a supported Nvidia GPU, StartOS uses the Nvidia container runtime. AMD GPU support is not available (see [Limitations](#limitations-and-differences)). +Hardware acceleration is declared (`hardwareAcceleration: true`). StartOS variants with hardware requirements select the right runtime: + +| StartOS variant | Docker tag suffix | Hardware requirement | +| ---------------- | ----------------- | -------------------- | +| `generic` | none | none | +| `nvidia` | none | NVIDIA GPU | +| `intel-i915` | none | Intel GPU, i915 | +| `intel-xe` | none | Intel GPU, xe | +| `amd` | `-amd` | AMD GPU, amdgpu | + +The default Docker image bundles Intel OpenCL on x86_64 and supports CPU/NVIDIA/Intel. The AMD variant uses the `-amd` Docker tag with Mesa Rusticl OpenCL (`radeonsi`) bundled. --- @@ -147,11 +157,10 @@ Only one backend Electrum server (Fulcrum or Electrs) is used at a time, based o ## Limitations and Differences -1. **AMD GPU not supported.** The image does not bundle the AMD ROCm/OpenCL runtime, and there is no mechanism to mount the host OpenCL ICD into the container. AMD GPU scanning falls back to CPU automatically. -2. **No SSL certificate configuration.** SSL termination uses the StartOS-managed certificate; manual SSL cert/key configuration from upstream is not exposed. -3. **Config file not directly editable.** `config.toml` is managed by StartOS. Use the Configure action to change settings. -4. **Single backend Electrum server.** Only one backend (Fulcrum or Electrs) can be active at a time. -5. **Experimental upstream.** Frigate is an experimental project. Silent Payments support is still evolving upstream. +1. **No SSL certificate configuration.** SSL termination uses the StartOS-managed certificate; manual SSL cert/key configuration from upstream is not exposed. +2. **Config file not directly editable.** `config.toml` is managed by StartOS. Use the Configure action to change settings. +3. **Single backend Electrum server.** Only one backend (Fulcrum or Electrs) can be active at a time. +4. **Experimental upstream.** Frigate is an experimental project. Silent Payments support is still evolving upstream. --- @@ -178,6 +187,23 @@ package_id: frigate architectures: - x86_64 - aarch64 +hardware_acceleration: true +variants: + generic: + docker_tag_suffix: null + gpu_driver: null + nvidia: + docker_tag_suffix: null + gpu_driver: nvidia + intel-i915: + docker_tag_suffix: null + gpu_driver: i915 + intel-xe: + docker_tag_suffix: null + gpu_driver: xe + amd: + docker_tag_suffix: -amd + gpu_driver: amdgpu volumes: main: /root/.frigate ports: diff --git a/instructions.md b/instructions.md index c9c1cc0..9fd48be 100644 --- a/instructions.md +++ b/instructions.md @@ -23,6 +23,6 @@ Frigate can use a GPU to accelerate Silent Payments scanning. The compute backen - **Nvidia** - should work. Not tested by the package author (no test hardware available). Reports welcome. - **Intel** - should work. Not tested by the package author (no test hardware available). Reports welcome. -- **AMD** - not supported. The AMD ROCm runtime is not bundled in the image. If you need AMD GPU support, please open an issue at [github.com/remcoros/frigate-startos](https://github.com/remcoros/frigate-startos). +- **AMD** - should work using the AMD image variant with Mesa Rusticl OpenCL (`radeonsi`) bundled. Not tested by the package author (no test hardware available). Reports welcome. Without a supported GPU, Frigate falls back to CPU automatically. diff --git a/s9pk.mk b/s9pk.mk index 8ac5049..978a059 100644 --- a/s9pk.mk +++ b/s9pk.mk @@ -3,6 +3,10 @@ PACKAGE_ID := $(shell awk -F"'" '/id:/ {print $$2}' startos/manifest/index.ts) INGREDIENTS := $(shell start-cli s9pk list-ingredients 2>/dev/null) +# Resolve the actual git dir so this works inside git worktrees, where .git +# is a file pointing at
/.git/worktrees/ rather than a directory. +GIT_DIR := $(shell git rev-parse --git-dir 2>/dev/null) +GIT_DEPS := $(if $(GIT_DIR),$(GIT_DIR)/HEAD $(GIT_DIR)/index) ARCHES ?= x86 arm riscv TARGETS ?= arches ifdef VARIANT @@ -50,12 +54,12 @@ x86 x86_64: arch/x86_64 arm arm64 aarch64: arch/aarch64 riscv riscv64: arch/riscv64 -$(BASE_NAME).s9pk: $(INGREDIENTS) .git/HEAD .git/index +$(BASE_NAME).s9pk: $(INGREDIENTS) $(GIT_DEPS) @$(MAKE) --no-print-directory ingredients @echo " Packing '$@'..." start-cli s9pk pack -o $@ -$(BASE_NAME)_%.s9pk: $(INGREDIENTS) .git/HEAD .git/index +$(BASE_NAME)_%.s9pk: $(INGREDIENTS) $(GIT_DEPS) @$(MAKE) --no-print-directory ingredients @echo " Packing '$@'..." start-cli s9pk pack --arch=$* -o $@ @@ -77,6 +81,30 @@ install: | check-deps check-init printf "\n🚀 Installing %s to %s ...\n" "$$S9PK" "$$HOST"; \ start-cli package install -s "$$S9PK" +publish: | all + @REGISTRY=$$(awk -F'/' '/^registry:/ {print $$3}' ~/.startos/config.yaml); \ + if [ -z "$$REGISTRY" ]; then \ + echo "Error: You must define \"registry: https://my-registry.tld\" in ~/.startos/config.yaml"; \ + exit 1; \ + fi; \ + S3BASE=$$(awk -F'/' '/^s9pk-s3base:/ {print $$3}' ~/.startos/config.yaml); \ + if [ -z "$$S3BASE" ]; then \ + echo "Error: You must define \"s3base: https://s9pks.my-s3-bucket.tld\" in ~/.startos/config.yaml"; \ + exit 1; \ + fi; \ + command -v s3cmd >/dev/null || \ + (echo "Error: s3cmd not found. It must be installed to publish using s3." && exit 1); \ + printf "\n🚀 Publishing to %s; indexing on %s ...\n" "$$S3BASE" "$$REGISTRY"; \ + for s9pk in *.s9pk; do \ + age=$$(( $$(date +%s) - $$(stat -c %Y "$$s9pk") )); \ + if [ "$$age" -gt 3600 ]; then \ + printf "\033[1;33m⚠️ %s is %d minutes old. Publish anyway? [y/N] \033[0m" "$$s9pk" "$$((age / 60))"; \ + read -r ans; \ + case "$$ans" in [yY]*) ;; *) echo "Skipping $$s9pk"; continue ;; esac; \ + fi; \ + start-cli s9pk publish "$$s9pk"; \ + done + check-deps: @command -v start-cli >/dev/null || \ (echo "Error: start-cli not found. Please see https://docs.start9.com/latest/developer-guide/sdk/installing-the-sdk" && exit 1) @@ -90,6 +118,7 @@ check-init: fi javascript/index.js: $(shell find startos -type f) tsconfig.json node_modules + npm run check npm run build node_modules: package-lock.json @@ -100,4 +129,4 @@ package-lock.json: package.json clean: @echo "Cleaning up build artifacts..." - @rm -rf $(PACKAGE_ID).s9pk $(PACKAGE_ID)_x86_64.s9pk $(PACKAGE_ID)_aarch64.s9pk $(PACKAGE_ID)_riscv64.s9pk javascript node_modules \ No newline at end of file + @rm -rf $(PACKAGE_ID).s9pk $(PACKAGE_ID)_x86_64.s9pk $(PACKAGE_ID)_aarch64.s9pk $(PACKAGE_ID)_riscv64.s9pk javascript node_modules diff --git a/startos/manifest/index.ts b/startos/manifest/index.ts index 5534f3a..e6ff298 100644 --- a/startos/manifest/index.ts +++ b/startos/manifest/index.ts @@ -1,6 +1,58 @@ import { setupManifest } from '@start9labs/start-sdk' +import { DeviceFilter } from '@start9labs/start-sdk/base/lib/osBindings/DeviceFilter' import { FRIGATE_VERSION } from '../versions' +const variant = process.env.VARIANT || 'generic' + +type Mutable = { -readonly [K in keyof T]: Mutable } +const mutable = (value: T): Mutable => value as Mutable + +const defaultImage = { + dockerTag: 'ghcr.io/remcoros/frigate-docker:' + FRIGATE_VERSION, +} + +const amdImage = { + dockerTag: 'ghcr.io/remcoros/frigate-docker:' + FRIGATE_VERSION + '-amd', +} + +const imageConfigs = { + generic: { + arch: ['x86_64', 'aarch64'], + source: defaultImage, + }, + nvidia: { + arch: ['x86_64'], + nvidiaContainer: true, + source: defaultImage, + }, + amd: { + arch: ['x86_64'], + source: amdImage, + }, +} as const + +const deviceRequirements: Record = { + generic: [], + nvidia: [ + { + class: 'display', + product: null, + vendor: null, + driver: 'nvidia', + description: 'An NVIDIA GPU', + }, + ], + amd: [ + { + class: 'display', + product: null, + vendor: null, + driver: 'amdgpu', + description: 'An AMD GPU supported by Mesa Rusticl/radeonsi', + }, + ], +} + export const manifest = setupManifest({ id: 'frigate', title: 'Frigate Electrum Server', @@ -19,15 +71,15 @@ export const manifest = setupManifest({ }, volumes: ['main'], images: { - main: { - arch: ['x86_64', 'aarch64'], - nvidiaContainer: true, - source: { - dockerTag: 'ghcr.io/remcoros/frigate-docker:' + FRIGATE_VERSION, - }, - }, + main: mutable( + imageConfigs[variant as keyof typeof imageConfigs] ?? + imageConfigs.generic, + ), }, hardwareAcceleration: true, + hardwareRequirements: { + device: deviceRequirements[variant] ?? [], + }, alerts: { install: null, update: null, diff --git a/startos/versions/v1.5.2.ts b/startos/versions/current.ts similarity index 65% rename from startos/versions/v1.5.2.ts rename to startos/versions/current.ts index e357d0c..c0b69ff 100644 --- a/startos/versions/v1.5.2.ts +++ b/startos/versions/current.ts @@ -1,12 +1,12 @@ import { VersionInfo, IMPOSSIBLE } from '@start9labs/start-sdk' -export const v1_5_2 = VersionInfo.of({ - version: '1.5.2:0-beta.3', +export const current = VersionInfo.of({ + version: '1.5.2:0-beta.4', releaseNotes: { en_US: 'Initial release of Frigate for StartOS 0.4', }, migrations: { up: async ({ effects }) => {}, - down: IMPOSSIBLE, + down: async ({ effects }) => {}, }, }) diff --git a/startos/versions/index.ts b/startos/versions/index.ts index 8282b55..01e9d7f 100644 --- a/startos/versions/index.ts +++ b/startos/versions/index.ts @@ -1,9 +1,9 @@ import { VersionGraph } from '@start9labs/start-sdk' -import { v1_5_2 } from './v1.5.2' +import { current } from './current' export const versionGraph = VersionGraph.of({ - current: v1_5_2, + current, other: [], }) -export const FRIGATE_VERSION = '1.5.2' +export const FRIGATE_VERSION = '1.5.2.1'