惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
MyScale Blog
MyScale Blog
F
Fortinet All Blogs
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Blog — PlanetScale
Blog — PlanetScale
Jina AI
Jina AI
T
Tenable Blog
S
Securelist
S
Schneier on Security
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
C
Cisco Blogs
The Hacker News
The Hacker News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
O
OpenAI News
V
Vulnerabilities – Threatpost
V
Visual Studio Blog
Security Latest
Security Latest
T
Threatpost
博客园 - 三生石上(FineUI控件)
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
H
Hacker News: Front Page
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
IT之家
IT之家
I
InfoQ
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
Know Your Adversary
Know Your Adversary
Martin Fowler
Martin Fowler
Forbes - Security
Forbes - Security
F
Full Disclosure
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
Hacker News - Newest:
Hacker News - Newest: "LLM"
P
Privacy International News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
C
CERT Recently Published Vulnerability Notes
N
News and Events Feed by Topic
V
V2EX
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threat Research - Cisco Blogs
S
Secure Thoughts
量子位
博客园 - 【当耐特】

IT Notes - container

IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes
IT Notes
Stefano Marinelli · 2024-07-22 · via IT Notes - container

Uptime-Kuma is a very useful tool. Besides being able to monitor whether services, websites, or ports are responding, it can also send notifications using many different services, even combined, and check the expiration of certificates. Additionally, it can create informative dashboards about the status of services.

I have been using it extensively for years, including for BSD Cafe. My initial deployments were on Docker containers, but recently, I have moved everything to FreeBSD jails.

When proceeding with the standard installation described in their documentation, the process will halt because one of the third-party libraries (Playwright) is not officially compatible with FreeBSD. However, since this library is not necessary for the type of checks I want to perform (I am not interested in checking web page components, just their response), it is possible to continue and run everything using a small hack.

It can be installed directly on FreeBSD but, in my case, I prefer using jails. Note that if using traditional jails (i.e., not VNet), "ping" is disabled. Therefore, if using traditional jails and wanting to check hosts via ping, it is advisable to add the line allow.raw_sockets; to the respective jail.conf.

The installation can proceed as follows:

The first step is to install the necessary dependencies:

pkg install node20 npm-node20 git-lite

Once the dependencies are installed, it is advisable to create a user to run everything and use that user for the next steps:

pw add user ukuma -m
echo 'export LC_ALL="en_US.UTF-8"' >> /home/ukuma/.profile
su -l ukuma

At this point, clone the Uptime-Kuma repository and start installing the dependencies:

git clone https://github.com/louislam/uptime-kuma.git
cd uptime-kuma/
npm run setup

The operation will seem to complete correctly. However, running the program will result in a fatal error preventing it from functioning:

ukuma@ukuma:~/uptime-kuma $ node server/server.js
[...]
/home/ukuma/uptime-kuma/node_modules/playwright-core/lib/server/registry/index.js:258
    if (process.platform === 'linux') cacheDirectory = process.env.XDG_CACHE_HOME || _path.default.join(os.homedir(), '.cache'); else if (process.platform === 'darwin') cacheDirectory = _path.default.join(os.homedir(), 'Library', 'Caches'); else if (process.platform === 'win32') cacheDirectory = process.env.LOCALAPPDATA || _path.default.join(os.homedir(), 'AppData', 'Local'); else throw new Error('Unsupported platform: ' + process.platform);
                                                                                                                                                                                                                                                                                                                                                                                             ^

Error: Unsupported platform: freebsd
    at /home/ukuma/uptime-kuma/node_modules/playwright-core/lib/server/registry/index.js:258:388
    at Object.<anonymous> (/home/ukuma/uptime-kuma/node_modules/playwright-core/lib/server/registry/index.js:270:3)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/ukuma/uptime-kuma/node_modules/playwright-core/lib/server/index.js:84:17)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)

The issue is clear: Playwright does not support FreeBSD, causing the operation to fail. At this point, there are two options:

  • Hope that Microsoft decides to support FreeBSD, which is unlikely in the short term.
  • Trick Playwright into thinking FreeBSD is supported, which may break some related functionality, but it is a small price to pay to have all other features of Uptime-Kuma.

I will use the second method. Open the indicated file (in this case, /home/ukuma/uptime-kuma/node_modules/playwright-core/lib/server/registry/index.js) and modify the indicated line (in this case, 258). Change the line if (process.platform === 'linux') to if (process.platform === 'freebsd') and save it.

Uptime-Kuma will then be able to import the necessary libraries and function, listening on port 3001.

At this point, it will be possible to use it normally, as well as use pm2 to start and manage it automatically, but this goes beyond the scope of this article.