diff --git a/TestDrive.md b/TestDrive.md index 91f67221..d8c301ea 100644 --- a/TestDrive.md +++ b/TestDrive.md @@ -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: diff --git a/docker-compose.armhf.yml b/docker-compose.armhf.yml index ce6438f0..3d103c02 100644 --- a/docker-compose.armhf.yml +++ b/docker-compose.armhf.yml @@ -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" \ No newline at end of file + - "openfaas=true" diff --git a/docker-compose.yml b/docker-compose.yml index f9c02647..9dd4c6a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/stack.yml b/stack.yml new file mode 100644 index 00000000..fa0d7f9a --- /dev/null +++ b/stack.yml @@ -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 diff --git a/stack_arm.yml b/stack_arm.yml new file mode 100644 index 00000000..50ee4487 --- /dev/null +++ b/stack_arm.yml @@ -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"