Description
I am struggling to set up the faas-flow-tower
utility.
Let's say what I tried...
I tried setting up a simple flow-test
function as follows:
flow-test.yml:
version: 1.0
provider:
name: openfaas
gateway: http://127.0.0.1:9999
functions:
flow-test:
lang: faas-flow
handler: ./flow-test
image: localhost:5000/flow-test:latest
labels:
faas-flow: 1
annotations:
faas-flow-desc: "test flow to greet"
environment_file:
- flow.yml
secrets:
- s3-secret-key
- s3-access-key
flow.yml:
environment:
gateway: "gateway.openfaas:8080" # The address of OpenFaaS gateway
enable_tracing: true # tracing allows to monitor requests
trace_server: "jaeger-agent.faasflow:5775" # The address of jaeger tracing agent
consul_url: "consul.faasflow:8500" # The address of consul
s3_url: "minio.faasflow:9000" # The address of minio
flow-test/handler.go:
package function
import (
faasflow "github.com/faasflow/lib/openfaas"
)
// Define provide definition of the workflow
func Define(flow *faasflow.Workflow, context *faasflow.Context) (err error) {
flow.SyncNode().Modify(func(data []byte) ([]byte, error) {
result := "Hello " + string(data)
return []byte(result), nil
})
return nil
}
// OverrideStateStore provides the override of the default StateStore
func OverrideStateStore() (faasflow.StateStore, error) {
// NOTE: By default FaaS-Flow use consul as a state-store,
// This can be overridden with other synchronous KV store (e.g. ETCD)
return nil, nil
}
// OverrideDataStore provides the override of the default DataStore
func OverrideDataStore() (faasflow.DataStore, error) {
// NOTE: By default FaaS-Flow use minio as a data-store,
// This can be overridden with other synchronous KV store
return nil, nil
}
$ faas-cli up -f flow-test.yml
...
Deploying: flow-test.
Deployed. 202 Accepted.
URL: http://127.0.0.1:9999/function/flow-test
$ echo "Abhishek" | faas-cli invoke flow-test
Hello Abhishek
So far so good.
The problem happens when I try to use faas-flow-tower
.
faas-flow-tower/conf.yml:
environment:
basic_auth: true
gateway_public_uri: "http://localhost:9999"
gateway_url: "http://gateway.openfaas:8080/"
secret_mount_path: "/var/openfaas/secrets"
trace_url: "http://jaeger-query.faasflow:16686/"
In the above file I made change to the gateway_public_uri
faas-flow-tower/stack.yml:
provider:
name: openfaas
gateway: http://127.0.0.1:9999
functions:
# dashboard
faas-flow-dashboard:
lang: dockerfile
handler: ./dashboard
image: localhost:5000/faas-flow-dashboard:3.0.8
environment:
read_debug: true
write_debug: true
combine_output: false
environment_file:
- conf.yml
secrets:
- basic-auth
labels:
com.openfaas.scale.zero: "false"
# list flow functions deployed in openfaas
list-flow-functions:
lang: go
handler: ./list-flow-functions
image: localhost:5000/list-flow-functions:1.0.1
environment:
read_debug: true
write_debug: true
combine_output: false
environment_file:
- conf.yml
secrets:
- basic-auth
labels:
com.openfaas.scale.zero: "false"
# Generate dot graph for faas-flow
dot-generator:
lang: go
handler: ./dot-generator
image: localhost:5000/dot-generator:1.2.0
environment_file:
- conf.yml
environment:
read_timeout: 120
read_debug: true
write_timeout: 120
write_debug: true
combine_output: false
labels:
com.openfaas.scale.zero: "false"
# Collect metrics for faas-flow
metrics:
lang: go
handler: ./metrics
image: localhost:5000/metrics:1.6.0
environment_file:
- conf.yml
environment:
read_debug: true
read_timeout: 120
write_timeout: 120
write_debug: true
combine_output: false
labels:
com.openfaas.scale.zero: "false"
Under faas-flow-dashboard
I just changed lang: Dockerfile
to lang: dockerfile
, and added the image local to be saved in local registry.
Before deploying I created a basic-auth
secret as follows (I doubt this basic-auth
step which I did):
kubectl create secret generic basic-auth --from-literal=username=abhishek --from-literal=password=abhishek --namespace openfaas-fn
And then I deploy faas-flow-tower
as:
$ faas-cli up -g http://127.0.0.1:9999
...
Deploying: dot-generator.
Deployed. 202 Accepted.
URL: http://127.0.0.1:9999/function/dot-generator
Deploying: metrics.
Deployed. 202 Accepted.
URL: http://127.0.0.1:9999/function/metrics
Deploying: faas-flow-dashboard.
Deployed. 202 Accepted.
URL: http://127.0.0.1:9999/function/faas-flow-dashboard
Deploying: list-flow-functions.
Deployed. 202 Accepted.
URL: http://127.0.0.1:9999/function/list-flow-functions
faas-flow-tower
does not monitor anything. Where I am going wrong in my setup? Please can anyone help me?