diff --git a/README.md b/README.md index 17affba..4a2c0d6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # make-webhooks -> Just try it: `make web`. ;) +> Just try it! + +```sh +make web # ;) +``` You are now exposing this projects `Makefile` to the web! @@ -9,7 +13,7 @@ $ curl http://localhost/hello-world {"status":0} ``` -Change environment variables. All vars are uppercased by default. +You can set environment variables, all vars are uppercased by default. Dont forget HTTP URL encoding! ```sh @@ -18,6 +22,37 @@ curl "http://localhost/hello-world?GREET=Anthony" curl "http://localhost/hello-world?greet=Anthony" ``` + +## Getting Started + +> Shut up and get me running! + +Mount local directory into docker swarm: + +```sh +ssh root@server +docker swarm init +wget https://raw.githubusercontent.com/expelledboy/make-webhooks/master/Makefile +make HOSTNAME=webhooks.example.com start-webhooks +``` + +> OR + +Build a docker image with your custom Makefile. + +```dock +FROM expelledboy/make-webhooks:latest +RUN apk add --no-cache jq # Makefile deps +COPY Makefile /webhook/Makefile +``` + +```sh +docker build -t my-webhooks . +docker run -it --rm -p 3000:3000 my-webhooks +``` + +## Guide + You can use the webhooks return status as an exit code in another script. ```sh @@ -71,8 +106,8 @@ Can even do key rotations! ```sh $ echo -n myNewSecret > SECRET -$ curl -H 'Authorization: Bearer mySecret' http://localhost/hello-world ; echo '' +$ curl -H 'Authorization: Bearer mySecret' http://localhost/hello-world Unauthorized -$ curl -H 'Authorization: Bearer myNewSecret' http://localhost/hello-world ; echo '' +$ curl -H 'Authorization: Bearer myNewSecret' http://localhost/hello-world {"status":0} ``` diff --git a/docs/welcome.md b/docs/welcome.md index 0d3be60..9725221 100644 --- a/docs/welcome.md +++ b/docs/welcome.md @@ -3,3 +3,4 @@ You are now exposing this projects `Makefile` to the web! > $ curl http://localhost/hello-world > {"status":0} +