|
| 1 | +version: "3.3" |
| 2 | +services: |
| 3 | + gateway: |
| 4 | + ports: |
| 5 | + - ${ports.gateway}:8080 |
| 6 | + image: openfaas/gateway:${versions.gateway} |
| 7 | + networks: |
| 8 | + - functions |
| 9 | + environment: |
| 10 | + functions_provider_url: "http://faas-swarm:8080/" |
| 11 | + read_timeout: "300s" # Maximum time to read HTTP request |
| 12 | + write_timeout: "300s" # Maximum time to write HTTP response |
| 13 | + upstream_timeout: "300s" # Maximum duration of upstream function call - should be more than read_timeout and write_timeout |
| 14 | + dnsrr: "true" # Temporarily use dnsrr in place of VIP while issue persists on PWD |
| 15 | + faas_nats_address: "nats" |
| 16 | + faas_nats_port: 4222 |
| 17 | + direct_functions: "${direct_functions}" # Functions are invoked directly over the overlay network |
| 18 | + direct_functions_suffix: "" |
| 19 | + basic_auth: "${auth}" |
| 20 | + secret_mount_path: "/run/secrets/" |
| 21 | + scale_from_zero: "${scale_from_zero}" |
| 22 | + deploy: |
| 23 | + resources: |
| 24 | + # limits: # Enable if you want to limit memory usage |
| 25 | + # memory: 200M |
| 26 | + reservations: |
| 27 | + memory: 100M |
| 28 | + restart_policy: |
| 29 | + condition: on-failure |
| 30 | + delay: 5s |
| 31 | + max_attempts: 20 |
| 32 | + window: 380s |
| 33 | + placement: |
| 34 | + constraints: |
| 35 | + - 'node.platform.os == linux' |
| 36 | + secrets: |
| 37 | + - basic-auth-user |
| 38 | + - basic-auth-password |
| 39 | + |
| 40 | + faas-swarm: |
| 41 | + volumes: |
| 42 | + - "/var/run/docker.sock:/var/run/docker.sock" |
| 43 | + image: openfaas/faas-swarm:${versions.faas} |
| 44 | + networks: |
| 45 | + - functions |
| 46 | + environment: |
| 47 | + read_timeout: "300s" # set both here, and on your functions |
| 48 | + write_timeout: "300s" # set both here, and on your functions |
| 49 | + DOCKER_API_VERSION: "1.30" |
| 50 | + basic_auth: "${auth}" |
| 51 | + secret_mount_path: "/run/secrets/" |
| 52 | + deploy: |
| 53 | + placement: |
| 54 | + constraints: |
| 55 | + - 'node.role == manager' |
| 56 | + - 'node.platform.os == linux' |
| 57 | + resources: |
| 58 | + # limits: # Enable if you want to limit memory usage |
| 59 | + # memory: 100M |
| 60 | + reservations: |
| 61 | + memory: 100M |
| 62 | + restart_policy: |
| 63 | + condition: on-failure |
| 64 | + delay: 5s |
| 65 | + max_attempts: 20 |
| 66 | + window: 380s |
| 67 | + secrets: |
| 68 | + - basic-auth-user |
| 69 | + - basic-auth-password |
| 70 | + |
| 71 | + nats: |
| 72 | + image: nats-streaming:${versions.nats-streaming} |
| 73 | + # Uncomment the following port mappings if you wish to expose the |
| 74 | + # NATS client and/or management ports |
| 75 | + # ports: |
| 76 | + # - 4222:4222 |
| 77 | + # - 8222:8222 |
| 78 | + command: "--store memory --cluster_id faas-cluster" |
| 79 | + networks: |
| 80 | + - functions |
| 81 | + deploy: |
| 82 | + resources: |
| 83 | + limits: |
| 84 | + memory: 125M |
| 85 | + reservations: |
| 86 | + memory: 50M |
| 87 | + placement: |
| 88 | + constraints: |
| 89 | + - 'node.platform.os == linux' |
| 90 | + |
| 91 | + queue-worker: |
| 92 | + image: openfaas/queue-worker:${versions.queue-worker} |
| 93 | + networks: |
| 94 | + - functions |
| 95 | + environment: |
| 96 | + max_inflight: "1" |
| 97 | + ack_wait: "300s" # Max duration of any async task / request |
| 98 | + basic_auth: "${auth}" |
| 99 | + secret_mount_path: "/run/secrets/" |
| 100 | + deploy: |
| 101 | + resources: |
| 102 | + limits: |
| 103 | + memory: 50M |
| 104 | + reservations: |
| 105 | + memory: 20M |
| 106 | + restart_policy: |
| 107 | + condition: on-failure |
| 108 | + delay: 5s |
| 109 | + max_attempts: 20 |
| 110 | + window: 380s |
| 111 | + placement: |
| 112 | + constraints: |
| 113 | + - 'node.platform.os == linux' |
| 114 | + secrets: |
| 115 | + - basic-auth-user |
| 116 | + - basic-auth-password |
| 117 | + |
| 118 | + prometheus: |
| 119 | + image: prom/prometheus:${versions.prometheus} |
| 120 | + environment: |
| 121 | + no_proxy: "gateway" |
| 122 | + configs: |
| 123 | + - source: prometheus_config |
| 124 | + target: /etc/prometheus/prometheus.yml |
| 125 | + - source: prometheus_rules |
| 126 | + target: /etc/prometheus/alert.rules.yml |
| 127 | + command: |
| 128 | + - '--config.file=/etc/prometheus/prometheus.yml' |
| 129 | + ports: |
| 130 | + - ${ports.prometheus}:9090 |
| 131 | + networks: |
| 132 | + - functions |
| 133 | + deploy: |
| 134 | + placement: |
| 135 | + constraints: |
| 136 | + - 'node.role == manager' |
| 137 | + - 'node.platform.os == linux' |
| 138 | + resources: |
| 139 | + limits: |
| 140 | + memory: 500M |
| 141 | + reservations: |
| 142 | + memory: 200M |
| 143 | + |
| 144 | + alertmanager: |
| 145 | + image: prom/alertmanager:${versions.alertmanager} |
| 146 | + environment: |
| 147 | + no_proxy: "gateway" |
| 148 | + command: |
| 149 | + - '--config.file=/alertmanager.yml' |
| 150 | + - '--storage.path=/alertmanager' |
| 151 | + networks: |
| 152 | + - functions |
| 153 | + ports: |
| 154 | + - ${ports.alertmanager}:9093 |
| 155 | + deploy: |
| 156 | + resources: |
| 157 | + limits: |
| 158 | + memory: 50M |
| 159 | + reservations: |
| 160 | + memory: 20M |
| 161 | + placement: |
| 162 | + constraints: |
| 163 | + - 'node.role == manager' |
| 164 | + - 'node.platform.os == linux' |
| 165 | + configs: |
| 166 | + - source: alertmanager_config |
| 167 | + target: /alertmanager.yml |
| 168 | + |
| 169 | + |
| 170 | +configs: |
| 171 | + prometheus_config: |
| 172 | + file: ./prometheus/prometheus.yml |
| 173 | + prometheus_rules: |
| 174 | + file: ./prometheus/alert.rules.yml |
| 175 | + alertmanager_config: |
| 176 | + file: ./prometheus/alertmanager.yml |
| 177 | + |
| 178 | +networks: |
| 179 | + functions: |
| 180 | + driver: overlay |
| 181 | + attachable: true |
| 182 | + labels: |
| 183 | + - "openfaas=true" |
| 184 | + |
| 185 | +secrets: |
| 186 | + basic-auth-user: |
| 187 | + external: true |
| 188 | + basic-auth-password: |
| 189 | + external: true |
0 commit comments