Add support for only running once

This commit is contained in:
Nico Schottelius 2021-07-19 22:56:51 +02:00
parent 4a78e429bb
commit d6407cdf7d
2 changed files with 11 additions and 1 deletions

View file

@ -28,6 +28,12 @@ docker run -e DOMAIN=example.com \
ungleich/ungleich-certbot
```
### Exiting after getting the certificate
By default, the container will stay alive and try to renew the
certificate every 86400 seconds. If you set the environment variable
`ONLYGETCERT`, then it will only get the certificates and exit.
## Volumes
If you want to keep / use your certificates, you are advised to create
@ -35,4 +41,4 @@ a volume below /etc/letsencrypt.
## Kubernetes
Sample kubernetes usage: (TBD)
See https://code.ungleich.ch/ungleich-public/ungleich-k8s/.

View file

@ -26,6 +26,10 @@ while [ ! -f "/etc/letsencrypt/live/${DOMAIN}/fullchain.pem" ]; do
fi
done
if [ "$ONLYGETCERT" ]; then
exit 0
fi
# Try to renew once per day
while true; do
/usr/bin/certbot renew