Last active
December 19, 2017 12:39
-
-
Save Denys-Bushulyak/fd49e04a849f5a8b8725bd41fb170b83 to your computer and use it in GitHub Desktop.
Nginx proxy docker swarm example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.3" | |
volumes: | |
proxy: | |
networks: | |
proxy_network: | |
backend_network: #For connection another stacks to proxy. Should be created manualy. | |
external: true | |
services: | |
nginx: #proxy itself. Facade of proxy network. | |
image: nginx | |
labels: | |
- com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy | |
volumes: | |
- proxy:/etc/nginx/conf.d | |
- proxy:/etc/nginx/vhost.d | |
- proxy:/usr/share/nginx/html | |
- proxy:/etc/nginx/certs:ro | |
ports: | |
- 80:80 | |
- 443:443 | |
networks: | |
- proxy_network | |
nginx-gen: | |
image: jwilder/docker-gen | |
labels: | |
- com.github.jrcs.letsencrypt_nginx_proxy_companion.docker_gen | |
volumes: | |
- proxy:/etc/nginx/conf.d | |
- proxy:/etc/nginx/vhost.d | |
- proxy:/usr/share/nginx/html | |
- proxy:/etc/nginx/certs:ro | |
- ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro | |
- /var/run/docker.sock:/tmp/docker.sock:ro | |
command: -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf | |
networks: | |
- proxy_network | |
nginx-letsencrypt: | |
image: jrcs/letsencrypt-nginx-proxy-companion | |
volumes: | |
- proxy:/etc/nginx/conf.d | |
- proxy:/etc/nginx/vhost.d | |
- proxy:/usr/share/nginx/html | |
- proxy:/etc/nginx/certs:rw | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
networks: | |
- proxy_network | |
demo: #Just for demo. Expecting than real apps will be at it's own stack but connected to this proxy throw backend_network. | |
image: nginx:alpine | |
networks: | |
- proxy_network | |
environment: | |
- LETSENCRYPT_HOST=you-domain.com,demo.you-domain.com,registry.you-domain.com #yes, it have to be as list of all domains. And base have to be first. | |
- [email protected] | |
- VIRTUAL_HOST=demo.you-domain.com | |
registry: #Just for demo too. Expecting than real apps will be at it's own stack but connected to this proxy throw backend_network. | |
image: registry | |
networks: | |
- proxy_network | |
environment: | |
- LETSENCRYPT_HOST=you-domain.com,demo.you-domain.com,registry.you-domain.com #yes, it have to be as list of all domains. And base have to be first. | |
- [email protected] | |
- VIRTUAL_HOST=registry.you-domain.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment