Have lego get certs for my external domain as well

This commit is contained in:
IamTheFij 2025-02-24 10:06:17 -08:00
parent 3a90b097c8
commit 46fac59c3d

View File

@ -51,19 +51,26 @@ cd ${NOMAD_TASK_DIR}
echo "Read certs from nomad vars" echo "Read certs from nomad vars"
${NOMAD_TASK_DIR}/nomad-var-dirsync-linux-{{ env "attr.cpu.arch" }} -root-var=secrets/certs read . ${NOMAD_TASK_DIR}/nomad-var-dirsync-linux-{{ env "attr.cpu.arch" }} -root-var=secrets/certs read .
action=run function getcert() {
if [ -f /.lego/certificates/_.thefij.rocks.crt ]; then local domain=$1
action=run
if [ -f "/.lego/certificates/_.$domain.crt" ]; then
action=renew action=renew
fi fi
echo "Attempt to $action certificates" echo "Attempt to $action certificates"
${NOMAD_TASK_DIR}/lego \ ${NOMAD_TASK_DIR}/lego \
--accept-tos --pem \ --accept-tos --pem \
--email=iamthefij@gmail.com \ --email=iamthefij@gmail.com \
--domains="*.thefij.rocks" \ --domains="*.$domain" \
--dns="cloudflare" \ --dns="cloudflare" \
$action \ $action \
--$action-hook="${NOMAD_TASK_DIR}/nomad-var-dirsync-linux-{{ env "attr.cpu.arch" }} -root-var=secrets/certs write .lego" \ --$action-hook="${NOMAD_TASK_DIR}/nomad-var-dirsync-linux-{{ env "attr.cpu.arch" }} -root-var=secrets/certs write .lego" \
}
getcert "thefij.rocks"
getcert "iamthefij.com"
EOH EOH
destination = "${NOMAD_TASK_DIR}/start.sh" destination = "${NOMAD_TASK_DIR}/start.sh"
} }