[Feature]: Hub support for FreeBSD
Component
Hub
Describe the feature you would like to see
I'd like to run Beszel Hub on FreeBSD jail
Motivation / Use Case
FreeBSD compatibility
Describe how you would like to see this feature implemented
I couldn't compile the Hub frontend on FreeBSD.
Screenshots
No response
Category
Installation
Affected Metrics
CPU
Had exactly the same intent, install hub into jail.
This should be enough (for latest release tag), the problem is in tooling for javascript generation, that is ignoring that FreeBSD exists. With this fix, i was able to generate js and compile hub.
make build-web-ui build-hub
I am not ts expert and I really dislike anything related to js, so I cant support it, I hope that author is better in this.
index ce6a8ad3..31f929b9 100644
--- a/internal/site/vite.config.ts
+++ b/internal/site/vite.config.ts
@@ -1,24 +1,32 @@
import { defineConfig } from "vite"
import path from "path"
import tailwindcss from "@tailwindcss/vite"
-import react from "@vitejs/plugin-react-swc"
+import react from "@vitejs/plugin-react" // <-- esbuild-based, works on FreeBSD
import { lingui } from "@lingui/vite-plugin"
export default defineConfig({
- base: "./",
- plugins: [
- react({
- plugins: [["@lingui/swc-plugin", {}]],
- }),
- lingui(),
- tailwindcss(),
- ],
- esbuild: {
- legalComments: "external",
- },
- resolve: {
- alias: {
- "@": path.resolve(__dirname, "./src"),
- },
- },
+ base: "./",
+ plugins: [
+ react({
+ babel: {
+ plugins: [
+ "babel-plugin-macros",
+ ],
+ },
+ }),
+ lingui(),
+ tailwindcss(),
+ ],
+
Just testing it, added all my jails and physical server into it and it seems it is working fine.
Both rc.d scripts are assuming that beszel (hub) and/or beszelagent (agent) are installed to /usr/local/beszel
The scripts bellow are more on a POC level, feel free to adjust them. The agent script is also injectin PATHs for FreeBSD and can execute smartctl properly.
hub rc.d script (/usr/local/etc/rc.d/beszel)
#!/bin/sh
#
# PROVIDE: beszel
# REQUIRE: networking
# KEYWORD:
. /etc/rc.subr
name="beszel"
rcvar="beszel_enable"
pidfile="/var/run/${name}.pid"
logfile="/var/log/${name}.log"
beszel_command="/usr/local/beszel/beszel"
load_rc_config $name
: ${beszel_enable:=no}
: ${beszel_listen:="10.1.3.19:8081"}
: ${beszel_chdir:="/usr/local/beszel"}
: ${beszel_flags:=""}
command="/usr/sbin/daemon"
command_args="-P ${pidfile} -o ${logfile} -r -f ${beszel_command} serve --http ${beszel_listen} ${beszel_flags}"
run_rc_command "$1"
Agent rc.d script (/usr/local/etc/rc.d/beszelagent):
#!/bin/sh
#
# PROVIDE: beszelagent
# REQUIRE: networking
# KEYWORD:
. /etc/rc.subr
name="beszelagent"
#!/bin/sh
#
# PROVIDE: beszelagent
# REQUIRE: networking
# KEYWORD:
. /etc/rc.subr
name="beszelagent"
rcvar="${name}_enable"
pidfile="/var/run/${name}.pid"
logfile="/var/log/${name}.log"
beszel_command="/usr/local/beszel/${name}"
load_rc_config $name
: ${beszelagent_enable:=no}
: ${beszelagent_listen:="0.0.0.0:45876"}
: ${beszelagent_chdir:="/usr/local/beszel"}
: ${beszelagent_key:=""}
: ${beszelagent_flags:=""}
if [ -z "${beszelagent_key}" ]; then
err 1 "beszelagent_key is not set in /etc/rc.conf – it is required"
fi
sh_args="PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin ${beszel_command} --listen ${beszelagent_listen} --key '${beszelagent_key}' ${beszelagent_flags}"
command="/usr/sbin/daemon"
command_args="-P ${pidfile} -o ${logfile} -r -f sh -c \"${sh_args}\""
run_rc_command "$1"
We now have a precompiled FreeBSD hub available as of the 0.17.0 release.
I'll update the install script to support FreeBSD at some point soon. Thanks @stiray for your examples. I'll use that as the starting point.