2 min read

Fancy self-hosted monitoring tool with Uptime Kuma

Fancy self-hosted monitoring tool with Uptime Kuma

Quick instruction on how to deploy Uptime-Kuma on your Server.

Uptime-Kuma is an easy to deploy and easy to use monitoring tool, that has several “Monitoring Types” like HTTP(s), port-checking, DNS and some more and also notify you in case of downtime. It includes some real nice alerting mechanisms as Mail, Teams and Gotify. If you want to find out more about Uptime-Kuma, you can find some here.

🐳 Docker

# Create a volume
docker volume create uptime-kuma

# Start the container
docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1

Browse to http://localhost:3001 after started.

Change Port and Volume

docker run -d --restart=always -p <YOUR_PORT>:3001 -v <YOUR_DIR OR VOLUME>:/app/data --name uptime-kuma louislam/uptime-kuma:1

💪🏻 Without Docker

It should supports Linux/Windows/MacOS. (Recommended for x86/x64 only)

Required Tools:

# Update your npm to the latest version
npm install npm -g

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

# Option 1. Try it
node server/server.js

# (Recommended)
# Option 2. Run in background using PM2
# Install PM2 if you don't have: npm install pm2 -g
pm2 start server/server.js --name uptime-kuma

Browse to http://localhost:3001 after started.

# Listen to different port or hostname
pm2 start server/server.js --name uptime-kuma -- --port=80 --host=0.0.0.0

Useful Command

pm2 start uptime-kuma
pm2 stop uptime-kuma
pm2 restart uptime-kuma

# Run at startup
pm2 startup

Nginx Reverse Proxy

This is optional for someone who want to use a reverse proxy.

Unlikely other web apps, Uptime Kuma is based on WebSocket. You need two more headers Upgrade and Connection in order to reverse proxy WebSocket.

Please read wiki for more info: https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy

server {
    listen 80;
    server_name <your_domain>;
    return 301 https://$host$request_uri;

}
server {
    listen 443 ssl;

    if ($host != "<your_domain>") {
        return 301 https://<your_domain>;
    }
    server_name <your_domain> <your_domain>;
    ssl_certificate /etc/letsencrypt/live/<your_domain>/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/<your_domain>/privkey.pem;

location / {
    proxy_pass http://localhost:3001/;
    proxy_set_header   Host <your_domain>;
    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_http_version 1.1;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
    }
}