-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up ms-apollo and update deployment
- Loading branch information
Showing
17 changed files
with
7,038 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { Config } from "./lib/types"; | ||
|
||
export const config: Config = { | ||
apps: [{ service: "internal", subdomain: "internal" }, { service: "app" }], | ||
|
||
supergraph: { | ||
service: "mesh", | ||
runtime: "lambda", | ||
path: "/graphql", | ||
}, | ||
|
||
subgraphs: [ | ||
{ name: "users", project: "ms-gql-users" }, | ||
{ name: "products", project: "ms-gql-products" }, | ||
{ name: "reviews", project: "ms-gql-reviews" }, | ||
], | ||
|
||
experimental: { | ||
additionalSupergraphs: [ | ||
{ | ||
service: "gateway", | ||
runtime: "lambda", | ||
path: "/graphql-gateway", | ||
}, | ||
{ | ||
service: "router", | ||
runtime: "lambda", | ||
path: "/graphql-router", | ||
}, | ||
{ | ||
service: "router", | ||
runtime: "app-runner", | ||
path: "/graphql-app-router", | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as cdk from "aws-cdk-lib"; | ||
import { Construct } from "constructs"; | ||
import * as lambda from "aws-cdk-lib/aws-lambda"; | ||
import * as appRunner from "@aws-cdk/aws-apprunner-alpha"; | ||
|
||
export interface StackProps extends cdk.StackProps { | ||
/** | ||
* The path to the assets we are deploying. | ||
*/ | ||
readonly assets: string; | ||
|
||
/** | ||
* The environment variables for the function. | ||
*/ | ||
readonly environment?: { [key: string]: string }; | ||
|
||
/** | ||
* The name we want to give the function. | ||
*/ | ||
readonly functionName: string; | ||
|
||
/** | ||
* The billing group to associate with this stack. | ||
*/ | ||
readonly billingGroup: string; | ||
} | ||
|
||
/** | ||
* Set up an a Lambda Function. | ||
*/ | ||
export class Stack extends cdk.Stack { | ||
/** | ||
* The URL to access the Lambda Function. | ||
*/ | ||
// public readonly functionUrl: string; | ||
|
||
constructor(scope: Construct, id: string, props: StackProps) { | ||
super(scope, id, props); | ||
|
||
new appRunner.Service(this, "Service", { | ||
source: appRunner.Source.fromEcrPublic({ | ||
imageConfiguration: { port: 8000 }, | ||
imageIdentifier: | ||
"public.ecr.aws/aws-containers/hello-app-runner:latest", | ||
}), | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
export type Config = { | ||
/** | ||
* Which Applications to deploy: | ||
* - internal: Leptos (Rust/WASM) | ||
* - app: React/Next.js (TypeScript) | ||
* | ||
* NOTE: Only `internal` supports specifying a subdomain. The `app` is | ||
* always located at the root. | ||
* | ||
* Example: | ||
* ```ts | ||
* apps: [ | ||
* { service: "internal", subdomain: "internal" }, | ||
* { service: "app" } | ||
* ] | ||
* ``` | ||
*/ | ||
apps: App[]; | ||
|
||
/** | ||
* Which supergraph to use: | ||
* - mesh: [GraphQL Mesh](https://the-guild.dev/graphql/mesh) | ||
* - router: [Apollo Router](https://www.apollographql.com/docs/router/) | ||
* - gateway: [Apollo Gateway](https://www.apollographql.com/docs/apollo-server/using-federation/apollo-gateway-setup) | ||
* | ||
* NOTE: The `path` defines the path on the App domains where the API will be | ||
* accessible, to avoid running into CORS issues by needing to go cross-domain. | ||
* | ||
* Example: | ||
* ```ts | ||
* supergraph: { | ||
* service: "mesh", | ||
* runtime: "lambda", | ||
* path: "/graphql", | ||
* } | ||
* ``` | ||
*/ | ||
supergraph: Supergraph; | ||
|
||
/** | ||
* Specify the set of subgraphs to run. | ||
* | ||
* NOTE: The `name` is used to identify the subgraph in the supergraph, and | ||
* will be used to construct the environment variable with its URL that is | ||
* passed to the supergraph. E.g. a name of `users` will turn into `SUBGRAPH_USERS_URL`. | ||
* | ||
* Example: | ||
* ```ts | ||
* subgraphs: [ | ||
* { name: "users", project: "ms-gql-users" }, | ||
* { name: "products", project: "ms-gql-products" }, | ||
* { name: "reviews", project: "ms-gql-reviews" }, | ||
* ] | ||
* ``` | ||
*/ | ||
subgraphs: Subgraph[]; | ||
|
||
/** | ||
* Experimental features. | ||
*/ | ||
experimental: { | ||
/** | ||
* Set up additional supergraphs. | ||
* | ||
* NOTE: Make sure to not overlap the paths. | ||
*/ | ||
additionalSupergraphs: Supergraph[]; | ||
}; | ||
}; | ||
|
||
export type Subgraph = { | ||
name: string; | ||
project: string; | ||
runtime?: "lambda"; | ||
memory?: | ||
| 128 | ||
| 256 | ||
| 512 | ||
| 1024 | ||
| 2048 | ||
| 3072 | ||
| 4096 | ||
| 5120 | ||
| 6144 | ||
| 7168 | ||
| 8192 | ||
| 9216 | ||
| 10240; | ||
}; | ||
|
||
export type App = | ||
| { service: "internal"; subdomain: string } | ||
| { service: "app" }; | ||
|
||
export type Supergraph = | ||
| { | ||
service: "mesh"; | ||
runtime: "lambda"; | ||
path: string; | ||
} | ||
| { | ||
service: "gateway"; | ||
runtime: "lambda"; | ||
path: string; | ||
} | ||
| { | ||
service: "router"; | ||
runtime: "app-runner" | "lambda"; | ||
path: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.