Featured image of post Uptime Kuma on Raspberry Pi: High-Availability Monitoring

Uptime Kuma on Raspberry Pi: High-Availability Monitoring

A technical dive into the network and system architecture of my Uptime Kuma instance: Docker bridges, veth, and SSL optimization for an A+ score.

Introduction

Deploying your own monitoring service is a rewarding step, but understanding the underlying mechanics is what transforms a simple gadget into a reliable infrastructure.

On my Raspberry Pi 4 (Ubuntu Server, 4 GB RAM), I deployed Uptime Kuma (Node.js application) and Nginx Proxy Manager via Docker, exposing the monitoring dashboard (up.jamyvetter.net) over HTTPS.

In this article, we’ll dissect the setup: how Docker’s virtual networks (bridges, veth pairs, user-defined networks) route traffic, how services persist after reboot, and how we configured a wildcard Let’s Encrypt certificate for an A+ SSL rating.


1. Network Architecture: From WLAN to Virtual Interfaces

By default, Docker creates a virtual bridge on the host (docker0). This acts like a software switch: each container receives a virtual Ethernet interface pair (veth pair), with one peer inside the container network namespace (typically eth0) and the other peer attached to a bridge on the host.

The figure below illustrates this concept: containers connect via their veth peers to virtual switches on the host, enabling inter-container communication and network address translation (NAT) to the external network.

Docker Network Architecture: bridges, veth pairs, and containers

In practice, Docker manages network bridges on the host to route container traffic. For example, on my Pi, ip addr shows both docker0 and a user-defined bridge (br-1d79a610db3d, created for web-network), alongside the physical wlan0 interface on the local network:

1
2
3
4
5
6
7
$ ip addr 
...
3: wlan0: ... inet 192.168.1.34/24 ...
4: docker0: ... inet 172.17.0.1/16 ...
7: br-1d79a610db3d: ... inet 172.18.0.1/16 ...
12: veth04ac56b@if2: ... master docker0 ...
13: vetha092746@if3: ... master br-1d79a610db3d ...

Here, docker0 (172.17.0.1/16) is Docker’s default bridge, while br-1d79a610db3d (172.18.0.1/16) is a user-defined bridge network.

A veth pair acts like a virtual Ethernet cable spanning two network namespaces: one peer interface resides inside the container namespace (typically named eth0 or eth1), while the opposite peer resides on the host and is enslaved to a bridge (indicated by master docker0 or master br-...). A container can be connected to multiple networks, receiving an interface for each. In this output, the presence of these two host-side veth endpoints simply demonstrates that virtual interfaces are actively attached to their respective bridges (docker0 and br-1d79a610db3d), routing traffic between container namespaces and host networking.

User-defined networks enable service isolation: containers attached to the same custom bridge can discover and communicate with each other privately. To expose services, Docker publishes container ports onto the host. As shown in the systemctl status docker output below, docker-proxy helper processes bind the requested ports across both IPv4 (0.0.0.0) and IPv6 (::) host sockets:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
byron@serveur-pi:~$ systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: enabled)
     Active: active (running) since Sat 2025-12-27 18:52:39 CET; 1 week 1 day ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 924 (dockerd)
      Tasks: 83
     Memory: 132.9M (peak: 230.1M)
        CPU: 20min 32.488s
     CGroup: /system.slice/docker.service
             ├─  924 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
             ├─17157 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip 172.17.0.3 -container-port 80 -use-listen-fd
             ├─17164 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 80 -container-ip 172.17.0.3 -container-port 80 -use-listen-fd
             ├─17179 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 81 -container-ip 172.17.0.3 -container-port 81 -use-listen-fd
             ├─17186 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 81 -container-ip 172.17.0.3 -container-port 81 -use-listen-fd
             ├─17202 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 443 -container-ip 172.17.0.3 -container-port 443 -use-listen-fd
             ├─17209 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 443 -container-ip 172.17.0.3 -container-port 443 -use-listen-fd
             ├─17543 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3001 -container-ip 172.17.0.2 -container-port 3001 -use-listen-fd
             └─17549 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3001 -container-ip 172.17.0.2 -container-port 3001 -use-listen-fd

Here, the host kernel listens on port 443 and forwards incoming TCP streams to the Nginx Proxy Manager container. Publishing a Docker port binds the service to the selected host interfaces. Actual accessibility from the local network or the Internet still depends on host and network firewall rules.


2. System Persistence and Resilience

A robust monitoring setup must recover automatically after reboots or crashes. On my Pi, systemd manages the Docker daemon (dockerd), ensuring the Docker service starts at boot (Enabled: yes in systemctl). Checking systemctl status docker confirms Docker has been running continuously since boot.

To ensure each container restarts reliably, I configured Docker’s restart policy with restart: always (or unless-stopped). Docker will automatically restart the container if it exits unexpectedly or when the host daemon boots:

1
2
$ sudo docker inspect uptime-kuma --format '{{.HostConfig.RestartPolicy.Name}}'
always

This confirms the uptime-kuma container is configured to restart automatically. In normal operation, these containers consume minimal resources on the Raspberry Pi. A check via docker stats --no-stream confirms modest footprint (~210 MB RAM combined, negligible CPU):

1
2
3
4
byron@serveur-pi:~$ sudo docker stats --no-stream
CONTAINER ID   NAME                  CPU %     MEM USAGE / LIMIT     MEM %     NET I/O           BLOCK I/O       PIDS
da5c4ea6f827   nginx-proxy-manager   0.08%     98.73MiB / 3.696GiB   2.61%     72.2MB / 18.6MB   0B / 3.67MB     27
fa44d73c3096   uptime-kuma           0.60%     114MiB / 3.696GiB     3.01%     768MB / 42.2MB    41kB / 1.19GB   19

With approximately 210 MiB of total memory consumed, over 90% of the host RAM remains free for additional services and system operations.


3. SSL/TLS and Certificate Management

TLS Termination and HTTP/2

All HTTPS (TLS) termination is handled by the Nginx Proxy Manager container. Inside Docker, Nginx Proxy Manager acts as a reverse proxy: it listens on ports 80 and 443, handles TLS handshakes, and forwards decrypted HTTP requests to backend containers such as Uptime Kuma over the private Docker network.

Uptime Kuma itself does not terminate public TLS; it serves HTTP on its internal Docker port 3001, while Nginx Proxy Manager handles certificate management and HTTPS termination.

The NPM configuration confirms this architecture. Its generated proxy host configuration for up.jamyvetter.net includes:

1
2
3
4
5
6
7
8
9
listen 80;
listen 443 ssl;
server_name up.jamyvetter.net;
http2 on;
...
ssl_certificate /etc/letsencrypt/live/npm-1/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/npm-1/privkey.pem;
...
add_header Strict-Transport-Security "max-age=63072000; preload" always;

Key points from this configuration:

  • Port Listening: NPM binds ports 80 and 443 and performs the TLS handshake (listen 443 ssl).
  • HTTP/2 Enabled: http2 on enables multiplexing over TLS for improved throughput and lower latency.
  • TLS Certificate: Paths /etc/letsencrypt/live/npm-1/*.pem point to the persisted Let’s Encrypt keys inside the container volume.
  • HSTS Directive: The header Strict-Transport-Security "max-age=63072000; preload" instructs supporting browsers to enforce HTTPS connections for 2 years (63,072,000 seconds). The preload flag indicates an intention to submit the domain to Google’s HSTS Preload list (used by major browsers). However, official submission requires serving the header on the base domain with the includeSubDomains directive. In practice, includeSubDomains must not be added automatically: it strictly commits all current and future subdomains to HTTPS, which requires verifying that every internal and external sub-service fully supports TLS.
  • Redirect to HTTPS: The included force-ssl.conf ensures inbound HTTP traffic on port 80 is redirected to HTTPS.

Importantly, no Apache or Nginx service runs on the host OS itself; all web serving operates inside isolated Docker containers.

Security Headers and Cipher Suites

Achieving an A+ rating on SSL Labs requires strict transport security and modern cipher configurations:

  • Strict HSTS: Enforces HTTPS connections for 2 years via max-age=63072000. Note that activating this header is distinct from formal enrollment in the browser HSTS Preload list, which requires manual submission on hstspreload.org.
  • Strong Cipher Suites & TLS Versions: Modern ciphers (ECDHE with AES-GCM or ChaCha20, SHA-256/384) with TLS 1.2 and TLS 1.3 only. Legacy protocols (TLS 1.0/1.1) are disabled by default.
  • HTTP→HTTPS Redirection: Plain HTTP traffic is automatically upgraded.
  • SSL Session Caching and Request Hardening: NPM includes SSL session cache settings (ssl-cache.conf) and additional request filtering rules (block-exploits.conf).

Let’s Encrypt: DNS-01 Challenge and Remote Access Architecture

For certificate issuance, I configured Nginx Proxy Manager to use Let’s Encrypt with a DNS-01 challenge managed through the Cloudflare DNS API. The process operates as follows:

  1. Certificate Request: NPM’s ACME client initiates a certificate order for *.jamyvetter.net (wildcard).
  2. DNS-01 Challenge: Let’s Encrypt requests proof of domain control through a specialized DNS TXT record. Using Cloudflare API credentials, NPM automatically provisions _acme-challenge.jamyvetter.net.
  3. Validation: The Let’s Encrypt CA queries Cloudflare’s authoritative DNS servers for that TXT record. Locating the matching token confirms domain ownership. Using DNS-01 enables wildcard certificates. The certificate *.jamyvetter.net covers first-level subdomains such as up.jamyvetter.net, but does not automatically cover the apex domain or deeper nested subdomains.
  4. Certificate Issuance: Let’s Encrypt issues the certificate, stored by NPM under /etc/letsencrypt/live/npm-1/.
  5. Renewal: NPM checks certificate expiration daily via internal cron and automates renewals through the same DNS-01 mechanism before the 90-day validity expires.

Infrastructure Context: CGNAT, IPv6 Firewall, and DNS-01

Understanding the relationship between DNS-01 and network accessibility requires examining the actual topology of my home infrastructure:

  • IPv4 and CGNAT: My home internet connection (provided by an SFR router) operates under Carrier-Grade NAT (CGNAT) for IPv4. Because public IPv4 addresses are shared across multiple subscribers, standard inbound IPv4 port forwarding (NAT) is not available in this configuration.
  • IPv6 Connectivity and Firewall Rules: IPv6 is fully operational with a delegated prefix. The Raspberry Pi receives a global IPv6 address on its local network interface. On the router’s IPv6 firewall, a specific rule named HTTPS-Pi authorizes inbound TCP traffic on port 443 directed to the Raspberry Pi’s IPv6 address. No inbound rule exists for port 80.
  • Publication vs. Internet Reachability: It is critical not to confuse Docker port publication with external accessibility. As seen in systemctl status docker, docker-proxy binds ports 80, 81, 443, and 3001 locally on the Pi (0.0.0.0 and [::]). This allows local routing on the host and LAN, but incoming traffic from the public Internet is blocked by CGNAT on IPv4 and strictly filtered on IPv6 (where only TCP 443 is permitted).
  • The DNS-01 Advantage: The standard Let’s Encrypt HTTP-01 challenge requires an inbound HTTP connection on port 80 from the public Internet, which would fail under an IPv4 CGNAT environment without public port 80 exposure. In contrast, the DNS-01 challenge operates entirely out-of-band at the DNS level via Cloudflare API calls. Port 80 does not need to be accessible from Internet, making DNS-01 ideal for domestic and restricted network environments.

Certificate Verification

We can verify the certificate chain and expiration using OpenSSL. The following historical output shows the certificate issued during the initial deployment, with a validity period starting on December 28, 2025:

  • Chain and Expiration Inspection:
1
2
3
4
5
byron@serveur-pi:~$ openssl s_client -connect up.jamyvetter.net:443 -servername up.jamyvetter.net </dev/null 2>/dev/null | openssl x509 -noout -dates -issuer -subject
notBefore=Dec 28 00:28:17 2025 GMT
notAfter=Mar 28 00:28:16 2026 GMT
issuer=C = US, O = Let's Encrypt, CN = E8
subject=CN = *.jamyvetter.net
  • SSL Labs Verification: Visiting SSL Labs confirms the A+ rating and details supported protocols and cipher suites.
  • Certificate Storage: Certificates are stored under /etc/letsencrypt/live/npm-1/, persisted on a dedicated Docker volume so renewals survive container re-creations:
1
2
3
4
$ sudo docker exec nginx-proxy-manager ls -l /etc/letsencrypt/live/
total 8
-rw-r--r-- 1 root root  740 Dec 28 01:26 README
drwxr-xr-x 2 root root 4096 Dec 28 01:26 npm-1

The presence of the npm-1 folder confirms the active certificate.


Conclusion and Best Practices

This technical analysis highlights the system and network layers operating on a personal Raspberry Pi monitoring server:

  • Network Isolation: User-defined bridge networks allow backend containers (like Uptime Kuma) to communicate with the reverse proxy over isolated private subnets, keeping internal HTTP traffic segmented from other host workloads.
  • Port Mapping & Exposure: Remember that publishing ports via Docker creates local listening sockets on the host (docker-proxy), but upstream reachability from the Internet depends entirely on router firewalls and ISP NAT architectures (such as CGNAT).
  • Systemd + Restart Policies: Ensure the Docker daemon is enabled on boot. Use --restart=always (or unless-stopped) for persistent services.
  • Resource Monitoring: Use docker stats to verify memory and CPU consumption periodically.
  • TLS Offloading: Terminating TLS at the reverse proxy (Nginx Proxy Manager) simplifies backend container configuration and ensures strong security headers.
  • Let’s Encrypt with DNS-01: For wildcard certificates and environments where inbound port 80 is not available or desired (such as CGNAT), DNS-01 via DNS API credentials provides an automated, reliable verification path.

By understanding Docker’s network layer, configuring systemd persistence, and implementing robust TLS parameters, a personal Raspberry Pi becomes a resilient, well-structured monitoring server.

Thanks for reading!

Written with passion (and a few command lines) on my Raspberry Pi.