mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 00:36:46 +00:00
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>
This commit is contained in:
parent
4fa9d89743
commit
0bb05480a3
@ -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:
|
||||
|
37
stack.yml
Normal file
37
stack.yml
Normal file
@ -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
|
22
stack_arm.yml
Normal file
22
stack_arm.yml
Normal file
@ -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"
|
Loading…
x
Reference in New Issue
Block a user