web: always try to renew cert on container boot
acme.sh is smart enough to not send the request out unless it's necessary.
This commit is contained in:
@@ -14,29 +14,30 @@ if [[ $DISABLE_HTTPS -ne 1 ]]; then
|
|||||||
pushd /opt
|
pushd /opt
|
||||||
sh ./acme.sh --install --home /config/acme.sh --accountemail $LETSENCRYPT_EMAIL
|
sh ./acme.sh --install --home /config/acme.sh --accountemail $LETSENCRYPT_EMAIL
|
||||||
popd
|
popd
|
||||||
if [[ ! -f /config/acme-certs/$LETSENCRYPT_DOMAIN/fullchain.pem ]]; then
|
|
||||||
STAGING=""
|
STAGING=""
|
||||||
if [[ $LETSENCRYPT_USE_STAGING -eq 1 ]]; then
|
if [[ $LETSENCRYPT_USE_STAGING -eq 1 ]]; then
|
||||||
STAGING="--staging"
|
STAGING="--staging"
|
||||||
fi
|
fi
|
||||||
export LE_WORKING_DIR="/config/acme.sh"
|
export LE_WORKING_DIR="/config/acme.sh"
|
||||||
# TODO: move away from standalone mode to webroot mode.
|
# TODO: move away from standalone mode to webroot mode.
|
||||||
/config/acme.sh/acme.sh \
|
/config/acme.sh/acme.sh \
|
||||||
$STAGING \
|
$STAGING \
|
||||||
--issue \
|
--issue \
|
||||||
--standalone \
|
--standalone \
|
||||||
--pre-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -d /var/run/s6/services/nginx; fi" \
|
--pre-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -d /var/run/s6/services/nginx; fi" \
|
||||||
--post-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -u /var/run/s6/services/nginx; fi" \
|
--post-hook "if [[ -f /var/run/s6/services/nginx ]]; then s6-svc -u /var/run/s6/services/nginx; fi" \
|
||||||
-d $LETSENCRYPT_DOMAIN
|
-d $LETSENCRYPT_DOMAIN
|
||||||
rc=$?
|
rc=$?
|
||||||
if [[ $rc -eq 1 ]]; then
|
if [[ $rc -eq 1 ]]; then
|
||||||
echo "Failed to obtain a certificate from the Let's Encrypt CA."
|
echo "Failed to obtain a certificate from the Let's Encrypt CA."
|
||||||
# this tries to get the user's attention and to spare the
|
# this tries to get the user's attention and to spare the
|
||||||
# authority's rate limit:
|
# authority's rate limit:
|
||||||
sleep 15
|
sleep 15
|
||||||
echo "Exiting."
|
echo "Exiting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [[ $rc -eq 0 ]]; then
|
||||||
mkdir -p /config/acme-certs/$LETSENCRYPT_DOMAIN
|
mkdir -p /config/acme-certs/$LETSENCRYPT_DOMAIN
|
||||||
if ! /config/acme.sh/acme.sh \
|
if ! /config/acme.sh/acme.sh \
|
||||||
--install-cert -d $LETSENCRYPT_DOMAIN \
|
--install-cert -d $LETSENCRYPT_DOMAIN \
|
||||||
|
|||||||
Reference in New Issue
Block a user