Files
bsd-apps/uptime-kuma/uptime-kuma-install.sh

51 lines
1.5 KiB
Bash
Raw Normal View History

2024-09-13 07:33:03 -06:00
#!/bin/sh
# Install Uptime-Kuma
APP_NAME="Uptime-Kuma"
APP_VERSION="latest"
DATA_PATH="/mnt/data"
NODE_VERSION="18"
# Check for Root Privileges
2024-09-13 07:33:03 -06:00
if ! [ $(id -u) = 0 ]; then
echo "This script must be run with root privileges"
exit 1
fi
# Install Packages
pkg install -y \
git-lite \
npm-node"${NODE_VERSION}"
2024-09-13 07:33:03 -06:00
# Create Directories
2024-09-13 11:09:11 -06:00
mkdir -p "${DATA_PATH}"
mkdir -p /usr/local/etc/rc.d
mkdir -p /var/run/uptimekuma
2024-09-13 07:33:03 -06:00
# Uptime-Kuma Setup
2025-04-23 19:09:16 -06:00
id -u uptimekuma 2>&1 || pw user add uptimekuma -c uptimekuma -u 3001 -d /nonexistent -s /usr/bin/nologin
2024-09-13 07:33:03 -06:00
npm install npm -g
cd /usr/local/ && git clone https://github.com/louislam/uptime-kuma.git
2025-04-23 19:07:49 -06:00
if [ "${APP_VERSION}" = "latest" ]; then
cd /usr/local/uptime-kuma && npm run setup
else
2025-01-27 14:45:32 -07:00
cd /usr/local/uptime-kuma && git checkout "${APP_VERSION}" && npm ci --production && npm run download-dist
fi
2024-09-13 07:33:03 -06:00
sed -i '' "s|console.log(\"Welcome to Uptime Kuma\");|process.chdir('/usr/local/uptime-kuma');\n&|" /usr/local/uptime-kuma/server/server.js
2024-09-15 16:47:41 -06:00
fetch -o /usr/local/etc/rc.d/ https://raw.githubusercontent.com/tschettervictor/bsd-apps/main/uptime-kuma/includes/uptimekuma
2024-09-13 11:09:11 -06:00
chmod +x /usr/local/etc/rc.d/uptimekuma
2024-09-13 09:05:26 -06:00
chown -R uptimekuma:uptimekuma /var/run/uptimekuma
2024-09-13 08:51:34 -06:00
chown -R uptimekuma:uptimekuma /usr/local/uptime-kuma
2024-09-13 11:09:11 -06:00
chown -R uptimekuma:uptimekuma "${DATA_PATH}"
2024-09-13 07:33:03 -06:00
# Enable and Start Services
2024-09-13 08:21:13 -06:00
sysrc uptimekuma_enable="YES"
2024-09-13 11:09:11 -06:00
sysrc uptimekuma_datadir="${DATA_PATH}"
2024-09-13 08:21:13 -06:00
service uptimekuma start
2024-09-13 07:33:03 -06:00
# Done
2024-09-13 07:33:03 -06:00
echo "---------------"
echo "Installation Complete!"
echo "${APP_NAME} is running on port 3001"
2024-09-13 07:33:03 -06:00
echo "---------------"