Skip to content

Commit

Permalink
Use GQL schema stitching to proxy queries to multiple watchers (#18)
Browse files Browse the repository at this point in the history
* Use apollo federation router to proxy gql queries to multiple watchers

* Use graphql stitch to proxy requests to all watchers

* Load watcher endpoints and prefixes from json

* Transpile typescript and setup lint

* Change conflicting metrics ports

* Add comments
  • Loading branch information
nikugogoi authored May 2, 2023
1 parent a44de43 commit 86fe1c0
Show file tree
Hide file tree
Showing 19 changed files with 1,639 additions and 51 deletions.
6 changes: 3 additions & 3 deletions packages/azimuth-watcher/environments/local.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[server]
host = "127.0.0.1"
port = 3009
port = 3001
kind = "lazy"

# Checkpointing state.
Expand Down Expand Up @@ -48,8 +48,8 @@

[upstream]
[upstream.ethServer]
gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8081"
gqlApiEndpoint = "http://127.0.0.1:8083/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8082"

[upstream.cache]
name = "requests"
Expand Down
10 changes: 5 additions & 5 deletions packages/censures-watcher/environments/local.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[server]
host = "127.0.0.1"
port = 3009
port = 3002
kind = "lazy"

# Checkpointing state.
Expand Down Expand Up @@ -32,9 +32,9 @@

[metrics]
host = "127.0.0.1"
port = 9000
port = 9002
[metrics.gql]
port = 9001
port = 9003

[database]
type = "postgres"
Expand All @@ -48,8 +48,8 @@

[upstream]
[upstream.ethServer]
gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8081"
gqlApiEndpoint = "http://127.0.0.1:8083/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8082"

[upstream.cache]
name = "requests"
Expand Down
10 changes: 5 additions & 5 deletions packages/claims-watcher/environments/local.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[server]
host = "127.0.0.1"
port = 3009
port = 3003
kind = "lazy"

# Checkpointing state.
Expand Down Expand Up @@ -32,9 +32,9 @@

[metrics]
host = "127.0.0.1"
port = 9000
port = 9004
[metrics.gql]
port = 9001
port = 9005

[database]
type = "postgres"
Expand All @@ -48,8 +48,8 @@

[upstream]
[upstream.ethServer]
gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8081"
gqlApiEndpoint = "http://127.0.0.1:8083/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8082"

[upstream.cache]
name = "requests"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[server]
host = "127.0.0.1"
port = 3009
port = 3004
kind = "lazy"

# Checkpointing state.
Expand Down Expand Up @@ -32,9 +32,9 @@

[metrics]
host = "127.0.0.1"
port = 9000
port = 9006
[metrics.gql]
port = 9001
port = 9007

[database]
type = "postgres"
Expand All @@ -48,8 +48,8 @@

[upstream]
[upstream.ethServer]
gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8081"
gqlApiEndpoint = "http://127.0.0.1:8083/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8082"

[upstream.cache]
name = "requests"
Expand Down
10 changes: 5 additions & 5 deletions packages/delegated-sending-watcher/environments/local.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[server]
host = "127.0.0.1"
port = 3009
port = 3005
kind = "lazy"

# Checkpointing state.
Expand Down Expand Up @@ -32,9 +32,9 @@

[metrics]
host = "127.0.0.1"
port = 9000
port = 9008
[metrics.gql]
port = 9001
port = 9009

[database]
type = "postgres"
Expand All @@ -48,8 +48,8 @@

[upstream]
[upstream.ethServer]
gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8081"
gqlApiEndpoint = "http://127.0.0.1:8083/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8082"

[upstream.cache]
name = "requests"
Expand Down
10 changes: 5 additions & 5 deletions packages/ecliptic-watcher/environments/local.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[server]
host = "127.0.0.1"
port = 3009
port = 3006
kind = "lazy"

# Checkpointing state.
Expand Down Expand Up @@ -32,9 +32,9 @@

[metrics]
host = "127.0.0.1"
port = 9000
port = 9010
[metrics.gql]
port = 9001
port = 9011

[database]
type = "postgres"
Expand All @@ -48,8 +48,8 @@

[upstream]
[upstream.ethServer]
gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8081"
gqlApiEndpoint = "http://127.0.0.1:8083/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8082"

[upstream.cache]
name = "requests"
Expand Down
2 changes: 2 additions & 0 deletions packages/gateway-server/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Don't lint build output.
dist
28 changes: 28 additions & 0 deletions packages/gateway-server/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"semistandard",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": ["error", 2, { "SwitchCase": 1 }],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": [
"warn",
{
"allowArgumentsExplicitlyTypedAsAny": true
}
]
}
}
5 changes: 5 additions & 0 deletions packages/gateway-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/

.vscode
.idea
Loading

0 comments on commit 86fe1c0

Please sign in to comment.