Skip to content

Commit

Permalink
Use deploy hook to trigger success script for certbot
Browse files Browse the repository at this point in the history
  • Loading branch information
akmiller01 authored and edwinmp committed Feb 1, 2021
1 parent 3b6cbd1 commit dba07c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
15 changes: 2 additions & 13 deletions certbot.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
#!/bin/bash
working_directory=/root/ddw-analyst-ui/
renewal_result="$(command certbot renew --webroot -w /root/ddw-analyst-ui/static/letsencrypt)"
#Check if successful result is received
result="$(echo $renewal_result | grep -o Congratulations )"

#If successful copy certs to the correct folder and refresh nginx docker node
if [ $result ]; then
cd $working_directory
cp -f /etc/letsencrypt/live/ddw.devinit.org/privkey.pem /root/ddw-analyst-ui/ssl/
cp -f /etc/letsencrypt/live/ddw.devinit.org/fullchain.pem /root/ddw-analyst-ui/ssl/

command docker-compose exec ddw-analyst-ui_nginx_1 nginx reload
fi
working_directory=/root/ddw-analyst-ui
command certbot renew --webroot -w "$working_directory"/static/letsencrypt --deploy-hook "$working_directory"/certbot_success.sh
8 changes: 8 additions & 0 deletions certbot_success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
working_directory=/root/ddw-analyst-ui
#If successful copy certs to the correct folder and refresh nginx docker node
cd $working_directory
cp -f /etc/letsencrypt/live/ddw.devinit.org/privkey.pem /root/ddw-analyst-ui/ssl/
cp -f /etc/letsencrypt/live/ddw.devinit.org/fullchain.pem /root/ddw-analyst-ui/ssl/

command docker-compose exec ddw-analyst-ui_nginx_1 nginx reload

0 comments on commit dba07c9

Please sign in to comment.