This is an answer to https://twitter.com/developius/status/892470102632923136 about his SSL with Docker Swarm, Let's Encrypt and Nginx blog post and a way to not kill Nginx for certificate generation/renewal.
(from what I read in the blog post)
- Docker hosts have a
/etc/letsencryptdirectory so that certificates are on the host and not on the container. - Docker hosts have a
/var/lib/letsencryptshared copy of the and a (docker run certbotcould also re-use containers'/var/lib/letsencryptvolumes.
I use /var/lib/letsencrypt/webroot/ as a place for the certbot Webroot plugin (--webroot) to store ACME Challenges, which are
then served by Nginx server for "/.well-known/acme-challenge/xxxxxxxxx" HTTP requests only.
Because, certbot's Webroot plugin only need an HTTP (not HTTPS) server to chat with about ACME Challenges, for new domains, I
first start Nginx with only the HTTP (port 80) server: the HTTPS (port 443) server block is commented, then run the
certbot certonly --webroot command.
Once first certificate has been issued, I can enable the HTTPS (port 443) server and reload Nginx.
Future certificate renewal (certbot renew --webroot) part is untouched (same as blog post).