Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
brh55 committed Oct 3, 2023
2 parents 47ff996 + 01d6ae5 commit 099b5a7
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 2 deletions.
66 changes: 64 additions & 2 deletions .github/workflows/create_studio_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,70 @@ jobs:
steps:
- name: Create Graph in Apollo Studio
run: |
echo "GITHUB_ACTOR: ${GITHUB_ACTOR}"
echo "GITHUB_ACTOR: $GITHUB_ACTOR"
curl --request POST 'https://graphql.api.apollographql.com' \
--header 'content-type: application/json' \
--header 'X-API-Key: user:fp.d88ba77d-487c-4b97-9780-f1e4c5352a22:_60kU_wi1yLH1zt60UhxGg' \
--data '{"query":"mutation CreateGraph($graphType: GraphType!, $hiddenFromUninvitedNonAdmin: Boolean!, $createGraphId: ID!, $title: String!, $accountId: ID!) {\n account(id: $accountId) {\n createGraph(graphType: $graphType, hiddenFromUninvitedNonAdmin: $hiddenFromUninvitedNonAdmin, id: $createGraphId, title: $title) {\n ... on Service {\n accountId\n }\n }\n }\n }\n \n \n","variables":{"graphType":"SELF_HOSTED_SUPERGRAPH","hiddenFromUninvitedNonAdmin":false,"createGraphId":"${GITUB_ACTOR}","title":"${GITHUB_ACTOR}","accountId":"summit-2023-enterprise-workshop"},"operationName":"CreateGraph"}'
--data '{"query":"mutation Mutation($accountId: ID!, $graphType: GraphType!, $hiddenFromUninvitedNonAdmin: Boolean!, $createGraphId: ID!, $title: String!, $variantCreationConfig: VariantCreationConfig) {\n account(id: $accountId) {\n createGraph(graphType: $graphType, hiddenFromUninvitedNonAdmin: $hiddenFromUninvitedNonAdmin, id: $createGraphId, title: $title, variantCreationConfig: $variantCreationConfig) {\n __typename\n ... on Service {\n __typename\n id\n }\n ... on GraphCreationError {\n __typename\n message\n }\n }\n }\n}","variables":{"accountId":"summit-2023-enterprise-workshop","graphType":"SELF_HOSTED_SUPERGRAPH","hiddenFromUninvitedNonAdmin":false,"createGraphId":"${{github.actor}}-2023","title":"${{github.actor}}","variantCreationConfig":{"variantName":"current","buildConfigInput":{"apiDirectivePassThrough":[],"buildPipelineTrack":null,"composition":{"subgraphs":[]}}}}}'
keys:
runs-on: ubuntu-latest
steps:
- name: Create Apollo Key
run: |
curl --request POST 'https://graphql.api.apollographql.com' \
--header 'content-type: application/json' \
--header 'X-API-Key: ${{ secrets.APOLLO_USER_KEY }}' \
--data '{"query":"mutation Mutation($graphId: ID!, $keyName: String, $role: UserPermission!) {\n graph(id: $graphId) {\n newKey(keyName: $keyName, role: $role) {\n token\n }\n }\n}","variables":{"graphId":"${{github.actor}}-2023","keyName":"my-first-key","role":"CONTRIBUTOR"}}' -o token.json
cat token.json
- name: Retrieve Apollo Key
run: |
echo "Add code to extract token and save as a github secret"
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rover
run: |
curl -sSL https://rover.apollo.dev/nix/v0.8.1 | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Rover Subgraph Publish Products
run: |
rover subgraph publish ${{secrets.APOLLO_GRAPH_REF }} \
--name products \
--routing-url https://https://subgraph-products-j3nprurqka-ue.a.run.app \
--schema ./products-schema.graphql
- name: Rover Subgraph Publish Orders
run: |
rover subgraph publish ${{secrets.APOLLO_GRAPH_REF}} \
--name orders
--routing-url https://subgraph-orders-j3nprurqka-ue.a.run.app \
--schema ./orders-schema.graphql
- name: Rover Subgraph Publish Customers
run: |
rover subgraph publish ${{secrets.APOLLO_GRAPH_REF}} \
--name customers
--routing-url https://subgraph-customers-j3nprurqka-ue.a.run.app \
--schema ./final/customers-schema.graphql
pqs:
runs-on: ubuntu-latest
steps:
- name: Create PQ List
run: |
echo "Add Curl Command to create PQ List"
- name: Publish PQ List
run: |
rover persisted-queries publish Summit-SE-Workshop@current \
--manifest ./workshop-pq-manifest.json
21 changes: 21 additions & 0 deletions final/router/router.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,27 @@ subscription:
products:
path: /

# Operation Limits
limits:
max_depth: 5
max_height: 10
max_aliases: 3

# Co-Processor Module

coprocessor:
url: https://coprocessor-wn3vwa6nlq-ue.a.run.app # Required. Replace with the URL of your coprocessor's HTTP endpoint.
timeout: 2s # The timeout for all coprocessor requests. Defaults to 1 second (1s)
router: # This coprocessor hooks into the `RouterService`
response: # By including this key, the `RouterService` sends a coprocessor request whenever it first receives a client request.
body: true # By including this key the co-processor can modify the body of the response

# PQL Module
preview_persisted_queries:
enabled: true
safelist:
enabled: true
require_id: false
apq:
enabled: false #Automated persisted queries must be disabled to use PQs

12 changes: 12 additions & 0 deletions final/workshop-pq-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"format": "apollo-persisted-query-manifest",
"version": 1,
"operations": [
{
"id": "Users",
"body": "query Users {\n users {\n firstName\n lastName\n email\n activeCart {\n items {\n colorway\n price\n size\n id\n }\n }\n }\n }",
"name": "Users",
"type": "query"
}
]
}

0 comments on commit 099b5a7

Please sign in to comment.