this post was submitted on 15 Apr 2025
16 points (100.0% liked)
Tech
1203 readers
1 users here now
A community for high quality news and discussion around technological advancements and changes
Things that fit:
- New tech releases
- Major tech changes
- Major milestones for tech
- Major tech news such as data breaches, discontinuation
Things that don't fit
- Minor app updates
- Government legislation
- Company news
- Opinion pieces
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Automating the ssl certificate for my django project in docker is still one of my greatest feat, So, I can understand the frustration of managing multiple services.
Tell me more please
Hey, I was busy with some issues, so I wasn't able to be active in online spaces. I'm sharing the final tailored draft I documented for my personal use. Please let me know if something doesn't seem to be on point or needs explanation.
I will also attach the workflow image if possible.
for dev and prod we have different configuration which is used depending on the environment.
for dev
for prod we use configuration
So what's the issue ?
Issues arises when we are deploying the project to production and server(nginx) is booting for the first time inside the docker. We can't use prod configuration as it require updating some variables and path such as ssl(TLS) cert path, which isn't the big problem as such because we can do it anyway and refresh the nginx once we are done with acme challenges but that would be just quick fix than doing it right way and will be creating too many loose ends.
fixing it
With some testing and looking here and there came up with
nginx/manager.sh
which verify if certificate is present, if not load thenginx.dev.conf
.certbot-init.sh
"/etc/letsencrypt/live/${DOMAIN}/fullchain.pem"
.nginx.prod.conf
) is loaded asAuto-renew the certificate
Auto-renew is easy to setup we just mash up a cron job and a certification change detection script along with
nginx/manager.sh
andcertbot-init.sh
.nginx/manager.sh
certbot-init.sh