Skip to content

Commit ed90630

Browse files
kamilkisielaardatan
authored andcommitted
Add Inigo Gateway
1 parent 7c31016 commit ed90630

File tree

4 files changed

+133
-0
lines changed

4 files changed

+133
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM inigohub/gateway:v0.30.13
2+
3+
COPY supergraph.graphql ./
4+
COPY config.yaml ./
5+
6+
EXPOSE 4000
7+
8+
CMD ["--schema", "supergraph.graphql", "--config", "config.yaml"]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
listen_port: 4000
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: "3.8"
2+
3+
services:
4+
gateway:
5+
image: gateway/inigo
6+
container_name: gateway
7+
build:
8+
context: ${BASE_DIR:-.}/../../gateways/inigo
9+
dockerfile: ./Dockerfile
10+
networks:
11+
- test
12+
ports:
13+
- "0.0.0.0:4000:4000"
14+
depends_on:
15+
accounts:
16+
condition: service_healthy
17+
inventory:
18+
condition: service_healthy
19+
products:
20+
condition: service_healthy
21+
reviews:
22+
condition: service_healthy
23+
healthcheck:
24+
test: ["CMD", "curl", "-f", "-X", "GET", "http://localhost:4000/health"]
25+
interval: 3s
26+
timeout: 5s
27+
retries: 10
28+
deploy:
29+
resources:
30+
limits:
31+
cpus: ${CPU_LIMIT:-1}
32+
memory: ${MEM_LIMIT:-1gb}
33+
networks:
34+
test:
35+
name: test
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
schema
2+
@link(url: "https://specs.apollo.dev/link/v1.0")
3+
@link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION)
4+
{
5+
query: Query
6+
}
7+
8+
directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE
9+
10+
directive @join__field(graph: join__Graph, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, usedOverridden: Boolean) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION
11+
12+
directive @join__graph(name: String!, url: String!) on ENUM_VALUE
13+
14+
directive @join__implements(graph: join__Graph!, interface: String!) repeatable on OBJECT | INTERFACE
15+
16+
directive @join__type(graph: join__Graph!, key: join__FieldSet, extension: Boolean! = false, resolvable: Boolean! = true, isInterfaceObject: Boolean! = false) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR
17+
18+
directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on UNION
19+
20+
directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA
21+
22+
scalar join__FieldSet
23+
24+
enum join__Graph {
25+
ACCOUNTS @join__graph(name: "accounts", url: "http://accounts:4001/graphql")
26+
INVENTORY @join__graph(name: "inventory", url: "http://inventory:4002/graphql")
27+
PRODUCTS @join__graph(name: "products", url: "http://products:4003/graphql")
28+
REVIEWS @join__graph(name: "reviews", url: "http://reviews:4004/graphql")
29+
}
30+
31+
scalar link__Import
32+
33+
enum link__Purpose {
34+
"""
35+
`SECURITY` features provide metadata necessary to securely resolve fields.
36+
"""
37+
SECURITY
38+
39+
"""
40+
`EXECUTION` features provide metadata necessary for operation execution.
41+
"""
42+
EXECUTION
43+
}
44+
45+
type Product
46+
@join__type(graph: INVENTORY, key: "upc")
47+
@join__type(graph: PRODUCTS, key: "upc")
48+
@join__type(graph: REVIEWS, key: "upc")
49+
{
50+
upc: String!
51+
weight: Int @join__field(graph: INVENTORY, external: true) @join__field(graph: PRODUCTS)
52+
price: Int @join__field(graph: INVENTORY, external: true) @join__field(graph: PRODUCTS)
53+
inStock: Boolean @join__field(graph: INVENTORY)
54+
shippingEstimate: Int @join__field(graph: INVENTORY, requires: "price weight")
55+
name: String @join__field(graph: PRODUCTS)
56+
reviews: [Review] @join__field(graph: REVIEWS)
57+
}
58+
59+
type Query
60+
@join__type(graph: ACCOUNTS)
61+
@join__type(graph: INVENTORY)
62+
@join__type(graph: PRODUCTS)
63+
@join__type(graph: REVIEWS)
64+
{
65+
me: User @join__field(graph: ACCOUNTS)
66+
user(id: ID!): User @join__field(graph: ACCOUNTS)
67+
users: [User] @join__field(graph: ACCOUNTS)
68+
topProducts(first: Int = 5): [Product] @join__field(graph: PRODUCTS)
69+
}
70+
71+
type Review
72+
@join__type(graph: REVIEWS, key: "id")
73+
{
74+
id: ID!
75+
body: String
76+
product: Product
77+
author: User @join__field(graph: REVIEWS, provides: "username")
78+
}
79+
80+
type User
81+
@join__type(graph: ACCOUNTS, key: "id")
82+
@join__type(graph: REVIEWS, key: "id")
83+
{
84+
id: ID!
85+
name: String @join__field(graph: ACCOUNTS)
86+
username: String @join__field(graph: ACCOUNTS) @join__field(graph: REVIEWS, external: true)
87+
birthday: Int @join__field(graph: ACCOUNTS)
88+
reviews: [Review] @join__field(graph: REVIEWS)
89+
}

0 commit comments

Comments
 (0)