This module will create a Nomad cluster with Consul, VPC, and ALB for Nomad server and the OpenFaaS gateway
export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export AWS_REGION=eu-west-1
$ brew install faas-cli
$ brew install nomad
$ brew install terraform
The below configuration will create a single node Nomad cluster with 3 agents.
module "open-faas-nomad" {
source = "nicholasjackson/open-faas-nomad/aws"
min_agents = "3"
}
$ terraform init
$ terraform plan
$ terraform apply
$ export NOMAD_ADDR=http://$(terraform output nomad_alb):4646/
$ export GATEWAY=http://$(terraform output faas_alb):8080/
$ curl https://raw.githubusercontent.com/hashicorp/faas-nomad/master/faas.hcl -o faas.hcl
$ nomad run faas.hcl
$ faas-cli deploy --gateway=$GATEWAY --image=functions/nodeinfo:latest --name=info --handler=node main.js
$ faas-cli invoke --name=info
The OpenFaaS UI is also available at http://$(terraform output faas_alb):8081
$ open http://$(terraform output faas_alb):8081
Please see example/terraform.tf for usage with all configurable options and openfaas.com for more details on OpenFaaS.