Taken from here: https://medium.com/@nirgn/load-balancing-applications-with-haproxy-and-docker-d719b7c5b231
Created
April 13, 2018 20:40
-
-
Save raphaelcastaneda/e43352a9de168f01325254be34dedd14 to your computer and use it in GitHub Desktop.
Using HAProxy in docker
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' | |
services: | |
awesome: | |
image: awesome | |
ports: | |
- 8080 | |
environment: | |
- SERVICE_PORTS=8080 | |
deploy: | |
replicas: 20 | |
update_config: | |
parallelism: 5 | |
delay: 10s | |
restart_policy: | |
condition: on-failure | |
max_attempts: 3 | |
window: 120s | |
networks: | |
- web | |
proxy: | |
image: dockercloud/haproxy | |
depends_on: | |
- awesome | |
environment: | |
- BALANCE=leastconn | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
ports: | |
- 80:80 | |
networks: | |
- web | |
deploy: | |
placement: | |
constraints: [node.role == manager] | |
networks: | |
web: | |
driver: overlay |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment