Created
February 8, 2017 22:13
-
-
Save vovimayhem/6920ecfa5a37c6fe807b903d3b728587 to your computer and use it in GitHub Desktop.
Docker Voting App Demo with fancy container placement
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: | |
| redis: | |
| image: redis:alpine | |
| ports: | |
| - "6379" | |
| networks: | |
| - frontend | |
| deploy: | |
| replicas: 2 | |
| update_config: | |
| parallelism: 2 | |
| delay: 10s | |
| restart_policy: | |
| condition: on-failure | |
| placement: | |
| constraints: | |
| - node.labels.data-host == true | |
| db: | |
| image: postgres:9.4 | |
| volumes: | |
| - db-data:/var/lib/postgresql/data | |
| networks: | |
| - backend | |
| deploy: | |
| placement: | |
| constraints: | |
| - node.labels.data-host == true | |
| vote: | |
| image: dockersamples/examplevotingapp_vote:before | |
| ports: | |
| - 5000:80 | |
| networks: | |
| - frontend | |
| depends_on: | |
| - redis | |
| deploy: | |
| replicas: 2 | |
| update_config: | |
| parallelism: 2 | |
| restart_policy: | |
| condition: on-failure | |
| placement: | |
| constraints: | |
| - node.labels.public-host == true | |
| result: | |
| image: dockersamples/examplevotingapp_result:before | |
| ports: | |
| - 5001:80 | |
| networks: | |
| - backend | |
| depends_on: | |
| - db | |
| deploy: | |
| replicas: 1 | |
| update_config: | |
| parallelism: 2 | |
| delay: 10s | |
| restart_policy: | |
| condition: on-failure | |
| placement: | |
| constraints: | |
| - node.labels.public-host == true | |
| worker: | |
| image: dockersamples/examplevotingapp_worker | |
| networks: | |
| - frontend | |
| - backend | |
| deploy: | |
| mode: replicated | |
| replicas: 1 | |
| labels: [APP=VOTING] | |
| restart_policy: | |
| condition: on-failure | |
| delay: 10s | |
| max_attempts: 3 | |
| window: 120s | |
| placement: | |
| constraints: | |
| - node.labels.app-host == true | |
| visualizer: | |
| image: dockersamples/visualizer:stable | |
| ports: | |
| - "8080:8080" | |
| stop_grace_period: 1m30s | |
| volumes: | |
| - "/var/run/docker.sock:/var/run/docker.sock" | |
| deploy: | |
| placement: | |
| constraints: [node.role == manager] | |
| networks: | |
| frontend: | |
| backend: | |
| volumes: | |
| db-data: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment