Merge pull request #7 from alexellis/stack_1

Merge node info into stack
This commit is contained in:
Alex Ellis 2017-01-11 16:38:01 +00:00 committed by GitHub
commit 04b52ed93e

View File

@ -35,6 +35,8 @@ nnlzo6u3pilg func_prometheus.1 quay.io/prometheus/prometheus:latest moby Ru
* Your function can be accessed via the gateway like this:
**Sample function: Docker Hub Stats (hubstats)**
```
# curl -X POST http://localhost:8080/function/func_hubstats -d "alexellis2"
The organisation or user alexellis2 has 99 repositories on the Docker hub.
@ -45,6 +47,8 @@ The organisation or user library has 128 repositories on the Docker hub.
The `-d` value passes in the argument for your function. This is read via STDIN and used to query the Docker Hub to see how many images you've created/pushed.
**Sample function: webhook stasher (webhookstash)**
Another cool sample function is the Webhook Stasher which saves the body of any data posted to the service to the container's filesystem. Each file is written with the filename of the UNIX time.
```
@ -67,6 +71,24 @@ d769ca70729d alexellis2/faas-webhookstash@sha256:b378f1a144202baa8fb008f2
./1483999720961054638.txt
```
**Sample function: Node OS Info (nodeinfo)**
Grab OS, CPU and other info via a Node.js container using the `os` module.
```
# curl -X POST http://localhost:8080/function/func_nodeinfo -d ''
linux x64 [ { model: 'Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz',
speed: 2500,
times:
{ user: 3754430800,
nice: 2450200,
sys: 885352200,
idle: 25599742200,
irq: 0 } },
...
```
> Why not start the code on play-with-docker.com and then configure a Github repository to send webhook to the function?
If you're looking for a UI checkout the [Postman plugin for Chrome](https://www.getpostman.com) where you can send POSTs without needing `curl`.