Index | Thread | Search

From:
aisha <openbsd.ports@aisha.cc>
Subject:
[new] www/uptime-kuma - fancy selfhosted uptime monitor
To:
ports@openbsd.org
Date:
Thu, 1 Aug 2024 23:32:27 -0400

Download raw body.

Thread
Hi,
  I've attached a port for www/uptime-kuma, an uptime monitoring tool.

Uptime Kuma is an easy-to-use self-hosted monitoring tool.
It comes with a lot of knobs and features, such as:
- Monitoring uptime for HTTP(s) / TCP/ HTTP(s) Keyword /
  HTTP(s) Json Query / Ping / DNS Record / Push /
  Steam Game Server / Docker Containers.
- Fancy, Reactive, Fast UI/UX
- Notifications via Telegram, Discord, Gotify, Slack,
  Pushover, Email (SMTP), and 90+ other notification services.
- 20-second intervals
- Multi Languages
- Multiple status pages
- Map status pages to specific domains
- Ping chart
- Certificate info
- Proxy support
- 2FA support


I've also attached a patch for www/PM2, which now allows uptime-kuma to be started by the PM2 daemon super easily, as simple as `rcctl start pm2`.


I've added the sample config file for PM2 as well as documentation for starting uptime-kuma in the README for uptime-kuma.

OK to import and patch?

Aisha



diff --git a/infrastructure/db/user.list b/infrastructure/db/user.list
index 06bf2693c54..8c562f52d3a 100644
--- a/infrastructure/db/user.list
+++ b/infrastructure/db/user.list
@@ -30,7 +30,7 @@ id  user		group		port
 519 _news		_news		news/leafnode
 520 _majordomo		_majordomo	mail/majordomo
 521 _exim		_exim		mail/exim
-#522 _xcept		_xcept		comms/xcept
+522 _pm2		_pm2		www/pm2
 523 _ffproxy		_ffproxy	www/ffproxy
 #524			_mail		mail/openwebmail
 525 _quagga		_quagga		net/quagga
diff --git a/www/pm2/Makefile b/www/pm2/Makefile
index 3637b8bcc5e..f0d1ee2cba6 100644
--- a/www/pm2/Makefile
+++ b/www/pm2/Makefile
@@ -4,6 +4,8 @@ GH_ACCOUNT =		Unitech
 GH_PROJECT =		pm2
 GH_TAGNAME =		v5.4.2
 
+REVISION =		0
+
 CATEGORIES =		www
 
 HOMEPAGE =		https://pm2.keymetrics.io/
@@ -41,5 +43,7 @@ do-install:
 	cp -a ${WRKSRC} ${PREFIX}/libexec/pm2
 	rm -r ${PREFIX}/libexec/pm2/test
 	ln -sf ${TRUEPREFIX}/libexec/pm2/bin/pm2 ${PREFIX}/bin/pm2
+	mkdir ${PREFIX}/share/doc/pm2
+	cp ${FILESDIR}/ecosystem.config.js ${PREFIX}/share/doc/pm2/
 
 .include <bsd.port.mk>
diff --git a/www/pm2/files/ecosystem.config.js b/www/pm2/files/ecosystem.config.js
new file mode 100644
index 00000000000..a38fe360a3c
--- /dev/null
+++ b/www/pm2/files/ecosystem.config.js
@@ -0,0 +1,3 @@
+module.exports = {
+  apps : []
+}
diff --git a/www/pm2/patches/patch-_mocharc_js b/www/pm2/patches/patch-_mocharc_js
new file mode 100644
index 00000000000..a228e6fd088
--- /dev/null
+++ b/www/pm2/patches/patch-_mocharc_js
@@ -0,0 +1,12 @@
+Index: .mocharc.js
+--- .mocharc.js.orig
++++ .mocharc.js
+@@ -7,7 +7,7 @@ module.exports = {
+   delay: false,
+   diff: true,
+   exit: true,
+-  timeout: 10000,
++  timeout: 30000,
+   'trace-warnings': true,
+   ui: 'bdd',
+   retries: 2
diff --git a/www/pm2/pkg/PLIST b/www/pm2/pkg/PLIST
index 119a974d508..039a12dddaa 100644
--- a/www/pm2/pkg/PLIST
+++ b/www/pm2/pkg/PLIST
@@ -1,3 +1,14 @@
+@newgroup _pm2:522
+@newuser _pm2:522:522::PM2:${LOCALSTATEDIR}/db/pm2:/sbin/nologin
+@mode 750
+@owner _pm2
+@group _pm2
+@sample ${LOCALSTATEDIR}/db/pm2/
+@owner
+@sample ${SYSCONFDIR}/pm2/
+@mode
+@group
+@rcscript ${RCDIR}/pm2
 bin/pm2
 libexec/pm2/
 libexec/pm2/.editorconfig
@@ -5430,3 +5441,8 @@ libexec/pm2/pres/vitals.png
 libexec/pm2/types/
 libexec/pm2/types/index.d.ts
 libexec/pm2/types/tsconfig.json
+share/doc/pm2/
+share/doc/pm2/ecosystem.config.js
+@mode 640
+@group _pm2
+@sample ${SYSCONFDIR}/pm2/ecosystem.config.js
diff --git a/www/pm2/pkg/pm2.rc b/www/pm2/pkg/pm2.rc
new file mode 100644
index 00000000000..4139dd70dbd
--- /dev/null
+++ b/www/pm2/pkg/pm2.rc
@@ -0,0 +1,23 @@
+#!/bin/ksh
+
+daemon="/usr/local/bin/pm2"
+daemon_flags="/etc/pm2/ecosystem.config.js"
+daemon_user="_pm2"
+
+. /etc/rc.d/rc.subr
+
+pexp="node: PM2 v[0-9]\.[0-9]\.[0-9]: God Daemon.*"
+
+rc_start() {
+	rc_exec "${daemon} start ${daemon_flags}"
+}
+
+rc_reload() {
+	rc_exec "${daemon} reload ${daemon_flags}"
+}
+
+rc_stop() {
+	rc_exec "${daemon} kill"
+}
+
+rc_cmd $1