From c562f07c0b739304f042beff368c65e2f4f4e8f6 Mon Sep 17 00:00:00 2001 From: Alex Ellis Date: Mon, 9 Jan 2017 17:56:14 +0000 Subject: [PATCH] Document stack deploy --- README.md | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5c969a34..5c9a622a 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,7 @@ This project provides a way to run Docker containers as functions on Swarm Mode. * Each container has a watchdog process that hosts a web server allowing a JSON post request to be forwarded to a desired process via STDIN. The respose is sent to the caller via STDOUT. * A gateway provides a view to the containers/functions to the public Internet and collects metrics for Prometheus and in a future version will manage replicas and scale as throughput increases. -## Quickstart - -Minimum requirements: - +## Minimum requirements: * Docker 1.13-RC (to support attachable overlay networks) * At least a single host in Swarm Mode. (run `docker swarm init`) @@ -16,6 +13,30 @@ Minimum requirements: Check your `docker version` and upgrade to one of the latest 1.13-RCs from the [Docker Releases page](https://github.com/docker/docker/releases). This is already available through the Beta channel in Docker for Mac. +## Quickstart with `docker stack deploy` + +For a complete stack of Prometheus, the gateway and the DockerHubStats function: + +* Simply run `./deploy_stack.sh`. + +* Then head over to http://localhost:9090 for your Prometheus metrics + +* Your function can be accessed via the gateway like this: + +``` +# curl -X POST http://localhost:3000/function/func_hubstats -d "alexellis2" +The organisation or user alexellis2 has 99 repositories on the Docker hub. + +# curl -X POST http://localhost:3000/function/func_hubstats -d "library" +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. + +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`. + +## Manual quickstart + #### Create an attachable network for the gateway and functions to join ```