Local dev setup vs prod setup (SSL, domains)

Hi! I'd like to use docker-compose to bring up my containers and traefik reverse proxy, and use the same file to deploy to production using docker swarm. I've read through the documentation, and it seems like for that I'll need duplicate labels in docker-compose.yml: some under labels and some under deploy.labels. Is that right, or can I share these labels between environments? If I can share them, how do I handle the fact that in prod they will have proper domain names (x.domain.com, y.domain.com, etc.) but on my local machine they will be fake domain names (x.domain.local, y.domain.local, etc.)? Finally, I've seen plenty of guidance on setting up SSL certificates with LetsEncrypt in production, but how do I handle that in development, on my local machine? I don't imagine LetsEncrypt will issue me a cert for x.domain.local, so should I use self-signed certs only in dev mode or something?

I've searched the documentation, GitHub issues, and the web and couldn't seem to find this info, though I imagine it's something everyone on here has had to encounter. Hope you can help! Thanks.


yes, you're right. On Swarm, you will have to put labels under deploy.labels while on compose, normal labels are fine.

What you could do, is having a separate compose-file (stack) which overwrites your defaults. (https://docs.docker.com/compose/extends/#adding-and-overriding-configuration) to seperate between dev & prod.

Thanks @SantoDE. Any ideas on how to handle SSL in development?

This project handle SSL, custom domains and few core webapps locally in a docker-compose set up. It would be the best way to do a demo to a client if you ask me :slight_smile:

Thanks, but I was hoping to limit the number of tools being used, as the other collaborators on the project are less experienced developers and I won't be around to support them. This is not a client project; it's a volunteer one for a small group. Is there a way to handle SSL in development with Traefik and docker-compose alone?

Hey @wilson29thid did you find a solution? I have the same problem.
thanks for sharing.