-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
playwright failed to install on FreeBSD #3642
Comments
We don't test for FreeBSD today. We haven't seen enough interest in this platform so far. (similar to playwrigts reasoning) Browser downloading is apparently not supported by playwrigt upstream. Could you test the fix proposed by editing your global |
Another way to likely fix this is to downgrade to |
This does not work. The .npmrc file was at /uptime-kuma/.npmrc Will try the downgrade. How does one go about downgrading? Or, how do I install the 1.22 release using the instruction for non-docker installs. |
If this has never worked for you, you don't have to deal with backing up, as you don't have significant sate to recover from. If this worked before, defintively do an backup by copying the data folder first. |
I can confirm that 1.22.0 works. Thank you. |
Closing. 1.22.0 works on FreeBSD. 1.23.0 doesn’t as of August 23/2023. |
Just curious if this will be resolved in the future. Current release still not working. |
It will be resolved once https://github.com/microsoft/playwright supports this platform or if someone does the work to make playwright into an optional dependency (still working on the platforms for which playwright works). The ever-increasing complexity is getting to us and I doubt that the core team will get to this, as native FreeBSD is quite a niche platform. |
Checked their source code, it should be able to skip the error by the env var |
What would you set that var as? |
Isn't playwrite for E2E testing? Why is it being called when running a production server with Anyway, fortunately I was able to get uptime-kuma working again with FreeBSD by setting an environment variable like this before starting the server: setenv PLAYWRIGHT_BROWSERS_PATH /nonexistent If using the BSD rc.d framework to control uptime-kuma as a service, you can add this to it's rc.d script file (ex: # Replace ${name} with the name of your rc service:
${name}_env="PLAYWRIGHT_BROWSERS_PATH=/nonexistent" Another possible solution (I haven't tried), based on microsoft/playwright#5084 (comment), is to use a global playwright_skip_browser_download=1
playwright_browsers_path=/nonexistent |
Because the |
I can confirm that setting that variable in the rc.d script solves the problem for now. |
Oo ok, I wasn't aware of that feature. |
Hey Rob! How far have you gotten in writing an rc(8) FreeBSD script for uptime-kuma? Would you care to share? And maybe even consider creating a port for the whole thing? I'd be more than willing to collaborate, test, etc. Please let me know if you're interested, thanks! |
I created one a while ago. The playwright browser path is necessary to run on FreeBSD. It should all work.
|
That's awesome, thanks, I'll give it a try shortly! And yes, so far I've gotten uptime-kuma running on a 13.2 FreeBSD jail manually by exporting PLAYWRIGHT_BROWSERS_PATH and starting the Node server right on the shell, passing my desired host as the first argument. But getting this to work automatically via rc(8) upon jail start is most definitely the end goal, hoping I can configure the behavior via rc.conf(5). I'll keep this thread posted. |
This rc script should be all you need. It's worked fine for me. |
This is what my rc script is currently looking like: #!/bin/sh
# Uptime-Kuma FreeBSD Service Script
# PROVIDE: uptime-kuma
# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable uptime-kuma:
# uptime_kuma_enable="YES"
#
# Optional settings:
# uptime_kuma_home (path): Uptime Kuma installation directory
# uptime_kuma_browsers_path (path): Microsoft Playwright's browsers path (https://playwright.dev/docs/browsers#managing-browser-binaries)
#set -vx
. /etc/rc.subr
name=uptime_kuma
rcvar=${name}_enable
load_rc_config $name
: ${uptime_kuma_enable:="NO"}
: ${uptime_kuma_home:=/usr/local/share/uptime-kuma}
: ${uptime_kuma_browsers_path:=/nonexistent}
${name}_chdir=$uptime_kuma_home
pidfile=/var/run/${name}.pid
command=/usr/sbin/daemon
command_args="-r -u ${name} -P ${pidfile} /usr/local/bin/node $uptime_kuma_home/server/server.js --name uptime-kuma -- --port=3001 --host=0.0.0.0"
#export HOME=$uptime_kuma_home
export PATH=${PATH}:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
export LC_CTYPE="en_US.UTF-8"
export PLAYWRIGHT_BROWSERS_PATH="$uptime_kuma_browsers_path"
run_rc_command "$1" But uptime-kuma is failing to start because the chdir is not being set, it's evaluating to an empty string, and I've been unable to figure out why. Any ideas? Thanks! |
The problem I'm having with the chdir is in defining the I just tried defining it as |
I've now fixed the rc script to define the chdir variable as I'm still testing it, though, especially around being able to customize the path to the uptime-kuma data directory, in case you're running the service in a jail and want to mount external directories into it, which is my case. As soon as I have that sorted out, I'll share the result here. |
Hey @jmpalacios here is my rc service file I created at Then #!/bin/sh
# PROVIDE: uptimekuma
# REQUIRE: DAEMON NETWORKING
# BEFORE: LOGIN
# KEYWORD: shutdown
# Uptime Kuma
# A fancy self-hosted monitoring tool
#
# https://github.com/louislam/uptime-kuma
# https://uptime.kuma.pet/
#
# Creating a service for uptime-kuma. It is installed by cloning the git repo.
# See below on how to update the git repo.
#
# The usual command to start uptime kuma:
# node server/server.js --host=0.0.0.0
# Create a system user:
# pw adduser uptime_kuma -d /nonexistent -s /usr/sbin/nologin -c "System user for Uptime Kuma self-hosted monitoring tool"
# Updating Uptime Kuma ---------------------------------------------------------
# https://github.com/louislam/uptime-kuma/wiki/%F0%9F%86%99-How-to-Update
# cd /usr/local/uptime-kuma
# Update from git
# git fetch --all
# git checkout 1.21.2 --force
# Install dependencies and prebuilt
# npm i --omit=dev
# npm run download-dist
# ------------------------------------------------------------------------------
. /etc/rc.subr
name="uptimekuma"
rcvar=uptimekuma_enable
: ${uptimekuma_enable:="NO"}
: ${uptimekuma_user:="www"}
: ${uptimekuma_group:="www"}
uptimekuma_user=uptime_kuma
uptimekuma_group=uptime_kuma
# 12.4.2023 After updating to latest got error on FreeBSD bc it uses playwright
# but setting this environment variable allows it to work again:
# https://github.com/louislam/uptime-kuma/issues/3642#issuecomment-1839704192
uptimekuma_env="PLAYWRIGHT_BROWSERS_PATH=/nonexistent"
# daemon(8) - wrapper class to run commands detached from the controlling terminal
pidfile="/var/run/${name}/${name}.pid"
node="/usr/local/bin/node"
repo_path="/usr/local/uptime-kuma" # Where cloned the uptimekuma git repo to.
script="${node} ${repo_path}/server/server.js --host=0.0.0.0"
# NOTE To get uptime kuma to load correctly it needs to be started inside the
# repo's directory:
uptimekuma_chdir="${repo_path}"
command=/usr/sbin/daemon
procname="daemon"
command_args="-f -P ${pidfile} ${script}"
start_precmd="${name}_precmd"
uptimekuma_precmd()
{
if [ ! -d /var/run/${name} ]; then
mkdir -p /var/run/${name}
chown ${uptimekuma_user}:${uptimekuma_user} /var/run/${name}
fi
install -o ${uptimekuma_user} /dev/null ${pidfile}
}
load_rc_config $name
run_rc_command "$1" I would like to make a FreeBSD port (mostly to make this service file easily available) but any software that involves installing npm packages is almost impossible to fit correctly into the port framework (have tried before). This is mostly due to network activity only being allowed at a certain phase durring the installation process. |
Hey @rob4226! Thank you for that rc script. Mine looks very similar, only that I simplify paths somewhat, e.g. My rc script is still not ready, though, as I'm looking to extend it with facilities to abstract the host & port kuma will run on, but most importantly to add some way (that I still haven't fully figured out) of abstracting the path to kuma's data directory (e.g. in case you want to mount it into a jail at a custom path, as I intend to do… which may reintroduce the need for a precmd() function :/). I haven't had a chance to resume working on that, though. On the other hand, I was also looking to create a FreeBSD port for this, to simplify jail deployment to a simple What I'd figured is that the package's distfile could be fetched as a tarball from the GitHub CDN, and then the setup steps (e.g. |
@jmpalacios Why don't you use rc vars like you did with # rc.conf
uptimekuma_enable="YES"
uptimekuma_host="0.0.0.0"
uptimekuma_port="8080" # /usr/local/etc/rc.d/uptimekuma
# (Optional) To run on a different host add uptimekuma_host="0.0.0.0" to /etc/rc.config
# (Optional) To run on a different port add uptimekuma_port="8080" to /etc/rc.config
: ${uptimekuma_host="127.0.0.1"} # Defaults to localhost
: ${uptimekuma_port="3001"} # Defaults to port 3001 Well actually what I meant is it's very difficult to make a port that uses |
Oh, absolutely, that's exactly what I intend! I just haven't had a chance to go back to work on the script to add those abstractions just yet ;)
I guess it's my unfamiliarity with those FreeBSD ports rules that prevent me from seeing the problem you're pointing out. What rules and/or conventions would be broken by fetching a distfile from the GitHub CDN, and calling "npm run setup" in a post-install port/pgk hook? |
All network connections must be done before it is installed. I'm not sure what |
Chiming in: Line 52 in 56aa81e
|
Thanks! |
I wrote a script a while back, and just edited it again to include your rc script. Its designed for the iocage jail manager, and it looks like its working. I have it set so it mounts the data folder outside the jail for easy jail recreation. |
Im not a big fan of the pkg system not mounting the data outside the jail. Bastille has a nice template feature that I might compile a template for. |
I'd love to deploy Bastille-based jails! But, for the time being, my rig is a TrueNAS CORE server, which uses iocage, and I've been resisting moving my jails to a VM. So, in the meantime, what I plan to do is figure out a why to provide an abstraction to the data path via the rc(8) startup script, and symlink the data directory within the uptime-kuma checkout to said path in a |
Since uptimekuma doesn’t create the data directory when cloning, my script mounts it right after cloning the repo, and then it runs the install command. This also works when reinstalling a new jail. The data folder is mounted and it picks up where it left off. |
🛡️ Security Policy
Description
I am running the custom install on freebsd. It installed fine about a month ago, but I'm just recently installed it again. When i run the
node server.js
command, i get the below error.Error: Unsupported platform: freebsd
at /usr/local/uptime-kuma/node_modules/playwright-core/lib/server/registry/index.js:258:388
at Object. (/usr/local/uptime-kuma/node_modules/playwright-core/lib/server/registry/index.js:270:3)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object. (/usr/local/uptime-kuma/node_modules/playwright-core/lib/server/index.js:84:17)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
👟 Reproduction steps
Install using the custom install commands on the uptimekuma github page, then try to run the node command.
👀 Expected behavior
I expect uptime kuma to run without errors.
😓 Actual Behavior
It errors out with "Unsupported platform. FreeBSD"
🐻 Uptime-Kuma Version
Unknown.
💻 Operating System and Arch
FreeBSD 13.2 Jail
🌐 Browser
Brave
🐋 Docker Version
N/A
🟩 NodeJS Version
18.16.0
The text was updated successfully, but these errors were encountered: