Skip to content

Commit

Permalink
Add getting started instructions to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
expelledboy committed Feb 26, 2020
1 parent 7adb22f commit e11179d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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!

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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}
```
1 change: 1 addition & 0 deletions docs/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ You are now exposing this projects `Makefile` to the web!

> $ curl http://localhost/hello-world
> {"status":0}

0 comments on commit e11179d

Please sign in to comment.