Skip to content

Commit ac5cce1

Browse files
committed
Inigo
1 parent 353170f commit ac5cce1

File tree

4 files changed

+153
-0
lines changed

4 files changed

+153
-0
lines changed

federation/inigo/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# we need curl to perform health checks
2+
# and that's why we start with alpine image
3+
# and copy the gateway binary from the original docker image
4+
FROM alpine:3.19
5+
RUN apk add --no-cache curl
6+
7+
COPY --from=inigohub/gateway:v0.30.15 /usr/bin/gateway .
8+
9+
COPY supergraph.graphql ./
10+
COPY config.yaml ./
11+
12+
EXPOSE 4000
13+
14+
CMD ["./gateway", "--schema", "supergraph.graphql", "--config", "config.yaml"]

federation/inigo/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
listen_port: 4000

federation/inigo/docker-compose.yaml

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

federation/inigo/supergraph.graphql

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Generated by Inigo CLI
2+
3+
schema
4+
@link(for: EXECUTION, url: "https://specs.apollo.dev/join/v0.2")
5+
@link(url: "https://specs.apollo.dev/link/v1.0") {
6+
query: Query
7+
}
8+
9+
scalar join__FieldSet
10+
scalar link__Import
11+
12+
enum join__Graph {
13+
ACCOUNTS @join__graph(name: "accounts", url: "http://accounts:4001/graphql")
14+
INVENTORY
15+
@join__graph(name: "inventory", url: "http://inventory:4002/graphql")
16+
PRODUCTS @join__graph(name: "products", url: "http://products:4003/graphql")
17+
REVIEWS @join__graph(name: "reviews", url: "http://reviews:4004/graphql")
18+
}
19+
enum link__Purpose {
20+
"""
21+
`EXECUTION` features provide metadata necessary for operation execution.
22+
"""
23+
EXECUTION
24+
"""
25+
`SECURITY` features provide metadata necessary to securely resolve fields.
26+
"""
27+
SECURITY
28+
}
29+
30+
type Product
31+
@join__type(extension: true, graph: INVENTORY, key: "upc")
32+
@join__type(extension: true, graph: REVIEWS, key: "upc")
33+
@join__type(graph: PRODUCTS, key: "upc") {
34+
inStock: Boolean @join__field(graph: INVENTORY)
35+
name: String @join__field(graph: PRODUCTS)
36+
price: Int
37+
@join__field(external: true, graph: INVENTORY)
38+
@join__field(graph: PRODUCTS)
39+
reviews: [Review] @join__field(graph: REVIEWS)
40+
shippingEstimate: Int @join__field(graph: INVENTORY, requires: "price weight")
41+
upc: String!
42+
weight: Int
43+
@join__field(external: true, graph: INVENTORY)
44+
@join__field(graph: PRODUCTS)
45+
}
46+
type Query
47+
@join__type(graph: ACCOUNTS)
48+
@join__type(graph: INVENTORY)
49+
@join__type(graph: PRODUCTS)
50+
@join__type(graph: REVIEWS) {
51+
me: User @join__field(graph: ACCOUNTS)
52+
topProducts(first: Int = 5): [Product] @join__field(graph: PRODUCTS)
53+
user(id: ID!): User @join__field(graph: ACCOUNTS)
54+
users: [User] @join__field(graph: ACCOUNTS)
55+
}
56+
type Review @join__type(graph: REVIEWS, key: "id") {
57+
author: User @join__field(graph: REVIEWS, provides: "username")
58+
body: String
59+
id: ID!
60+
product: Product
61+
}
62+
type User
63+
@join__type(extension: true, graph: REVIEWS, key: "id")
64+
@join__type(graph: ACCOUNTS, key: "id") {
65+
birthday: Int @join__field(graph: ACCOUNTS)
66+
id: ID!
67+
name: String @join__field(graph: ACCOUNTS)
68+
reviews: [Review] @join__field(graph: REVIEWS)
69+
username: String
70+
@join__field(external: true, graph: REVIEWS)
71+
@join__field(graph: ACCOUNTS)
72+
}
73+
74+
directive @join__field(
75+
external: Boolean
76+
graph: join__Graph!
77+
override: String
78+
provides: join__FieldSet
79+
requires: join__FieldSet
80+
type: String
81+
usedOverridden: Boolean
82+
) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION
83+
84+
directive @join__graph(name: String!, url: String!) on ENUM_VALUE
85+
86+
directive @join__implements(
87+
graph: join__Graph!
88+
interface: String!
89+
) repeatable on OBJECT | INTERFACE
90+
91+
directive @join__type(
92+
extension: Boolean! = false
93+
graph: join__Graph!
94+
key: join__FieldSet
95+
resolvable: Boolean! = true
96+
) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR
97+
98+
directive @link(
99+
as: String
100+
for: link__Purpose
101+
import: [link__Import]
102+
url: String
103+
) repeatable on SCHEMA

0 commit comments

Comments
 (0)