How to add SSL cert to Uptime Kuma status page 路 Issue #786 路 louislam/uptime

您所在的位置:网站首页 中国通信产业集团官网 How to add SSL cert to Uptime Kuma status page 路 Issue #786 路 louislam/uptime

How to add SSL cert to Uptime Kuma status page 路 Issue #786 路 louislam/uptime

2023-08-24 08:53| 来源: 网络整理| 查看: 265

To use the docker arguments with LetsEncrypt, I do the following:

Get your SSL certs as standalone:

/usr/bin/certbot certonly --standalone --email [email protected] -d status.mydomain.com --agree-tos

This will generate the pem files in the directory

/etc/letsencrypt/live/status.mydomain.com/

Create the volume for your uptime-kuma container:

docker volume create uptime-kuma

You should now have the uptime-kuma docker volume directory:

/var/lib/docker/volumes/uptime-kuma/_data/

Create a directory called "ssl" in the docker volume directory:

mkdir -p /var/lib/docker/volumes/uptime-kuma/_data/ssl

Copy the *.pem files to the docker volume ssl directory you just created in step 3:

cp /etc/letsencrypt/live/status.mydomain.com/*.pem /var/lib/docker/volumes/uptime-kuma/_data/ssl

You should be able to see all the pem files when you do:

ls /var/lib/docker/volumes/uptime-kuma/_data/ssl

You now have to create a crontab to attempt renewal of the LetsEncrypt ssl certs on every 1st and 15th of every month and then copy the renewed certs to the docker volume directory and restart the uptime-kuma docker container:

0 0 1,15 * * /usr/bin/certbot renew --standalone --preferred-challenges http; cp /etc/letsencrypt/live/status.mydomain.com/*.pem /var/lib/docker/volumes/uptime-kuma/_data/ssl; /usr/bin/docker restart uptime-kuma

NOTE: This crontab will copy the pem files and restart the container whether the certs have expired or not. You can write a proper script to check if the certs are really expired before renewal, but the above is good enough for a start.

Fiinally you can start the uptime kuma container using the docker arguments for ssl cert and key file:

docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --env SSL_KEY="/app/data/ssl/privkey.pem" --env SSL_CERT="/app/data/ssl/fullchain.pem" --name uptime-kuma louislam/uptime-kuma:1

When you start the container, do a:

docker logs -f uptime-kuma

to see the startup process and make sure HTTPS is being used. You should see something like this:

Welcome to Uptime Kuma Node Env: production ... Version: 1.9.1 Creating express and socket.io instance Server Type: HTTPS Data Dir: ./data/ Connecting to Database ... ...

This method works well for me, no need to worry about the websockets.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3