Skip to content
Permalink
Browse files

Remove sample functions for swarm

Break out sample functions into new stack.yml
Update instructions in Testdrive.md

Signed-off-by: Eric Stoekl <ems5311@gmail.com>
  • Loading branch information...
ericstoekl authored and alexellis committed May 25, 2018
1 parent 4fa9d89 commit 0bb05480a37fa3c28c0c4bec58bc9481600bdd95
Showing with 67 additions and 140 deletions.
  1. +7 −1 TestDrive.md
  2. +1 −41 docker-compose.armhf.yml
  3. +0 −98 docker-compose.yml
  4. +37 −0 stack.yml
  5. +22 −0 stack_arm.yml
@@ -56,7 +56,13 @@ This one-shot script clones the code, sets up a Docker Swarm master node then de

## Sample functions

We have packaged some simple starter functions in the Docker stack, so as soon as you open the OpenFaaS UI you will see them listed down the left-hand side.
Deploy the sample functions by deploying the `stack.yml` file in the `faas/` repo folder:

```
faas deploy
```

You don't need to specify a `-f` or `--yaml` option to the `faas` command. By default the `stack.yml` file is used if it is present.

Here are a few of the functions:

@@ -159,46 +159,6 @@ services:
- source: alertmanager_config
target: /alertmanager.yml

# sample functions go here, but can be created in the UI too.
nodeinfo:
image: functions/nodeinfo:latest-armhf
labels:
function: "true"
networks:
- functions
environment:
no_proxy: "gateway"
https_proxy: $https_proxy

markdown:
image: functions/markdownrender:latest-armhf
labels:
function: "true"
networks:
- functions
environment:
no_proxy: "gateway"
https_proxy: $https_proxy
wordcount:
image: functions/alpine:latest-armhf
labels:
function: "true"
networks:
- functions
environment:
fprocess: "wc"
no_proxy: "gateway"
https_proxy: $https_proxy
echoit:
image: functions/alpine:latest-armhf
labels:
function: "true"
networks:
- functions
environment:
fprocess: "cat"
no_proxy: "gateway"
https_proxy: $https_proxy

configs:
prometheus_config:
@@ -213,4 +173,4 @@ networks:
driver: overlay
attachable: true
labels:
- "openfaas=true"
- "openfaas=true"
@@ -164,104 +164,6 @@ services:
- source: alertmanager_config
target: /alertmanager.yml

# Sample functions go here.

# Pass a username as an argument to find how many images user has pushed to Docker Hub.
hubstats:
image: functions/hubstats:latest
labels:
function: "true"
networks:
- functions
environment:
no_proxy: "gateway"
https_proxy: $https_proxy
deploy:
placement:
constraints:
- 'node.platform.os == linux'

# Node.js gives OS info about the node (Host)
nodeinfo:
image: functions/nodeinfo:latest
labels:
function: "true"
networks:
- functions
environment:
no_proxy: "gateway"
https_proxy: $https_proxy
deploy:
placement:
constraints:
- 'node.platform.os == linux'


# Uses `cat` to echo back response, fastest function to execute.
echoit:
image: functions/alpine:latest
labels:
function: "true"
networks:
- functions
environment:
fprocess: "cat"
no_proxy: "gateway"
https_proxy: $https_proxy
deploy:
placement:
constraints:
- 'node.platform.os == linux'


# Counts words in request with `wc` utility
wordcount:
image: functions/alpine:latest
labels:
function: "true"
com.faas.max_replicas: "10"
networks:
- functions
environment:
fprocess: "wc"
no_proxy: "gateway"
https_proxy: $https_proxy
deploy:
placement:
constraints:
- 'node.platform.os == linux'


# Calculates base64 representation of request body.
base64:
image: functions/alpine:latest
labels:
function: "true"
networks:
- functions
environment:
fprocess: "base64"
no_proxy: "gateway"
https_proxy: $https_proxy
deploy:
placement:
constraints:
- 'node.platform.os == linux'

# Converts body in (markdown format) -> (html)
markdown:
image: functions/markdown-render:latest
labels:
function: "true"
networks:
- functions
environment:
no_proxy: "gateway"
https_proxy: $https_proxy
deploy:
placement:
constraints:
- 'node.platform.os == linux'

configs:
prometheus_config:
@@ -0,0 +1,37 @@
provider:
name: faas
gateway: http://localhost:8080 # can be a remote server

functions:
# Pass a username as an argument to find how many images user has pushed to Docker Hub.
hubstats:
lang: dockerfile
image: functions/hubstats:latest

# Node.js gives OS info about the node (Host)
nodeinfo:
lang: dockerfile
image: functions/nodeinfo:latest

# Uses `cat` to echo back response, fastest function to execute.
echoit:
lang: dockerfile
image: functions/alpine:latest
fprocess: "cat"

# Counts words in request with `wc` utility
wordcount:
lang: dockerfile
image: functions/alpine:latest
fprocess: "wc"

# Calculates base64 representation of request body.
base64:
lang: dockerfile
image: functions/alpine:latest
fprocess: "base64"

# Converts body in (markdown format) -> (html)
markdown:
lang: dockerfile
image: functions/markdown-render:latest
@@ -0,0 +1,22 @@
provider:
name: faas
gateway: http://localhost:8080 # can be a remote server

# sample functions go here, but can be created in the UI too.
functions:
nodeinfo:
lang: dockerfile
image: functions/nodeinfo:latest-armhf

markdown:
lang: dockerfile
image: functions/markdownrender:latest-armhf

wordcount:
image: functions/alpine:latest-armhf
fprocess: "wc"

echoit:
lang: dockerfile
image: functions/alpine:latest-armhf
fprocess: "cat"

0 comments on commit 0bb0548

Please sign in to comment.
You can’t perform that action at this time.