Monitoring your servers is very crucial for any business/hobby project. It helps in case anything goes wrong you’ll be the first to know that services are not working or ssl is expiring so that you can fix the same before anyone else would know.
Docker is a great tool for bootstraping the applications and ship them as self contained runnable package of application with single command. In this guide we’ll be using docker for deploying our self hosted monitoring tool uptime kuma
.
Install docker on your server
curl -L get.docker.com | bash
Create a volume for persisting our monitoring service data
sudo docker volume create uptime-kuma
Launch the monitoring service container with the following command
sudo docker run -d --restart=always -p 127.0.0.1:3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma
Install nginx on your server to use https and proxy our docker container’s traffic
sudo apt install nginx
Configure site settings to proxy the traffic to our monitoring app
sudo nano /etc/nginx/sites-available/default
Replace the file content with the following content in the config file
server {
listen 80;
server_name sub.domain.com; # replace with your actual domain pointed to this server's IP
location / {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
Install letsencrypt for adding suppport free SSL support the monitoring service
sudo apt install certbot python3-certbot-nginx
Request certificate for your domain specfied in nginx config
sudo certbot --nginx -d sub.domain.com # replace with your domain
Finally reload the nginx server to apply the config and visit your new monitoring service app
sudo service nginx reload
Github repo for the awesome opensource project
Uptime-Kuma (while you’re there, give them a ⭐ )