Skip to content

Add Inigo Gateway #515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/federation-v1.workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- cosmo
- mercurius
- grafbase
- inigo
uses: ./.github/workflows/benchmark.template.yaml
with:
gateway: ${{ matrix.directory }}
Expand Down Expand Up @@ -71,6 +72,7 @@ jobs:
- cosmo
- mercurius
- grafbase
- inigo
uses: ./.github/workflows/benchmark.template.yaml
with:
gateway: ${{ matrix.directory }}
Expand Down Expand Up @@ -109,6 +111,7 @@ jobs:
- cosmo
- mercurius
- grafbase
- inigo
uses: ./.github/workflows/benchmark.template.yaml
with:
gateway: ${{ matrix.directory }}
Expand Down Expand Up @@ -147,6 +150,7 @@ jobs:
- cosmo
- mercurius
- grafbase
- inigo
uses: ./.github/workflows/benchmark.template.yaml
with:
gateway: ${{ matrix.directory }}
Expand Down
14 changes: 14 additions & 0 deletions federation-v1/gateways/inigo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# we need curl to perform health checks
# and that's why we start with alpine image
# and copy the gateway binary from the original docker image
FROM alpine:3.19
RUN apk add --no-cache curl

COPY --from=inigohub/gateway:v0.30.15 /usr/bin/gateway .

COPY supergraph.graphql ./
COPY config.yaml ./

EXPOSE 4000

CMD ["./gateway", "--schema", "supergraph.graphql", "--config", "config.yaml"]
1 change: 1 addition & 0 deletions federation-v1/gateways/inigo/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
listen_port: 4000
35 changes: 35 additions & 0 deletions federation-v1/gateways/inigo/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.8"

services:
gateway:
image: gateway/inigo
container_name: gateway
build:
context: ${BASE_DIR:-.}/../../gateways/inigo
dockerfile: ./Dockerfile
networks:
- test
ports:
- "0.0.0.0:4000:4000"
depends_on:
accounts:
condition: service_healthy
inventory:
condition: service_healthy
products:
condition: service_healthy
reviews:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "-X", "GET", "http://localhost:4000/health"]
interval: 3s
timeout: 5s
retries: 10
deploy:
resources:
limits:
cpus: ${CPU_LIMIT:-1}
memory: ${MEM_LIMIT:-1gb}
networks:
test:
name: test
103 changes: 103 additions & 0 deletions federation-v1/gateways/inigo/supergraph.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Generated by Inigo CLI

schema
@link(for: EXECUTION, url: "https://specs.apollo.dev/join/v0.2")
@link(url: "https://specs.apollo.dev/link/v1.0") {
query: Query
}

scalar join__FieldSet
scalar link__Import

enum join__Graph {
ACCOUNTS @join__graph(name: "accounts", url: "http://accounts:4001/graphql")
INVENTORY
@join__graph(name: "inventory", url: "http://inventory:4002/graphql")
PRODUCTS @join__graph(name: "products", url: "http://products:4003/graphql")
REVIEWS @join__graph(name: "reviews", url: "http://reviews:4004/graphql")
}
enum link__Purpose {
"""
`EXECUTION` features provide metadata necessary for operation execution.
"""
EXECUTION
"""
`SECURITY` features provide metadata necessary to securely resolve fields.
"""
SECURITY
}

type Product
@join__type(extension: true, graph: INVENTORY, key: "upc")
@join__type(extension: true, graph: REVIEWS, key: "upc")
@join__type(graph: PRODUCTS, key: "upc") {
inStock: Boolean @join__field(graph: INVENTORY)
name: String @join__field(graph: PRODUCTS)
price: Int
@join__field(external: true, graph: INVENTORY)
@join__field(graph: PRODUCTS)
reviews: [Review] @join__field(graph: REVIEWS)
shippingEstimate: Int @join__field(graph: INVENTORY, requires: "price weight")
upc: String!
weight: Int
@join__field(external: true, graph: INVENTORY)
@join__field(graph: PRODUCTS)
}
type Query
@join__type(graph: ACCOUNTS)
@join__type(graph: INVENTORY)
@join__type(graph: PRODUCTS)
@join__type(graph: REVIEWS) {
me: User @join__field(graph: ACCOUNTS)
topProducts(first: Int = 5): [Product] @join__field(graph: PRODUCTS)
user(id: ID!): User @join__field(graph: ACCOUNTS)
users: [User] @join__field(graph: ACCOUNTS)
}
type Review @join__type(graph: REVIEWS, key: "id") {
author: User @join__field(graph: REVIEWS, provides: "username")
body: String
id: ID!
product: Product
}
type User
@join__type(extension: true, graph: REVIEWS, key: "id")
@join__type(graph: ACCOUNTS, key: "id") {
birthday: Int @join__field(graph: ACCOUNTS)
id: ID!
name: String @join__field(graph: ACCOUNTS)
reviews: [Review] @join__field(graph: REVIEWS)
username: String
@join__field(external: true, graph: REVIEWS)
@join__field(graph: ACCOUNTS)
}

directive @join__field(
external: Boolean
graph: join__Graph!
override: String
provides: join__FieldSet
requires: join__FieldSet
type: String
usedOverridden: Boolean
) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION

directive @join__graph(name: String!, url: String!) on ENUM_VALUE

directive @join__implements(
graph: join__Graph!
interface: String!
) repeatable on OBJECT | INTERFACE

directive @join__type(
extension: Boolean! = false
graph: join__Graph!
key: join__FieldSet
resolvable: Boolean! = true
) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR

directive @link(
as: String
for: link__Purpose
import: [link__Import]
url: String
) repeatable on SCHEMA
3 changes: 2 additions & 1 deletion federation/gateways/grafbase/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM ghcr.io/grafbase/gateway:0.30.2

COPY supergraph.graphql ./
COPY grafbase.toml ./

EXPOSE 4000

CMD ["--schema", "supergraph.graphql", "--listen-address", "0.0.0.0:4000"]
CMD ["--schema", "supergraph.graphql", "--listen-address", "0.0.0.0:4000", "-c", "grafbase.toml"]
2 changes: 2 additions & 0 deletions federation/gateways/grafbase/grafbase.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

request_body_limit = "2MiB"
11 changes: 9 additions & 2 deletions federation/gateways/hive-gateway/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@ services:
source: federation/gateways/hive-gateway/supergraph.graphql
target: /serve/supergraph.graphql
healthcheck:
test: [ "CMD", "/usr/lib/apt/apt-helper", "download-file", "http://127.0.0.1:4000/graphql?query=%7B+users+%7B+reviews+%7B+product+%7B+reviews+%7B+author+%7B+reviews+%7B+product+%7B+name+%7D+%7D+%7D+%7D+%7D+%7D+%7D+%7D", "/tmp/health" ]
test:
[
"CMD",
"/usr/lib/apt/apt-helper",
"download-file",
"http://127.0.0.1:4000/graphql?query=%7B+users+%7B+reviews+%7B+product+%7B+reviews+%7B+author+%7B+reviews+%7B+product+%7B+name+%7D+%7D+%7D+%7D+%7D+%7D+%7D+%7D",
"/tmp/health",
]
interval: 3s
timeout: 5s
retries: 10
command: [ "supergraph", "--jit" ]
command: ["supergraph", "--jit"]
deploy:
resources:
limits:
Expand Down
14 changes: 14 additions & 0 deletions federation/gateways/inigo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# we need curl to perform health checks
# and that's why we start with alpine image
# and copy the gateway binary from the original docker image
FROM alpine:3.19
RUN apk add --no-cache curl

COPY --from=inigohub/gateway:1.1.0 /usr/bin/gateway .

COPY supergraph.graphql ./
COPY config.yaml ./

EXPOSE 4000

CMD ["./gateway", "--schema", "supergraph.graphql", "--config", "config.yaml"]
1 change: 1 addition & 0 deletions federation/gateways/inigo/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
listen_port: 4000
35 changes: 35 additions & 0 deletions federation/gateways/inigo/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.8"

services:
gateway:
image: gateway/inigo
container_name: gateway
build:
context: ${BASE_DIR:-.}/../../gateways/inigo
dockerfile: ./Dockerfile
networks:
- test
ports:
- "0.0.0.0:4000:4000"
depends_on:
accounts:
condition: service_healthy
inventory:
condition: service_healthy
products:
condition: service_healthy
reviews:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "-X", "GET", "http://localhost:4000/health"]
interval: 3s
timeout: 5s
retries: 10
deploy:
resources:
limits:
cpus: ${CPU_LIMIT:-1}
memory: ${MEM_LIMIT:-1gb}
networks:
test:
name: test
103 changes: 103 additions & 0 deletions federation/gateways/inigo/supergraph.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Generated by Inigo CLI

schema
@link(for: EXECUTION, url: "https://specs.apollo.dev/join/v0.2")
@link(url: "https://specs.apollo.dev/link/v1.0") {
query: Query
}

scalar join__FieldSet
scalar link__Import

enum join__Graph {
ACCOUNTS @join__graph(name: "accounts", url: "http://accounts:4001/graphql")
INVENTORY
@join__graph(name: "inventory", url: "http://inventory:4002/graphql")
PRODUCTS @join__graph(name: "products", url: "http://products:4003/graphql")
REVIEWS @join__graph(name: "reviews", url: "http://reviews:4004/graphql")
}
enum link__Purpose {
"""
`EXECUTION` features provide metadata necessary for operation execution.
"""
EXECUTION
"""
`SECURITY` features provide metadata necessary to securely resolve fields.
"""
SECURITY
}

type Product
@join__type(extension: true, graph: INVENTORY, key: "upc")
@join__type(extension: true, graph: REVIEWS, key: "upc")
@join__type(graph: PRODUCTS, key: "upc") {
inStock: Boolean @join__field(graph: INVENTORY)
name: String @join__field(graph: PRODUCTS)
price: Int
@join__field(external: true, graph: INVENTORY)
@join__field(graph: PRODUCTS)
reviews: [Review] @join__field(graph: REVIEWS)
shippingEstimate: Int @join__field(graph: INVENTORY, requires: "price weight")
upc: String!
weight: Int
@join__field(external: true, graph: INVENTORY)
@join__field(graph: PRODUCTS)
}
type Query
@join__type(graph: ACCOUNTS)
@join__type(graph: INVENTORY)
@join__type(graph: PRODUCTS)
@join__type(graph: REVIEWS) {
me: User @join__field(graph: ACCOUNTS)
topProducts(first: Int = 5): [Product] @join__field(graph: PRODUCTS)
user(id: ID!): User @join__field(graph: ACCOUNTS)
users: [User] @join__field(graph: ACCOUNTS)
}
type Review @join__type(graph: REVIEWS, key: "id") {
author: User @join__field(graph: REVIEWS, provides: "username")
body: String
id: ID!
product: Product
}
type User
@join__type(extension: true, graph: REVIEWS, key: "id")
@join__type(graph: ACCOUNTS, key: "id") {
birthday: Int @join__field(graph: ACCOUNTS)
id: ID!
name: String @join__field(graph: ACCOUNTS)
reviews: [Review] @join__field(graph: REVIEWS)
username: String
@join__field(external: true, graph: REVIEWS)
@join__field(graph: ACCOUNTS)
}

directive @join__field(
external: Boolean
graph: join__Graph!
override: String
provides: join__FieldSet
requires: join__FieldSet
type: String
usedOverridden: Boolean
) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION

directive @join__graph(name: String!, url: String!) on ENUM_VALUE

directive @join__implements(
graph: join__Graph!
interface: String!
) repeatable on OBJECT | INTERFACE

directive @join__type(
extension: Boolean! = false
graph: join__Graph!
key: join__FieldSet
resolvable: Boolean! = true
) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR

directive @link(
as: String
for: link__Purpose
import: [link__Import]
url: String
) repeatable on SCHEMA
Loading
Loading