Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.90 KB | None | 0 0
  1. version: "3.3"
  2. services:
  3. frontproxy:
  4. image: traefik
  5. command: --api --docker
  6. ports:
  7. - "80:80"
  8. - "443:443"
  9. volumes:
  10. - ./certs:/etc/ssl:ro
  11. - ./traefik.toml:/etc/traefik/traefik.toml:ro
  12. - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
  13. labels:
  14. - traefik.port=8080
  15. - traefik.frontend.rule=Host:traefik.domain.local
  16. networks:
  17. - functions
  18. - default
  19.  
  20.  
  21. docker-registry:
  22. image: registry:2
  23. labels:
  24. - traefik.port=5000 # default port exposed by the registry
  25. - traefik.frontend.rule=Host:registry.domain.local
  26. - traefik.frontend.auth.basic=user:$$apr1$$9Cv/OMGj$$ZomWQzuQbL.3TRCS81A1g/ # user:password, see https://docs.traefik.io/configuration/backends/docker/#on-containers
  27.  
  28. gateway:
  29. ports:
  30. - 8080:8080
  31. image: openfaas/gateway:0.8.5
  32. networks:
  33. - functions
  34. environment:
  35. functions_provider_url: "http://faas-swarm:8080/"
  36. read_timeout: "300s" # Maximum time to read HTTP request
  37. write_timeout: "300s" # Maximum time to write HTTP response
  38. upstream_timeout: "300s" # Maximum duration of upstream function call - should be more than read_timeout and write_timeout
  39. dnsrr: "true" # Temporarily use dnsrr in place of VIP while issue persists on PWD
  40. faas_nats_address: "nats"
  41. faas_nats_port: 4222
  42. direct_functions: "true" # Functions are invoked directly over the overlay network
  43. direct_functions_suffix: ""
  44. basic_auth: "${BASIC_AUTH:-true}"
  45. secret_mount_path: "/run/secrets/"
  46. deploy:
  47. resources:
  48. # limits: # Enable if you want to limit memory usage
  49. # memory: 200M
  50. reservations:
  51. memory: 100M
  52. restart_policy:
  53. condition: on-failure
  54. delay: 5s
  55. max_attempts: 20
  56. window: 380s
  57. placement:
  58. constraints:
  59. - 'node.platform.os == linux'
  60. labels:
  61. - traefik.port=8080 # default port exposed by the registry
  62. - traefik.frontend.rule=Host:faas.domain.local
  63. secrets:
  64. - basic-auth-user
  65. - basic-auth-password
  66.  
  67. # Docker Swarm provider
  68. faas-swarm:
  69. volumes:
  70. - "/var/run/docker.sock:/var/run/docker.sock"
  71. # ports:
  72. # - 8081:8080
  73. image: openfaas/faas-swarm:0.3.5
  74. networks:
  75. - functions
  76. environment:
  77. read_timeout: "300s" # set both here, and on your functions
  78. write_timeout: "300s" # set both here, and on your functions
  79. DOCKER_API_VERSION: "1.30"
  80. deploy:
  81. placement:
  82. constraints:
  83. - 'node.role == manager'
  84. - 'node.platform.os == linux'
  85. resources:
  86. # limits: # Enable if you want to limit memory usage
  87. # memory: 100M
  88. reservations:
  89. memory: 100M
  90. restart_policy:
  91. condition: on-failure
  92. delay: 5s
  93. max_attempts: 20
  94. window: 380s
  95.  
  96. nats:
  97. image: nats-streaming:0.6.0
  98. # Uncomment the following port mappings if you wish to expose the
  99. # NATS client and/or management ports
  100. # ports:
  101. # - 4222:4222
  102. # - 8222:8222
  103. command: "--store memory --cluster_id faas-cluster"
  104. networks:
  105. - functions
  106. deploy:
  107. resources:
  108. limits:
  109. memory: 125M
  110. reservations:
  111. memory: 50M
  112. placement:
  113. constraints:
  114. - 'node.platform.os == linux'
  115.  
  116. queue-worker:
  117. image: openfaas/queue-worker:0.4.8
  118. networks:
  119. - functions
  120. environment:
  121. max_inflight: "1"
  122. ack_wait: "300s" # Max duration of any async task / request
  123. deploy:
  124. resources:
  125. limits:
  126. memory: 50M
  127. reservations:
  128. memory: 20M
  129. restart_policy:
  130. condition: on-failure
  131. delay: 5s
  132. max_attempts: 20
  133. window: 380s
  134. placement:
  135. constraints:
  136. - 'node.platform.os == linux'
  137. # End services
  138.  
  139. # Start monitoring
  140.  
  141. prometheus:
  142. image: prom/prometheus:v2.2.0
  143. environment:
  144. no_proxy: "gateway"
  145. configs:
  146. - source: prometheus_config
  147. target: /etc/prometheus/prometheus.yml
  148. - source: prometheus_rules
  149. target: /etc/prometheus/alert.rules.yml
  150. command:
  151. - '--config.file=/etc/prometheus/prometheus.yml'
  152. # - '-storage.local.path=/prometheus'
  153. ports:
  154. - 9090:9090
  155. networks:
  156. - functions
  157. deploy:
  158. placement:
  159. constraints:
  160. - 'node.role == manager'
  161. - 'node.platform.os == linux'
  162. resources:
  163. limits:
  164. memory: 500M
  165. reservations:
  166. memory: 200M
  167.  
  168. alertmanager:
  169. image: prom/alertmanager:v0.15.0-rc.0
  170. environment:
  171. no_proxy: "gateway"
  172. command:
  173. - '--config.file=/alertmanager.yml'
  174. - '--storage.path=/alertmanager'
  175. networks:
  176. - functions
  177. # Uncomment the following port mapping if you wish to expose the Prometheus
  178. # Alertmanager UI.
  179. # ports:
  180. # - 9093:9093
  181. deploy:
  182. resources:
  183. limits:
  184. memory: 50M
  185. reservations:
  186. memory: 20M
  187. placement:
  188. constraints:
  189. - 'node.role == manager'
  190. - 'node.platform.os == linux'
  191. configs:
  192. - source: alertmanager_config
  193. target: /alertmanager.yml
  194.  
  195.  
  196. configs:
  197. prometheus_config:
  198. file: ./prometheus/prometheus.yml
  199. prometheus_rules:
  200. file: ./prometheus/alert.rules.yml
  201. alertmanager_config:
  202. file: ./prometheus/alertmanager.yml
  203.  
  204. networks:
  205. functions:
  206. driver: overlay
  207. attachable: true
  208. labels:
  209. - "openfaas=true"
  210.  
  211. secrets:
  212. basic-auth-user:
  213. external: true
  214. basic-auth-password:
  215. external: true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement