Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .github/workflows/benchmark.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ jobs:
- name: checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5

- name: setup node
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version

- name: setup rust
uses: actions-rs/toolchain@v1
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/federation-v1.workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
fail-fast: false
matrix:
directory:
- apollo-gateway
- apollo-router
- hive-gateway
- hive-gateway-bun
Expand Down Expand Up @@ -49,6 +50,7 @@ jobs:
fail-fast: false
matrix:
directory:
- apollo-gateway
- apollo-router
- hive-gateway
- hive-gateway-bun
Expand Down Expand Up @@ -81,6 +83,7 @@ jobs:
fail-fast: false
matrix:
directory:
- apollo-gateway
- apollo-router
- hive-gateway
- hive-gateway-bun
Expand Down Expand Up @@ -113,6 +116,7 @@ jobs:
fail-fast: false
matrix:
directory:
- apollo-gateway
- apollo-router
- hive-gateway
- hive-gateway-bun
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/report.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ jobs:
path: artifacts

- name: setup node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
uses: the-guild-org/shared-config/setup@v1
with:
node-version: 24

- name: install dependencies
run: npm i
node-version-file: .node-version

- name: generate report
run: npm run generate-report ${{ steps.download.outputs.download-path }}
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/website.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
workflow_dispatch: {}

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Deploy to Cloudflare Pages
steps:
- name: checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Set up env
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- name: build website
working-directory: website
run: npm run build
- name: Deploy
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
workingDirectory: website
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v24
30 changes: 30 additions & 0 deletions gateways/apollo-gateway/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ApolloServer } from "@apollo/server";
import { ApolloGateway } from "@apollo/gateway";
import { startStandaloneServer } from "@apollo/server/standalone";
import { readFileSync } from "fs";
import cluster from "cluster";
import { availableParallelism } from "os";

async function main() {
const forkCount = (process.env.FORK
? parseInt(process.env.FORK)
: availableParallelism()) - 1;
if (cluster.isPrimary && forkCount) {
console.log(`Forking ${forkCount} workers...`);
for (let i = 0; i < forkCount; i++) {
cluster.fork();
}
} else {
const supergraphSdl = readFileSync("./supergraph.graphql").toString();
const gateway = new ApolloGateway({ supergraphSdl });
const server = new ApolloServer({ gateway });

const { url } = await startStandaloneServer(server, {
listen: { port: process.env.PORT ? parseInt(process.env.PORT) : 4000 },
});

console.log(`🚀 Server ready at ${url}`);
}
}

main().catch(console.error);
1 change: 1 addition & 0 deletions gateways/apollo-gateway/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm i
14 changes: 14 additions & 0 deletions gateways/apollo-gateway/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "apollo-gateway-js",
"version": "0.0.0",
"scripts": {
"start": "tsx index.ts"
},
"dependencies": {
"tsx": "4.20.4",
"typescript": "5.9.2",
"graphql": "16.11.0",
"@apollo/server": "5.0.0",
"@apollo/gateway": "2.11.2"
}
}
4 changes: 4 additions & 0 deletions gateways/apollo-gateway/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -Eeuo pipefail

NODE_ENV=production npm start > ./gateway_log.txt 2>&1
115 changes: 115 additions & 0 deletions gateways/apollo-gateway/supergraph.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
schema
@link(url: "https://specs.apollo.dev/link/v1.0")
@link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION) {
query: Query
}

directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE

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

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(
graph: join__Graph!
key: join__FieldSet
extension: Boolean! = false
resolvable: Boolean! = true
isInterfaceObject: Boolean! = false
) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR

directive @join__unionMember(
graph: join__Graph!
member: String!
) repeatable on UNION

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

scalar join__FieldSet

enum join__Graph {
ACCOUNTS @join__graph(name: "accounts", url: "http://0.0.0.0:4200/accounts")
INVENTORY
@join__graph(name: "inventory", url: "http://0.0.0.0:4200/inventory")
PRODUCTS @join__graph(name: "products", url: "http://0.0.0.0:4200/products")
REVIEWS @join__graph(name: "reviews", url: "http://0.0.0.0:4200/reviews")
}

scalar link__Import

enum link__Purpose {
"""
`SECURITY` features provide metadata necessary to securely resolve fields.
"""
SECURITY

"""
`EXECUTION` features provide metadata necessary for operation execution.
"""
EXECUTION
}

type Product
@join__type(graph: INVENTORY, key: "upc")
@join__type(graph: PRODUCTS, key: "upc")
@join__type(graph: REVIEWS, key: "upc") {
upc: String!
weight: Int
@join__field(graph: INVENTORY, external: true)
@join__field(graph: PRODUCTS)
price: Int
@join__field(graph: INVENTORY, external: true)
@join__field(graph: PRODUCTS)
inStock: Boolean @join__field(graph: INVENTORY)
shippingEstimate: Int @join__field(graph: INVENTORY, requires: "price weight")
name: String @join__field(graph: PRODUCTS)
reviews: [Review] @join__field(graph: REVIEWS)
}

type Query
@join__type(graph: ACCOUNTS)
@join__type(graph: INVENTORY)
@join__type(graph: PRODUCTS)
@join__type(graph: REVIEWS) {
me: User @join__field(graph: ACCOUNTS)
user(id: ID!): User @join__field(graph: ACCOUNTS)
users: [User] @join__field(graph: ACCOUNTS)
topProducts(first: Int = 5): [Product] @join__field(graph: PRODUCTS)
}

type Review @join__type(graph: REVIEWS, key: "id") {
id: ID!
body: String
product: Product
author: User @join__field(graph: REVIEWS, provides: "username")
}

type User
@join__type(graph: ACCOUNTS, key: "id")
@join__type(graph: REVIEWS, key: "id") {
id: ID!
name: String @join__field(graph: ACCOUNTS)
username: String
@join__field(graph: ACCOUNTS)
@join__field(graph: REVIEWS, external: true)
birthday: Int @join__field(graph: ACCOUNTS)
reviews: [Review] @join__field(graph: REVIEWS)
}
Loading
Loading