I am running a dockerized django app. I deployed it on EC2. Nginx is also in a docker container. Nginx in my docker-container is configured so that it uses ssl certificates from Lets Encrypt.
Lets Encrypt certificates are only valid for 90 day, that's why I set a cronjob to renew them.
My question now is: Will my nginx that runs in a docker container automatically use the updated file? Or do I need to spin up my docker container again and build it anew for the changes to take effect? In the latter case, is it possible to tell nginx to use the renewed file so I don't have to rebuild my container? I'm asking because I'd like to minimize downtime for my application.
For more clarity I provide my config. The important files are the referenced ssl certificates:
server {
listen 443 ssl;
server_name mydomain;
charset utf-8;
ssl_stapling off;
ssl_stapling_verify off;
ssl_certificate /etc/letsencrypt/live/mydomain/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mydomain/privkey.pem;
location / {
proxy_pass http://django:5000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Here my compose file:
production-nginx-container:
container_name: 'production-nginx-container'
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- /home/ubuntu/nginx-conf/myconf.conf:/etc/nginx/conf.d/default.conf
- /etc/letsencrypt/live/mydomain/fullchain.pem:/etc/letsencrypt/live/mydomain/fullchain.pem
- /etc/letsencrypt/live/mydomain/privkey.pem:/etc/letsencrypt/live/mydomain/privkey.pem
depends_on:
- django
I can only see two options: Either nginx keeps this file open the whole time while my docker container is running or it doesn't.
In case it keeps it open I assume I need to restart the docker container which I do not want :).
I'd appreciate any input! Thanks in advance!