Created
October 11, 2017 07:16
-
-
Save charignon/070eec6125531d75867644dc32a9e00d to your computer and use it in GitHub Desktop.
Makefile to simplify let's encrypt domain maintenance using lego, digital ocean spaces and dns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: new renew upload download | |
ENDPOINT=--endpoint-url https://nyc3.digitaloceanspaces.com | |
AWS=aws ${ENDPOINT} | |
LEGO=lego --accept-tos --email xxx --dns digitalocean | |
S3_PATH="s3://domain-certificates/acme" | |
LOCAL_PATH=${PWD}/.lego | |
DOMAINS=`ls .lego/certificates | grep key | sed "s/.key$$//"` | |
new: | |
@$(if ${DOMAIN}, echo "Setting up ${DOMAIN}", echo "Please set DOMAIN env var" ; exit 1 ) | |
${LEGO} -d ${DOMAIN} run | |
renew: | |
@echo "Renewing ${DOMAINS}" | |
@for d in ${DOMAINS};do ${LEGO} -d $$d renew --days 30 ; done | |
upload: | |
@echo "uploading" | |
${AWS} s3 sync ${PWD}/.lego ${S3_PATH} | |
download: | |
@echo "Download" | |
${AWS} s3 sync ${S3_PATH} ${PWD}/.lego |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment