Skip to content

kamaranl/uptime

Repository files navigation

uptime

A minimal Fastify server that streams the output of the uptime command to a web page in real time via WebSocket.

Features

  • Live system uptime displayed in the browser
  • Fastify server with WebSocket support
  • Simple, responsive HTML frontend

Getting Started

  1. Install dependencies:

    npm install
  2. Run the server:

    npm start
  3. Visit http://localhost:3000 to see live uptime updates.

Docker

Quickstart:

docker run --name uptime -v /proc/uptime:/proc/uptime -p 3000:3000 kamaranl/uptime

...or build yourself and run with Docker:

docker build -t uptime .
docker run --name uptime -v /proc/uptime:/proc/uptime -p 3000:3000 uptime

NGINX

example config:

# /etc/nginx/conf.d/default.conf
server {
    listen 80 default_server;
    listen 443 default_server ssl;
    server_name _;

    http2 on;
    ssl_certificate /etc/ssl/certs/default.crt;
    ssl_certificate_key /etc/ssl/private/default_key;

    location / {
        proxy_pass http://uptime:3000;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_buffering off;
        proxy_request_buffering off;
    }

    location /ws {
        proxy_pass http://uptime:3000/ws;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Origin '';
    }
}

License

MIT © 2025 Kamaran Layne

About

Get server uptime over websocket.

Resources

License

Stars

Watchers

Forks