Add depends_on field for core service ordering

* Adds depends_on fields to compose YAML
* Updates parsing code to copy across depends_on field to
openfaas service from compose service definition
* Adds algorithm and unit tests for finding order
* Applies order to up.go command
* Makes unit testing on MacOS possible through build directives

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2020-06-17 12:52:43 +01:00
committed by Alex Ellis
parent db5312158c
commit 2b9efd29a0
11 changed files with 533 additions and 96 deletions

View File

@ -1,12 +1,12 @@
version: "3.7"
services:
basic-auth-plugin:
image: docker.io/openfaas/basic-auth-plugin:0.18.17
image: "docker.io/openfaas/basic-auth-plugin:0.18.17${ARCH_SUFFIX}"
environment:
port: "8080"
secret_mount_path: "/run/secrets"
user_filename: "basic-auth-user"
pass_filename: "basic-auth-password"
- port=8080
- secret_mount_path=/run/secrets
- user_filename=basic-auth-user
- pass_filename=basic-auth-password
volumes:
# we assume cwd == /var/lib/faasd
- type: bind
@ -17,6 +17,7 @@ services:
target: /run/secrets/basic-auth-user
cap_add:
- CAP_NET_RAW
nats:
image: docker.io/library/nats-streaming:0.11.2
command:
@ -25,6 +26,7 @@ services:
- "8222"
- "--store=memory"
- "--cluster_id=faas-cluster"
prometheus:
image: docker.io/prom/prometheus:v2.14.0
volumes:
@ -33,21 +35,22 @@ services:
target: /etc/prometheus/prometheus.yml
cap_add:
- CAP_NET_RAW
gateway:
image: docker.io/openfaas/gateway:0.18.17
image: "docker.io/openfaas/gateway:0.18.17${ARCH_SUFFIX}"
environment:
basic_auth: "true"
functions_provider_url: "http://faasd-provider:8081/"
direct_functions: "false"
read_timeout: "60s"
write_timeout: "60s"
upstream_timeout: "65s"
faas_nats_address: "nats"
faas_nats_port: "4222"
auth_proxy_url: "http://basic-auth-plugin:8080/validate"
auth_proxy_pass_body: "false"
secret_mount_path: "/run/secrets"
scale_from_zero: "true"
- basic_auth=true
- functions_provider_url=http://faasd-provider:8081/
- direct_functions=false
- read_timeout=60s
- write_timeout=60s
- upstream_timeout=65s
- faas_nats_address=nats
- faas_nats_port=4222
- auth_proxy_url=http://basic-auth-plugin:8080/validate
- auth_proxy_pass_body=false
- secret_mount_path=/run/secrets
- scale_from_zero=true
volumes:
# we assume cwd == /var/lib/faasd
- type: bind
@ -58,18 +61,23 @@ services:
target: /run/secrets/basic-auth-user
cap_add:
- CAP_NET_RAW
depends_on:
- basic-auth-plugin
- nats
- prometheus
queue-worker:
image: docker.io/openfaas/queue-worker:0.11.2
environment:
faas_nats_address: "nats"
faas_nats_port: "4222"
gateway_invoke: "true"
faas_gateway_address: "gateway"
ack_wait: "5m5s"
max_inflight: "1"
write_debug: "false"
basic_auth: "true"
secret_mount_path: "/run/secrets"
- faas_nats_address=nats
- faas_nats_port=4222
- gateway_invoke=true
- faas_gateway_address=gateway
- ack_wait=5m5s
- max_inflight=1
- write_debug=false
- basic_auth=true
- secret_mount_path=/run/secrets
volumes:
# we assume cwd == /var/lib/faasd
- type: bind
@ -80,3 +88,5 @@ services:
target: /run/secrets/basic-auth-user
cap_add:
- CAP_NET_RAW
depends_on:
- nats