Skip to content

Commit

Permalink
Add example with gatway hosted in docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
suessflorian committed Nov 11, 2021
1 parent 4bd9c16 commit be3658b
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 0 deletions.
20 changes: 20 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal Example
Via `docker-compose` we can simulate an environment with three services all contributing to the boundary type `Foo`.

```
docker-compose up
```

The gateway will then be hosted on `http://localhost:8082/query`, be sure to point a GraphQL client to this address.

```graphql
{
randomFoo {
nodejs
graphGophers
gqlgen
}
}
```

_Note: each field is resolved by each different service here._
29 changes: 29 additions & 0 deletions examples/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: "3"
services:
gqlgen-server:
build:
context: gqlgen-service
expose:
- 8080
gophers-server:
build:
context: graph-gophers-service
expose:
- 8080
nodejs-server:
build:
context: nodejs-service
expose:
- 8080
gateway:
image: ghcr.io/movio/bramble
volumes:
- ./example-config.json:/config.json
ports:
- 8082:8082
- 8083:8083
- 8084:8084
depends_on:
- gqlgen-server
- gophers-server
- nodejs-server
7 changes: 7 additions & 0 deletions examples/example-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"services": [
"http://gqlgen-server:8080/query",
"http://gophers-server:8080/query",
"http://nodejs-server:8080/query"
]
}
9 changes: 9 additions & 0 deletions examples/gqlgen-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang

WORKDIR /go/src/app

COPY . .

RUN go generate .
RUN go get
CMD go run .
7 changes: 7 additions & 0 deletions examples/graph-gophers-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM golang

WORKDIR /go/src/app

COPY . .
RUN go get
CMD go run .
7 changes: 7 additions & 0 deletions examples/nodejs-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node

COPY . .

RUN npm install

CMD ["npm", "run", "start"]

0 comments on commit be3658b

Please sign in to comment.