docker-stack.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. version: "3"
  2. services:
  3. redis:
  4. image: redis:alpine
  5. ports:
  6. - "6379"
  7. networks:
  8. - frontend
  9. deploy:
  10. replicas: 2
  11. update_config:
  12. parallelism: 2
  13. delay: 10s
  14. restart_policy:
  15. condition: on-failure
  16. db:
  17. image: postgres:9.4
  18. volumes:
  19. - db-data:/var/lib/postgresql/data
  20. networks:
  21. - backend
  22. deploy:
  23. placement:
  24. constraints: [node.role == manager]
  25. vote:
  26. image: dockersamples/examplevotingapp_vote
  27. ports:
  28. - 5000:80
  29. networks:
  30. - frontend
  31. depends_on:
  32. - redis
  33. deploy:
  34. replicas: 2
  35. update_config:
  36. parallelism: 2
  37. restart_policy:
  38. condition: on-failure
  39. result:
  40. image: dockersamples/examplevotingapp_result
  41. ports:
  42. - 5001:80
  43. networks:
  44. - backend
  45. depends_on:
  46. - db
  47. deploy:
  48. replicas: 2
  49. update_config:
  50. parallelism: 2
  51. delay: 10s
  52. restart_policy:
  53. condition: on-failure
  54. worker:
  55. image: dockersamples/examplevotingapp_worker
  56. networks:
  57. - frontend
  58. - backend
  59. deploy:
  60. mode: replicated
  61. replicas: 1
  62. labels: [APP=VOTING]
  63. restart_policy:
  64. condition: on-failure
  65. delay: 10s
  66. max_attempts: 3
  67. window: 120s
  68. visualizer:
  69. image: manomarks/visualizer
  70. ports:
  71. - "8080:8080"
  72. stop_grace_period: 1m30s
  73. volumes:
  74. - "/var/run/docker.sock:/var/run/docker.sock"
  75. networks:
  76. frontend:
  77. backend:
  78. volumes:
  79. db-data: