Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# overrides to s9pk.mk must precede the include statement
ARCHES := x86 arm
include s9pk.mk
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
42 changes: 34 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---

Expand Down Expand Up @@ -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.

---

Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
35 changes: 32 additions & 3 deletions s9pk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 <main>/.git/worktrees/<name> 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
Expand Down Expand Up @@ -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 $@
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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
@rm -rf $(PACKAGE_ID).s9pk $(PACKAGE_ID)_x86_64.s9pk $(PACKAGE_ID)_aarch64.s9pk $(PACKAGE_ID)_riscv64.s9pk javascript node_modules
66 changes: 59 additions & 7 deletions startos/manifest/index.ts
Original file line number Diff line number Diff line change
@@ -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<T> = { -readonly [K in keyof T]: Mutable<T[K]> }
const mutable = <T>(value: T): Mutable<T> => value as Mutable<T>

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<string, DeviceFilter[]> = {
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',
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions startos/versions/v1.5.2.ts → startos/versions/current.ts
Original file line number Diff line number Diff line change
@@ -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 }) => {},
},
})
6 changes: 3 additions & 3 deletions startos/versions/index.ts
Original file line number Diff line number Diff line change
@@ -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'
Loading