user/uptime-kuma: new aport
This commit is contained in:
parent
a17fecd2f2
commit
cb1f8cf70c
4 changed files with 169 additions and 0 deletions
49
user/uptime-kuma/APKBUILD
Normal file
49
user/uptime-kuma/APKBUILD
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
|
||||||
|
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
|
||||||
|
pkgname=uptime-kuma
|
||||||
|
pkgver=1.23.11
|
||||||
|
pkgrel=0
|
||||||
|
pkgdesc='A fancy self-hosted monitoring tool'
|
||||||
|
arch="all"
|
||||||
|
url="https://github.com/louislam/uptime-kuma"
|
||||||
|
license="MIT"
|
||||||
|
depends="nodejs"
|
||||||
|
makedepends="npm"
|
||||||
|
source="
|
||||||
|
uptime-kuma-$pkgver.tar.gz::https://github.com/louislam/uptime-kuma/archive/refs/tags/$pkgver.tar.gz
|
||||||
|
uptime-kuma.openrc
|
||||||
|
uptime-kuma.conf
|
||||||
|
"
|
||||||
|
subpackages="$pkgname-doc $pkgname-openrc"
|
||||||
|
install="$pkgname.pre-install"
|
||||||
|
|
||||||
|
build() {
|
||||||
|
npm ci
|
||||||
|
npm run build
|
||||||
|
rm -Rf "$builddir"/node_modules
|
||||||
|
npm ci --omit=dev
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
install -dm 755 \
|
||||||
|
"$pkgdir"/usr/share/webapps \
|
||||||
|
"$pkgdir"/usr/share/doc \
|
||||||
|
"$pkgdir"/usr/share/licenses/uptime-kuma \
|
||||||
|
"$pkgdir"/etc/init.d \
|
||||||
|
"$pkgdir"/etc/conf.d
|
||||||
|
|
||||||
|
# install
|
||||||
|
cp -a "$builddir" "$pkgdir/usr/share/webapps/uptime-kuma"
|
||||||
|
|
||||||
|
# openrc
|
||||||
|
install -Dm755 "$srcdir"/uptime-kuma.openrc "$pkgdir"/etc/init.d/uptime-kuma
|
||||||
|
install -Dm755 "$srcdir"/uptime-kuma.conf "$pkgdir"/etc/conf.d/uptime-kuma
|
||||||
|
|
||||||
|
# docs and licenses
|
||||||
|
mv "$pkgdir"/usr/share/webapps/uptime-kuma/LICENSE "$pkgdir"/usr/share/licenses/uptime-kuma/.
|
||||||
|
}
|
||||||
|
sha512sums="
|
||||||
|
6cd6aef96ac93597334b8fc7987611420b20ee45c5c1348ab42f05865fb679913038fd333416d239c43e047c9995553d2ab8e6fb7a05cea00d290fa05a26fa4e uptime-kuma-1.23.11.tar.gz
|
||||||
|
0ceddb98a6f318029b8bd8b5a49b55c883e77a5f8fffe2b9b271c9abf0ac52dc7a6ea4dbb4a881124a7857f1e43040f18755c1c2a034479e6a94d2b65a73d847 uptime-kuma.openrc
|
||||||
|
1dbae536b23e3624e139155abbff383bba3209ff2219983da2616b4376b1a5041df812d1e5164716fc6e967a8446d94baae3b96ee575d400813cc6fdc2cc274e uptime-kuma.conf
|
||||||
|
"
|
47
user/uptime-kuma/uptime-kuma.conf
Normal file
47
user/uptime-kuma/uptime-kuma.conf
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# uptime-kuma config
|
||||||
|
# for more info
|
||||||
|
# see https://github.com/louislam/uptime-kuma/wiki/Environment-Variables
|
||||||
|
|
||||||
|
# Set the directory where the data should be stored (could be relative)
|
||||||
|
# DATA_DIR=/var/lib/uptime-kuma
|
||||||
|
|
||||||
|
# Host to bind to, could be an ip.
|
||||||
|
# UPTIME_KUMA_HOST=::
|
||||||
|
|
||||||
|
# Port to listen to
|
||||||
|
# UPTIME_KUMA_PORT=3001
|
||||||
|
|
||||||
|
# Path to SSL key
|
||||||
|
# UPTIME_KUMA_SSL_KEY=
|
||||||
|
|
||||||
|
# Path to SSL certificate
|
||||||
|
# UPTIME_KUMA_SSL_CERT=
|
||||||
|
|
||||||
|
# SSL Key Passphrase
|
||||||
|
# UPTIME_KUMA_SSL_KEY_PASSPHRASE=
|
||||||
|
|
||||||
|
# Cloudflare Tunnel Token
|
||||||
|
# UPTIME_KUMA_CLOUDFLARED_TOKEN=
|
||||||
|
|
||||||
|
# By default, Uptime Kuma is not allowed in iframe if the domain name is not
|
||||||
|
# the same as the parent. It protects your Uptime Kuma to be a phishing
|
||||||
|
# website. If you don't need this protection, you can set it to true
|
||||||
|
# UPTIME_KUMA_DISABLE_FRAME_SAMEORIGIN=false
|
||||||
|
|
||||||
|
# By default, Uptime Kuma is verifying that the websockets ORIGIN-Header
|
||||||
|
# matches your servers hostname. If you don't need this protection, you can
|
||||||
|
# set it to bypass. See GHSA-mj22-23ff-2hrr for further context.
|
||||||
|
# UPTIME_KUMA_WS_ORIGIN_CHECK=cors-like
|
||||||
|
|
||||||
|
# Allow to specify any executables as Chromium
|
||||||
|
# UPTIME_KUMA_ALLOW_ALL_CHROME_EXEC=0
|
||||||
|
|
||||||
|
# Add your self-signed ca certs.
|
||||||
|
# NODE_EXTRA_CA_CERTS=
|
||||||
|
|
||||||
|
# Ignore all TLS errors
|
||||||
|
# NOTE_TLS_REJECT_UNAUTHORIZED=0
|
||||||
|
|
||||||
|
# Set it to --insecure-http-parser, if you encountered error Invalid header
|
||||||
|
# value char when your website using WAF
|
||||||
|
# NODE_OPTIONS=
|
48
user/uptime-kuma/uptime-kuma.openrc
Normal file
48
user/uptime-kuma/uptime-kuma.openrc
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
description="Uptime Kuma self-hosted monitoring tool"
|
||||||
|
|
||||||
|
# Change $directory to path to uptime-kuma
|
||||||
|
directory=${directory:-/usr/share/webapps/uptime-kuma}
|
||||||
|
pidfile=${pidfile:-/run/$RC_SVCNAME.pid}
|
||||||
|
DATA_DIR=${DATA_DIR:-/var/lib/uptime-kuma}
|
||||||
|
|
||||||
|
log_dir="/var/log/$RC_SVCNAME"
|
||||||
|
logfile=${logfile:-$log_dir/$RC_SVCNAME.log}
|
||||||
|
output_log="${output_log:-$logfile}"
|
||||||
|
error_log="${error_log:-$logfile}"
|
||||||
|
|
||||||
|
command=${command:-/usr/bin/node}
|
||||||
|
command_args="$directory/server/server.js"
|
||||||
|
command_user=${command_user:-uptime-kuma:uptime-kuma}
|
||||||
|
command_background=true
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need net
|
||||||
|
}
|
||||||
|
|
||||||
|
start_pre() {
|
||||||
|
checkpath --owner=$command_user --directory $log_dir \
|
||||||
|
$DATA_DIR \
|
||||||
|
$DATA_DIR/upload
|
||||||
|
checkpath --owner=$command_user --file $logfile \
|
||||||
|
$DATA_DIR/error.log
|
||||||
|
|
||||||
|
[ ! -e $DATA_DIR/kuma.db ] &&
|
||||||
|
cp $directory/db/kuma.db $DATA_DIR
|
||||||
|
|
||||||
|
checkpath --owner=$command_user --mode 600 --file $DATA_DIR/kuma.db*
|
||||||
|
|
||||||
|
cd $directory
|
||||||
|
|
||||||
|
export DATA_DIR UPTIME_KUMA_HOST UPTIME_KUMA_PORT UPTIME_KUMA_SSL_KEY \
|
||||||
|
UPTIME_KUMA_SSL_CERT UPTIME_KUMA_SSL_KEY_PASSPHRASE \
|
||||||
|
UPTIME_KUMA_CLOUDFLARED_TOKEN UPTIME_KUMA_DISABLE_FRAME_SAMEORIGIN \
|
||||||
|
UPTIME_KUMA_WS_ORIGIN_CHECK UPTIME_KUMA_ALLOW_ALL_CHROME_EXEC \
|
||||||
|
NODE_EXTRA_CA_CERTS NODE_TLS_REJECT_UNAUTHORIZED NODE_OPTIONS
|
||||||
|
}
|
||||||
|
|
||||||
|
start_post() {
|
||||||
|
# Wait for the server to be started
|
||||||
|
sleep 10
|
||||||
|
}
|
25
user/uptime-kuma/uptime-kuma.pre-install
Executable file
25
user/uptime-kuma/uptime-kuma.pre-install
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DATADIR='/var/lib/uptime-kuma'
|
||||||
|
|
||||||
|
if ! getent group uptime-kuma 1>/dev/null; then
|
||||||
|
echo '* Creating group uptime-kuma' 1>&2
|
||||||
|
|
||||||
|
addgroup -S uptime-kuma
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! id uptime-kuma 2>/dev/null 1>&2; then
|
||||||
|
echo '* Creating user uptime-kuma' 1>&2
|
||||||
|
|
||||||
|
adduser -DHS -G uptime-kuma -h "$DATADIR" -s /bin/sh \
|
||||||
|
-g "added by apk for uptime-kuma" uptime-kuma
|
||||||
|
passwd -u uptime-kuma 1>/dev/null # unlock
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! id -Gn uptime-kuma | grep -Fq www-data; then
|
||||||
|
echo '* Adding user uptime-kuma to group www-data' 1>&2
|
||||||
|
|
||||||
|
addgroup uptime-kuma www-data
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in a new issue