Uptime Kuma is an open-source tools that allows you to monitor servers, websites and services that are running in your environment. It is a very useful tools for monitoring your lab environment. You can install Uptime Kuma as a standalone or in a Docker container.

For this tutorial I am going to show you how to install Uptime Kuma in a docker environment with Apache a reverse proxy on Ubuntu 22.04. There are 3 parts to this tutorial.

  1. Installing Docker
  2. Installing Uptime Kuma
  3. Installing Apache and Configure Reverse Proxy

Installing Docker Community Edition (Docker CE)

You can check out the official Docker website for more details and troubleshooting.

https://docs.docker.com/engine/install/ubuntu/

Here is the command to install the dependencies.

sudo apt install apt-transport-https curl gnupg-agent ca-certificates software-properties-common -y

Add Docker’s official GPG key:

sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Setup the repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Before you start installing Docker CE do a apt update. Then install the docker ce edition.

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Verify that Docker Engine is install successfully by running the hello-world image.

sudo docker run hello-world

Now you would have successfully installed Docker CE.

Installing Uptime Kuma

Installing Uptime Kuma in Docker is really straight forward. Now if you are changing the syntax for this install do remember them as you will need that when it is time to upgrade. For those that toy around with iptables and ports do remember what you have changed. You can use the script available on the Uptime Kuma github to automate the installation.
https://github.com/louislam/uptime-kuma/wiki/%F0%9F%94%A7-How-to-Install

curl -o kuma_install.sh http://git.kuma.pet/install.sh && sudo bash kuma_install.sh

You should be able to access Uptime Kuma on port 3001. Now if you are exposing this to the internet through a reverse proxy then follow the next part on install Apache and using it as a reverse proxy.

You should also check your Docker ip addresses if you are doing any form of iptables filtering or DNAT.

Installing Apache, Configure Reverse Proxy and Let’s Encrypt SSL certificates.

Install the Apache Web Server Package

sudo apt install apache2

Enter the Apache modules need for reverse proxy configuration

sudo a2enmod ssl proxy proxy_ajp proxy_wstunnel proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html

Use the following configuration for setting up reverse proxy through Apache Server in HTTP. Replace the uptime.youdomain.com with your actual domain name. You can also change port 80 to your desire port.

<VirtualHost *:80>
  ServerName sub.domain.com

  ProxyPass / http://localhost:3001/
  RewriteEngine on
  RewriteCond %{HTTP:Upgrade} websocket [NC]
  RewriteCond %{HTTP:Connection} upgrade [NC]
  RewriteRule ^/?(.*) "ws://localhost:3001/$1" [P,L]
</VirtualHost>

Activate the site in Apache.

sudo a2ensite uptime-kuma

Remember to restart your Apache Web Server.

sudo systemctl restart apache2