-
Download OVA: https://s3-us-west-2.amazonaws.com/dispatch-imgs/Ubuntu_16.04.2_server_amd64_dispatch.ova
-
VMware fusion users:
- File -> Import OVA
- VMware workstation users:
- File -> Open OVA
- Login to console with credentials:
vmware/vmware
- Get IP address
ifconfig
(look for the 10.x.x.x address)
-
SSH to the deployed VM with same credentials:
ssh [email protected]
-
Run
./install-minikube.sh
- Monitor the installation with
watch kubectl -n kube-system get pods
-
Run
helm init
-
Configure and install Dispatch:
Fetch the IP address of minikube as this will be used the host for dispatch services.
export DISPATCH_HOST=$(minikube ip)
Configure the installation (note: you must substitute the IP address where $DISPATCH_HOST is specified in the below config.yaml):
$ cat << EOF > config.yaml
apiGateway:
host: $DISPATCH_HOST
dispatch:
host: $DISPATCH_HOST
debug: true
skipAuth: true
EOF
$ dispatch install --file config.yaml
...
Config file written to: $HOME/.dispatch/config.json
Note: You can monitory the installation with watch kubectl -n dispatch get pods
Your dispatch config file $HOME/.dispatch/config.json will be generated and have the following:-
cat $HOME/.dispatch/config.json
{
"host": "<DISPATCH_HOST>",
"port": <port>,
"organization": "",
"cookie": "",
"insecure": false,
"skipauth": true,
"Json": false
}
-
Edit the
$HOME/.dispatch/config.json
file and change"insecure": false
to"insecure": true
-
At this point, the environment is up and working. Let's seed the service with some images and functions.
$ cd code/dispatch/examples/
$ dispatch create --file seed.yaml
$ dispatch get images
NAME | URL | BASEIMAGE | STATUS | CREATED DATE
------------------------------------------------------------------------------------------------------------------------
nodejs6 | vmware/dispatch-openfaas-nodejs6-base:0.0.2-dev1 | nodejs6-base | READY | Wed Dec 6 14:28:30 PST 2017
python3 | vmware/dispatch-openfaas-python-base:0.0.4-dev1 | python3-base | INITIALIZED | Wed Dec 6 14:28:30 PST 2017
$ dispatch get functions
NAME | IMAGE | STATUS | CREATED DATE
------------------------------------------------------------
hello-js | nodejs6 | READY | Wed Dec 6 14:29:05 PST 2017
hello-py | python3 | READY | Wed Dec 6 14:28:52 PST 2017
- Execute a function:
$ dispatch exec hello-py --input '{"name": "Jon", "place": "Winterfell"}' --wait
{
"blocking": true,
"executedTime": 1515624222,
"finishedTime": 1515624222,
"functionId": "5138d918-e78f-41d6-aece-769addd3eed7",
"functionName": "hello-py",
"input": {
"name": "Jon",
"place": "Winterfell"
},
"logs": null,
"name": "b5b3c1f5-fa8a-4b38-b7d1-475c44b76114",
"output": {
"myField": "Hello, Jon from Winterfell"
},
"reason": null,
"secrets": [],
"status": "READY"
}
- Add an API endpoint:
$ dispatch create api --https-only --method POST --path /hello post-hello hello-py
Find the port for the api-gateway service (we are using the NodePort service type):
$ kubectl -n kong get service api-gateway-kongproxy
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
api-gateway-kongproxy 10.107.109.1 <nodes> 80:31788/TCP,443:32611/TCP 19m
We are looking at the port associated with https/443 => 32611
$ curl -k "https://$DISPATCH_HOST:32611/hello" -H "Content-Type: application/json" -d '{"name": "Jon", "place": "winterfell"}'
{"myField":"Hello, Jon from winterfell"}