Hi everyone,
I'm seeking advice on creating an uptime-kuma port, hopefully for the eventual submission to the official ports tree, given its NodeJS nature and the fact that its installation process basically consists of the downloading of a collection of npm dependencies. If I'm not mistaken, this could present the official ports tree and/or poudriere builders with problems.
Additionally, uptime-kuma claims it doesn't support FreeBSD, but I did manage to get it working without much fuss, both its older 1.x and its current 2.0 releases, inside of a 13.5 jail via the
Thank you in advance for any tips on how to approach this, most appreciated! And, needless to say, please feel free to critique my
I'm seeking advice on creating an uptime-kuma port, hopefully for the eventual submission to the official ports tree, given its NodeJS nature and the fact that its installation process basically consists of the downloading of a collection of npm dependencies. If I'm not mistaken, this could present the official ports tree and/or poudriere builders with problems.
Additionally, uptime-kuma claims it doesn't support FreeBSD, but I did manage to get it working without much fuss, both its older 1.x and its current 2.0 releases, inside of a 13.5 jail via the
rc script below.Thank you in advance for any tips on how to approach this, most appreciated! And, needless to say, please feel free to critique my
rc script.
sh:
#!/bin/sh
# uptime-kuma FreeBSD Service Script
# PROVIDE: uptime_kuma
# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# Optional settings:
# uptime_kuma_user (system user): User who will run the service.
# uptime_kuma_group (system group): Service user's main group.
# uptime_kuma_home (path): Uptime Kuma installation directory.
# uptime_kuma_data_path (path): Uptime Kuma data directory.
# uptime_kuma_browsers_path (path): Microsoft Playwright's browsers path (https://playwright.dev/docs/browsers#managing-browser-binaries).
# uptime_kuma_host (IP address): Service host.
# uptime_kuma_port (TCP port): Service port.
. /etc/rc.subr
name=uptime_kuma
rcvar=${name}_enable
load_rc_config $name
: ${uptime_kuma_enable:=NO}
: ${uptime_kuma_user:=www}
: ${uptime_kuma_group:=www}
: ${uptime_kuma_home:=/usr/local/www/uptime-kuma}
: ${uptime_kuma_data_path:=${uptime_kuma_home}/data}
: ${uptime_kuma_browsers_path:=/nonexistent}
: ${uptime_kuma_host:=0.0.0.0}
: ${uptime_kuma_port:=3001}
eval ${name}_chdir=${uptime_kuma_home}
eval ${name}_env="\"HOME=${uptime_kuma_home} PLAYWRIGHT_BROWSERS_PATH=${uptime_kuma_browsers_path}\""
dashname=$(echo ${name} | tr _ -)
pidfile=/var/run/${dashname}/${dashname}.pid
command=/usr/sbin/daemon
command_args="-r -f -o /var/log/${dashname}/${dashname}.log -H -P ${pidfile} /usr/local/bin/node ${uptime_kuma_home}/server/server.js -- --name ${dashname} --host=${uptime_kuma_host} --port=${uptime_kuma_port}"
start_precmd=start_precmd
start_precmd()
{
[ -d /var/log/${dashname} ] || install -d -o ${uptime_kuma_user} -g ${uptime_kuma_group} /var/log/${dashname}
[ -d /var/run/${dashname} ] || install -d -o ${uptime_kuma_user} -g ${uptime_kuma_group} /var/run/${dashname}
}
run_rc_command "$1"