Certbot will renew SSL certs

To create the service files: sudo systemctl edit --force --full certbot.service

/etc/systemd/system/certbot.service

[Unit]
Description=Certbot Renewal
 
[Service]
ExecStart=/home/kyle/docker/run_certbot.sh
 
[Install]
WantedBy=multi-user.target

To create the timer file: sudo systemctl edit --force --full certbot.timer

[Unit]
Description=Run Certbot weekly
 
[Timer]
OnCalendar=weekly
Persistent=true
 
[Install]
WantedBy=timers.target

The run_certbot.sh script is as follows:

#!/bin/bash
 
docker run --rm --pull=always -v /opt/docker/certbot/conf:/etc/letsencrypt -v /opt/docker/certbot/www:/var/www/certbot certbot/certbot:latest renew
docker restart docker-nginx-1

This will pull in the latest certbot container, then renew the certificates based on the configuration in /opt/docker/certbot, then it will restart nginx