Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-watson committed Jun 22, 2021
0 parents commit 42be834
Show file tree
Hide file tree
Showing 33 changed files with 5,168 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .docker/graph-router.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:14-alpine
WORKDIR /apollo-federation-testing/graph-router
COPY . /apollo-federation-testing/graph-router
RUN rm -frv /apollo-federation-testing/graph-router/src/implementations/*
RUN rm -frv /apollo-federation-testing/.docker/*
RUN rm -frv /apollo-federation-testing/.vscode/*
RUN rm -frv /apollo-federation-testing/.deployments/*
RUN rm -frv /apollo-federation-testing/node_modules/*
RUN npm install
EXPOSE 4000
CMD [ "npm", "run", "start:graph-router" ]
18 changes: 18 additions & 0 deletions .docker/inventory.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:14-alpine
WORKDIR /apollo-federation-testing/inventory
COPY . /apollo-federation-testing/inventory
RUN rm -frv /apollo-federation-testing/inventory/src/implementations/*
RUN rm -frv /apollo-federation-testing/inventory/src/gateway.ts
RUN rm -frv /apollo-federation-testing/inventory/src/index.ts
RUN rm -frv /apollo-federation-testing/inventory/src/subgraphs/users.ts
RUN rm -frv /apollo-federation-testing/inventory/src/subgraphs/users.graphql
RUN rm -frv /apollo-federation-testing/inventory/src/subgraphs/products.graphql
RUN rm -frv /apollo-federation-testing/.docker/*
RUN rm -frv /apollo-federation-testing/.vscode/*
RUN rm -frv /apollo-federation-testing/.deployments/*
RUN rm -frv /apollo-federation-testing/node_modules/*
RUN npm install
RUN npm uninstall @apollo/gateway
RUN npm uninstall concurrently
EXPOSE 4003
CMD [ "npm", "run", "start:inventory" ]
18 changes: 18 additions & 0 deletions .docker/users.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:14-alpine
WORKDIR /apollo-federation-testing/users
COPY . /apollo-federation-testing/users
RUN rm -frv /apollo-federation-testing/users/src/implementations/*
RUN rm -frv /apollo-federation-testing/users/src/gateway.ts
RUN rm -frv /apollo-federation-testing/users/src/index.ts
RUN rm -frv /apollo-federation-testing/users/src/subgraphs/inventory.ts
RUN rm -frv /apollo-federation-testing/users/src/subgraphs/inventory.graphql
RUN rm -frv /apollo-federation-testing/users/src/subgraphs/products.graphql
RUN rm -frv /apollo-federation-testing/.docker/*
RUN rm -frv /apollo-federation-testing/.vscode/*
RUN rm -frv /apollo-federation-testing/.deployments/*
RUN rm -frv /apollo-federation-testing/node_modules/*
RUN npm install
RUN npm uninstall @apollo/gateway
RUN npm uninstall concurrently
EXPOSE 4002
CMD [ "npm", "run", "start:users" ]
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
npm-debug.log
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Ignore the compiled output.
dist/

# TypeScript incremental compilation cache
*.tsbuildinfo

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Coverage (from Jest)
coverage/

# JUnit Reports (used mainly in CircleCI)
reports/
junit.xml

# Node modules
node_modules/

# Mac OS
.DS_Store

# Intellij Configuration Files
.idea/

results.md
supergraph.graphql
74 changes: 74 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Debug Test",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/dist/index.js",
"outFiles": [
"${workspaceFolder}/**/*.js"
],
"preLaunchTask": "npm: build:compile"
},
{
"type": "pwa-node",
"request": "launch",
"name": "Debug Gateway",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/dist/gateway.js",
"outFiles": [
"${workspaceFolder}/**/*.js"
],
"preLaunchTask": "npm: build"
},
{
"type": "pwa-node",
"request": "launch",
"name": "Debug Users",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/dist/subgraphs/users.js",
"outFiles": [
"${workspaceFolder}/**/*.js"
],
"preLaunchTask": "npm: build:compile"
},
{
"type": "pwa-node",
"request": "launch",
"name": "Debug Inventory",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/dist/subgraphs/inventory.js",
"outFiles": [
"${workspaceFolder}/**/*.js"
],
"preLaunchTask": "npm: build:compile"
},
{
"type": "pwa-node",
"request": "launch",
"name": "Debug Products",
"skipFiles": [
"<node_internals>/**"
],
"program": "dist/index.js",
"outFiles": [
"${workspaceFolder}/**/*.js"
],
"preLaunchTask": "build",
"cwd": "${workspaceFolder}/src/implementations/apollo-server"
}
]
}
12 changes: 12 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "cd src/implementations/apollo-server && npm run build"
}
]
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Setup


1. `export CHANGE_MINIKUBE_NONE_USER`
2. `minikube start`
3. `npm i` (this will also run a `postinstall` that will build the base project assets and push the images into `minikube`)
- `npm run build` - compiles typescript code and composes supergraph SDL
- `npm run docker` - build docker images for `graph-router`, `users` and `inventory`
- `npm run minikube:load` - load docker images for `graph-router`, `users` and `inventory` to `minikube`
- `npm run minikube:deploy` - apply deployment yaml files for `graph-router`, `users`, `inventory` to minikube
- `npm run minikube:expose` - expose ports for deployments
4. `minikube tunnel` - _note this is required for an external-ip to get assigned_
5. `npm run minikube:ip:graph-router` _(optional)_- this is how you can get the IP address of the graph router running in minikube. There are also similar commands for `users` and `inventory`

## Running the Test


35 changes: 35 additions & 0 deletions images/testing-flow.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<mxfile>
<diagram id="eWnmgXn1XkVClgfd-X_6" name="Page-1">
<mxGraphModel dx="1302" dy="623" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="2" target="3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="2" value="Start" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="20" y="55" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="6" value="No" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="3">
<mxGeometry relative="1" as="geometry">
<mxPoint x="450" y="85" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="3">
<mxGeometry relative="1" as="geometry">
<mxPoint x="290" y="230" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="3" value="query { _service { sdl } }&lt;br&gt;does this work?" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="200" y="20" width="180" height="130" as="geometry"/>
</mxCell>
<mxCell id="9" value="Unable&amp;nbsp;" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;dashed=0;" vertex="1" parent="1">
<mxGeometry x="580" y="20" width="260" height="145" as="geometry"/>
</mxCell>
<mxCell id="12" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="230" y="230" width="120" height="60" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Loading

0 comments on commit 42be834

Please sign in to comment.