Renew LetsEncrypt Certificate with docker compose and nginx proxy
Now a days, we have all of our services served via proxy. This allows us to run multiple apps on one single ip address. This is a great fit for deploying early small apps and saving costs.
When behind proxy, you map multiple domains/subdomains with it and also run them with SSL. You need certificate to be issued. Letsencrypt comes to the rescue. But how do we configure this all ? . Lets see .
First you need to do several configurations with nginx , setting where it is going to pickup the certificates from. You mount your app conf along with cerbot folders so that is is accessible within nginx container. The configuration in docker compose file looks like this:
Then you configure the certbot container with your app certificate folder mounted. This helps reading the files from nginx mounted locations for certificates.
We are also adding the reference of the app that was consumed, just to show several endpoints needed. If you look closely, the location to acme challenge endpoint, points to your mounted folders. This helps certbot to keep temporary file to read and verify the server.