Skip to content

Commit df8d5f5

Browse files
authoredMar 3, 2025
Task/WI-202: insert letsencrypt post-renewal hook after deploy (#58)
* add step to place a letsencrypt post-renew hook * update makefile * fix script name
1 parent 8ca90f9 commit df8d5f5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

‎Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ else
2424
override COMPOSE =
2525
endif
2626

27-
DOCKER_COMPOSE := ${COMPOSE_COMMAND} ${BASE_COMPOSE} ${COMPOSE} --env-file=$(ENV_FILE)
27+
DOCKER_COMPOSE := ${COMPOSE_COMMAND} ${BASE_COMPOSE} ${COMPOSE} --env-file=$(pwd)/$(ENV_FILE)
28+
29+
# This command uses an Alpine linux image to run a script to add a post-renew hook to letsencrypt
30+
PLACE_RENEWAL_HOOK := docker run -e DOCKER_COMPOSE=${DOCKER_COMPOSE} -v /etc/letsencrypt:/etc/letsencrypt -v ${CAMINO_HOME}/conf/scripts/post-renew.sh:/opt-post-renew.sh alpine:3 /bin/sh -c "chmod +x /opt/post-renew.sh && /opt/post-renew.sh"
2831

2932
.PHONY: deploy-docs
3033
deploy-docs:
@@ -76,6 +79,7 @@ ifdef POST_DEPLOY_SCRIPT
7679
chmod +x ${CAMINO_HOME}/conf/camino/${POST_DEPLOY_SCRIPT} && ${CAMINO_HOME}/conf/camino/${POST_DEPLOY_SCRIPT} all
7780
endif
7881
$(DOCKER_COMPOSE) restart nginx
82+
$(PLACE_RENEWAL_HOOK)
7983

8084
.PHONY: migrate
8185
migrate:

‎conf/scripts/post-renew.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#! /bin/sh
2+
mkdir -p /etc/letsencrypt/renewal-hooks/post/
3+
echo -e "#! /bin/sh\n${DOCKER_COMPOSE} restart nginx\n" > /etc/letsencrypt/renewal-hooks/post/post-renew.sh
4+
chmod +x /etc/letsencrypt/renewal-hooks/post/post-renew.sh

0 commit comments

Comments
 (0)