Skip to content

Commit

Permalink
Migrate to local Router (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
smyrick authored Oct 19, 2023
1 parent a452dcf commit a4fbca2
Show file tree
Hide file tree
Showing 18 changed files with 623 additions and 3,261 deletions.
72 changes: 10 additions & 62 deletions .github/workflows/merge-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: merge-to-main
on:
push:
branches: [ "main" ]
workflow_dispatch:

env:
APOLLO_KEY: ${{ secrets.APOLLO_KEY }}
Expand All @@ -25,95 +26,42 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install Rover
run: |
curl -sSL https://rover.apollo.dev/nix/latest | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- uses: apollosolutions/rover-actions/install-rover-cli@v1

- name: Publish subgraph schema
- name: Publish README
run: rover readme publish apollo-financial-supergraph@prod --file README.md

- name: Publish accounts schema
working-directory: ./subgraphs/accounts
run: |
rover subgraph publish apollo-financial-supergraph@prod \
--name accounts \
--schema schema.graphql
subgraph-credit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Rover
run: |
curl -sSL https://rover.apollo.dev/nix/latest | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Publish subgraph schema
- name: Publish credit schema
working-directory: ./subgraphs/credit
run: |
rover subgraph publish apollo-financial-supergraph@prod \
--name credit \
--schema schema.graphql
subgraph-risk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Rover
run: |
curl -sSL https://rover.apollo.dev/nix/latest | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Publish subgraph schema
- name: Publish risk schema
working-directory: ./subgraphs/risk
run: |
rover subgraph publish apollo-financial-supergraph@prod \
--name risk \
--schema schema.graphql
subgraph-transactions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Rover
run: |
curl -sSL https://rover.apollo.dev/nix/latest | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Publish subgraph schema
- name: Publish transactions schema
working-directory: ./subgraphs/transactions
run: |
rover subgraph publish apollo-financial-supergraph@prod \
--name transactions \
--schema schema.graphql
subgraph-users:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Rover
run: |
curl -sSL https://rover.apollo.dev/nix/latest | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Publish subgraph schema
- name: Publish users schema
working-directory: ./subgraphs/users
run: |
rover subgraph publish apollo-financial-supergraph@prod \
--name users \
--schema schema.graphql
publish-README:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Rover
run: |
curl -sSL https://rover.apollo.dev/nix/latest | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Publish README
run: rover readme publish apollo-financial-supergraph@prod --file README.md
12 changes: 5 additions & 7 deletions .github/workflows/pr-check-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ jobs:
env:
CI: true
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v3

- uses: apollosolutions/rover-actions/install-rover-cli@v1

- uses: actions/setup-node@v3
with:
node-version: 18.x
node-version-file: '.nvmrc'
cache: "npm"

- run: npm ci
Expand All @@ -29,10 +30,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install Rover
run: |
curl -sSL https://rover.apollo.dev/nix/latest | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- uses: apollosolutions/rover-actions/install-rover-cli@v1

- name: Check accounts subgraph
run: |
Expand Down
6 changes: 0 additions & 6 deletions .graphqlconfig

This file was deleted.

3 changes: 0 additions & 3 deletions .stackblitzrc

This file was deleted.

5 changes: 3 additions & 2 deletions DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
### Software requirements

* Install the latest LTS version of Node (preferably using [nvm](https://github.com/nvm-sh/nvm))
* Install the latest [Rover CLI](https://www.apollographql.com/docs/rover/getting-started)

### Install dependencies

```shell
npm install
```

### Running the subgraphs and gateway
### Running the subgraphs and Router in dev

Run the subgraphs and gateway, which use [Apollo Server](https://www.apollographql.com/docs/apollo-server/), using `npm`
Run the subgraphs and Router, which use [Apollo Server](https://www.apollographql.com/docs/apollo-server/), using `npm`

```shell
npm run dev
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ If you would like to run some sample operations, checkout the public [Operation
### Other libraries used
* [@apollo/server](https://www.apollographql.com/docs/apollo-server)
* [@apollo/subgraph](https://www.apollographql.com/docs/apollo-server/using-federation/api/apollo-subgraph/)
* [Apollo Router](https://www.apollographql.com/docs/router)
* [@apollosolutions/simple-auth-directive](https://github.com/apollosolutions/simple-auth-directive)

## Local Development
Expand Down
16 changes: 0 additions & 16 deletions dev.js

This file was deleted.

40 changes: 0 additions & 40 deletions federation-spec.graphql

This file was deleted.

15 changes: 0 additions & 15 deletions gateway/header-forwarding.js

This file was deleted.

55 changes: 0 additions & 55 deletions gateway/server.js

This file was deleted.

14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { startSubgraphs } from './subgraphs/subgraphs.js';

// For local development, we will run `rover dev` that will handle
// composition and configure the ports of the Router and subgraphs manually
// See supergraph-config-dev.yaml for config setup
(async () => {
// start subgraphs in monolith mode
let port = undefined;
if (process.env.NODE_ENV === 'dev') {
// If you change this port for local dev, update rover dev config
port = 4001;
}
await startSubgraphs(port);
})();
Loading

0 comments on commit a4fbca2

Please sign in to comment.