diff --git a/cross/beszel-agent/Makefile b/cross/beszel-agent/Makefile new file mode 100644 index 00000000000..2a9878a0e75 --- /dev/null +++ b/cross/beszel-agent/Makefile @@ -0,0 +1,28 @@ +PKG_NAME = beszel-agent +REAL_PKG_NAME = beszel +PKG_VERS = 0.11.1 +PKG_EXT = tar.gz +PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT) +PKG_DIST_SITE = https://github.com/henrygd/beszel/archive +PKG_DIST_FILE = $(REAL_PKG_NAME)-$(PKG_VERS).$(PKG_EXT) + +# use different folders for baszel-agent and baszel-hub +PKG_DIR = $(PKG_NAME)/$(REAL_PKG_NAME)-$(PKG_VERS)/beszel +EXTRACT_PATH = $(WORK_DIR)/$(PKG_NAME) + +BUILD_DEPENDS = native/go + +HOMEPAGE = https://beszel.dev/ +COMMENT = Simple, lightweight server monitoring. +LICENSE = MIT + +COMPILE_MAKE_OPTIONS = build-agent + +INSTALL_TARGET = install_beszel + +include ../../mk/spksrc.cross-go.mk + +.PHONY: install_beszel +install_beszel: + @install -d -m 755 $(STAGING_INSTALL_PREFIX)/bin + @install -m 744 $(WORK_DIR)/$(PKG_DIR)/build/beszel-agent $(STAGING_INSTALL_PREFIX)/bin/ diff --git a/cross/beszel-agent/PLIST b/cross/beszel-agent/PLIST new file mode 100644 index 00000000000..4ca38330cd1 --- /dev/null +++ b/cross/beszel-agent/PLIST @@ -0,0 +1 @@ +bin:bin/beszel-agent diff --git a/cross/beszel-agent/digests b/cross/beszel-agent/digests new file mode 100644 index 00000000000..e68c0f15856 --- /dev/null +++ b/cross/beszel-agent/digests @@ -0,0 +1,3 @@ +beszel-0.11.1.tar.gz SHA1 5b6e2ada4d7b937176d45be7bdeefa43dffef848 +beszel-0.11.1.tar.gz SHA256 eb96fd2766e97a06992791508ba2bd652789a126781f80816648304b0a4a8693 +beszel-0.11.1.tar.gz MD5 a97cd0a2b2f8c23956e3387b3283776b diff --git a/cross/beszel-agent/patches/001-rename_targets_and-arch_variable.patch b/cross/beszel-agent/patches/001-rename_targets_and-arch_variable.patch new file mode 100644 index 00000000000..b19fede747b --- /dev/null +++ b/cross/beszel-agent/patches/001-rename_targets_and-arch_variable.patch @@ -0,0 +1,26 @@ +# rename ARCH variable to avoid conflicts with spksrc framework +# avoid OS and _ARCH in target names +# +--- Makefile.orig 2025-04-29 00:57:27.000000000 +0000 ++++ Makefile 2025-05-13 17:02:39.916955450 +0000 +@@ -1,6 +1,6 @@ + # Default OS/ARCH values + OS ?= $(shell go env GOOS) +-ARCH ?= $(shell go env GOARCH) ++_ARCH ?= $(shell go env GOARCH) + # Skip building the web UI if true + SKIP_WEB ?= false + +@@ -31,10 +31,10 @@ + fi + + build-agent: tidy +- GOOS=$(OS) GOARCH=$(ARCH) go build -o ./build/beszel-agent_$(OS)_$(ARCH) -ldflags "-w -s" beszel/cmd/agent ++ GOOS=$(OS) GOARCH=$(_ARCH) go build -o ./build/beszel-agent -ldflags "-w -s" beszel/cmd/agent + + build-hub: tidy $(if $(filter false,$(SKIP_WEB)),build-web-ui) +- GOOS=$(OS) GOARCH=$(ARCH) go build -o ./build/beszel_$(OS)_$(ARCH) -ldflags "-w -s" beszel/cmd/hub ++ GOOS=$(OS) GOARCH=$(_ARCH) go build -o ./build/beszel -ldflags "-w -s" beszel/cmd/hub + + build: build-agent build-hub + diff --git a/cross/beszel-hub/Makefile b/cross/beszel-hub/Makefile new file mode 100644 index 00000000000..5b4318ca00b --- /dev/null +++ b/cross/beszel-hub/Makefile @@ -0,0 +1,30 @@ +PKG_NAME = beszel-hub +REAL_PKG_NAME = beszel +PKG_VERS = 0.11.1 +PKG_EXT = tar.gz +PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT) +PKG_DIST_SITE = https://github.com/henrygd/beszel/archive +PKG_DIST_FILE = $(REAL_PKG_NAME)-$(PKG_VERS).$(PKG_EXT) + +# use different folders for baszel-agent and baszel-hub +PKG_DIR = $(PKG_NAME)/$(REAL_PKG_NAME)-$(PKG_VERS)/beszel +EXTRACT_PATH = $(WORK_DIR)/$(PKG_NAME) + +BUILD_DEPENDS = native/go native/nodejs + +HOMEPAGE = https://beszel.dev/ +COMMENT = Simple, lightweight server monitoring. +LICENSE = MIT + +COMPILE_MAKE_OPTIONS = build-hub + +INSTALL_TARGET = install_beszel + +include ../../mk/spksrc.cross-go.mk + +ENV += PATH=$(realpath $(WORK_DIR)/../../../native/nodejs/work-native/node/bin):$(realpath $(WORK_DIR)/../../../native/go/work-native/go/bin):$(PATH) + +.PHONY: install_beszel +install_beszel: + @install -d -m 755 $(STAGING_INSTALL_PREFIX)/bin + @install -m 744 $(WORK_DIR)/$(PKG_DIR)/build/beszel $(STAGING_INSTALL_PREFIX)/bin/ diff --git a/cross/beszel-hub/PLIST b/cross/beszel-hub/PLIST new file mode 100644 index 00000000000..e19d0920e92 --- /dev/null +++ b/cross/beszel-hub/PLIST @@ -0,0 +1 @@ +bin:bin/beszel diff --git a/cross/beszel-hub/digests b/cross/beszel-hub/digests new file mode 100644 index 00000000000..e68c0f15856 --- /dev/null +++ b/cross/beszel-hub/digests @@ -0,0 +1,3 @@ +beszel-0.11.1.tar.gz SHA1 5b6e2ada4d7b937176d45be7bdeefa43dffef848 +beszel-0.11.1.tar.gz SHA256 eb96fd2766e97a06992791508ba2bd652789a126781f80816648304b0a4a8693 +beszel-0.11.1.tar.gz MD5 a97cd0a2b2f8c23956e3387b3283776b diff --git a/cross/beszel-hub/patches/001-rename_targets_and-arch_variable.patch b/cross/beszel-hub/patches/001-rename_targets_and-arch_variable.patch new file mode 100644 index 00000000000..b19fede747b --- /dev/null +++ b/cross/beszel-hub/patches/001-rename_targets_and-arch_variable.patch @@ -0,0 +1,26 @@ +# rename ARCH variable to avoid conflicts with spksrc framework +# avoid OS and _ARCH in target names +# +--- Makefile.orig 2025-04-29 00:57:27.000000000 +0000 ++++ Makefile 2025-05-13 17:02:39.916955450 +0000 +@@ -1,6 +1,6 @@ + # Default OS/ARCH values + OS ?= $(shell go env GOOS) +-ARCH ?= $(shell go env GOARCH) ++_ARCH ?= $(shell go env GOARCH) + # Skip building the web UI if true + SKIP_WEB ?= false + +@@ -31,10 +31,10 @@ + fi + + build-agent: tidy +- GOOS=$(OS) GOARCH=$(ARCH) go build -o ./build/beszel-agent_$(OS)_$(ARCH) -ldflags "-w -s" beszel/cmd/agent ++ GOOS=$(OS) GOARCH=$(_ARCH) go build -o ./build/beszel-agent -ldflags "-w -s" beszel/cmd/agent + + build-hub: tidy $(if $(filter false,$(SKIP_WEB)),build-web-ui) +- GOOS=$(OS) GOARCH=$(ARCH) go build -o ./build/beszel_$(OS)_$(ARCH) -ldflags "-w -s" beszel/cmd/hub ++ GOOS=$(OS) GOARCH=$(_ARCH) go build -o ./build/beszel -ldflags "-w -s" beszel/cmd/hub + + build: build-agent build-hub + diff --git a/spk/beszel-agent/Makefile b/spk/beszel-agent/Makefile new file mode 100644 index 00000000000..b75bff62269 --- /dev/null +++ b/spk/beszel-agent/Makefile @@ -0,0 +1,26 @@ +SPK_NAME = beszel-agent +SPK_VERS = 0.11.1 +SPK_REV = 1 +SPK_ICON = src/beszel.png + +UNSUPPORTED_ARCHS = $(PPC_ARCHS) + +DEPENDS = cross/beszel-agent + +MAINTAINER = hgy59 +DESCRIPTION = "Simple, lightweight server monitoring. This package provides the Beszel Agent only." + +DISPLAY_NAME = Beszel Agent +CHANGELOG = "Initial package release." + +HOMEPAGE = https://beszel.dev/ +LICENSE = MIT + +STARTABLE = yes +SERVICE_SETUP = src/service-setup.sh +SERVICE_PORT = 45876 +NO_SERVICE_SHORTCUT = y + +WIZARDS_DIR = src/wizard/ + +include ../../mk/spksrc.spk.mk diff --git a/spk/beszel-agent/src/beszel.png b/spk/beszel-agent/src/beszel.png new file mode 100644 index 00000000000..ea319df9c2f Binary files /dev/null and b/spk/beszel-agent/src/beszel.png differ diff --git a/spk/beszel-agent/src/service-setup.sh b/spk/beszel-agent/src/service-setup.sh new file mode 100644 index 00000000000..aae054187d9 --- /dev/null +++ b/spk/beszel-agent/src/service-setup.sh @@ -0,0 +1,14 @@ + +KEY_FILE=${SYNOPKG_PKGVAR}/key.pub +BESZEL_PUBLIC_KEY=$(cat ${KEY_FILE}) +export KEY=${BESZEL_PUBLIC_KEY} + +BESZEL_AGENT=${SYNOPKG_PKGDEST}/bin/beszel-agent +SERVICE_COMMAND="${BESZEL_AGENT}" +SVC_BACKGROUND=y +SVC_WRITE_PID=y + +service_postinst () +{ + echo "${wizard_pub_key}" > ${KEY_FILE} +} diff --git a/spk/beszel-agent/src/wizard/install_uifile b/spk/beszel-agent/src/wizard/install_uifile new file mode 100644 index 00000000000..fcf317f49fd --- /dev/null +++ b/spk/beszel-agent/src/wizard/install_uifile @@ -0,0 +1,25 @@ +[ + { + "step_title": "Beszel Agent Configuration", + "items": [ + { + "type": "textfield", + "desc": "Provide the SSH public key of the Bezel Hub you want to add this system to.", + "subitems": [ + { + "key": "wizard_pub_key", + "desc": "Public Key", + "defaultValue": "", + "width": 520, + "validator": { + "allowBlank": false + } + } + ] + }, + { + "desc": "The bezel agent is listening on the default port 45876." + } + ] + } +] diff --git a/spk/beszel-hub/Makefile b/spk/beszel-hub/Makefile new file mode 100644 index 00000000000..d1521e64765 --- /dev/null +++ b/spk/beszel-hub/Makefile @@ -0,0 +1,23 @@ +SPK_NAME = beszel-hub +SPK_VERS = 0.11.1 +SPK_REV = 1 +SPK_ICON = src/beszel.png + +UNSUPPORTED_ARCHS = $(PPC_ARCHS) + +DEPENDS = cross/beszel-hub + +MAINTAINER = hgy59 +DESCRIPTION = "Simple, lightweight server monitoring. This package provides the Beszel Hub only." + +DISPLAY_NAME = Beszel Hub +CHANGELOG = "Initial package release." + +HOMEPAGE = https://beszel.dev/ +LICENSE = MIT + +STARTABLE = yes +SERVICE_SETUP = src/service-setup.sh +SERVICE_PORT = 8098 + +include ../../mk/spksrc.spk.mk diff --git a/spk/beszel-hub/src/beszel.png b/spk/beszel-hub/src/beszel.png new file mode 100644 index 00000000000..ea319df9c2f Binary files /dev/null and b/spk/beszel-hub/src/beszel.png differ diff --git a/spk/beszel-hub/src/service-setup.sh b/spk/beszel-hub/src/service-setup.sh new file mode 100644 index 00000000000..c11202cfef3 --- /dev/null +++ b/spk/beszel-hub/src/service-setup.sh @@ -0,0 +1,5 @@ + +BESZEL_HUB=${SYNOPKG_PKGDEST}/bin/beszel +SERVICE_COMMAND="${BESZEL_HUB} serve --http 0.0.0.0:${SERVICE_PORT} --dir ${SYNOPKG_PKGVAR}" +SVC_BACKGROUND=y +SVC_WRITE_PID=y