Add update-kuma monitoring tool
This commit is contained in:
97
20240215223404-uptime_kuma.org
Normal file
97
20240215223404-uptime_kuma.org
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
:PROPERTIES:
|
||||||
|
:ID: e5e49b61-ee56-4364-a96e-48d72217ef95
|
||||||
|
:mtime: 20240217184904
|
||||||
|
:ctime: 20240215223404
|
||||||
|
:END:
|
||||||
|
#+title: uptime-kuma
|
||||||
|
|
||||||
|
* Installation
|
||||||
|
|
||||||
|
#+BEGIN_SRC shell
|
||||||
|
cd /opt
|
||||||
|
mkdir uptime-kuma
|
||||||
|
chown ubuntu:ubuntu uptime-kuma/
|
||||||
|
git clone https://github.com/louislam/uptime-kuma.git
|
||||||
|
cd uptime-kuma
|
||||||
|
npm run setup
|
||||||
|
npm install vite
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
useradd -m --system uptime
|
||||||
|
|
||||||
|
cat <<EOF > /usr/lib/systemd/system/update-kuma.service
|
||||||
|
[Unit]
|
||||||
|
Description=Uptime-Kuma - A free and open source uptime monitoring solution
|
||||||
|
Documentation=https://github.com/louislam/uptime-kuma
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=uptime
|
||||||
|
WorkingDirectory=/opt/uptime-kuma
|
||||||
|
ExecStart=/bin/bash -c 'PATH=/home/uptime/.n/bin:$PATH npm run start-server'
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable --now uptime-kuma
|
||||||
|
|
||||||
|
cat <<EOF > /etc/nginx/sites-available/uptime
|
||||||
|
server {
|
||||||
|
server_name tools.adrien.run;
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
server_name uptime.tools.adrien.run;
|
||||||
|
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
|
||||||
|
# SSL configuration
|
||||||
|
include /etc/nginx/ssl.conf;
|
||||||
|
ssl_certificate /etc/letsencrypt/live/uptime.tools.adrien.run/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/uptime.tools.adrien.run/privkey.pem;
|
||||||
|
|
||||||
|
# Logging configuration
|
||||||
|
access_log /var/log/nginx/uptime.access.log;
|
||||||
|
error_log /var/log/nginx/uptime.error.log;
|
||||||
|
|
||||||
|
root /opt/uptime-kuma;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_pass http://127.0.0.1:3002/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
server_name uptime.tools.adrien.run;
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
if ($host = uptime.tools.adrien.run) {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
systemctl restart nginx.service
|
||||||
|
certbot -d uptime.tools.adrien.run --nginx
|
||||||
|
#+END_SRC
|
Reference in New Issue
Block a user