Skip to content

Commit 4a5343b

Browse files
PascalSennrstaib
andauthored
Updated BCP Fusion Documentation (#6824)
* Update bcp fusion documentation * Update fusion.md * Update fusion.md * Update api-key.md --------- Co-authored-by: Rafael Staib <[email protected]>
1 parent 635bd79 commit 4a5343b

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed

website/src/docs/bananacakepop/v2/apis/fusion.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,76 @@ builder.Services
6767
6868
Now your gateway will be notified whenever there is a new configuration available and will automatically pull it.
6969
70+
## Configure Your Subgraphs
71+
72+
To set up your subgraphs to be linked with your gateway, you need to follow these steps:
73+
74+
### Step 1: Install BananaCakePop.Services Package
75+
76+
First, ensure that the `BananaCakePop.Services` package is installed in your subgraph projects. If not, you can install it by running the following command in the root directory of each subgraph project:
77+
78+
```bash
79+
dotnet add package BananaCakePop.Services
80+
```
81+
82+
### Step 2: Configure Services in Startup
83+
84+
After installing the package, configure the BananaCakePop Services on your schema. Here is an example of how you can do this:
85+
86+
```csharp
87+
services
88+
.AddGraphQLServer()
89+
.AddQueryType<Query>()
90+
.AddBananaCakePopServices(x =>
91+
{
92+
x.ApiKey = "<<your-api-key>>";
93+
x.ApiId = "<<your-subgraph-api-id>>";
94+
x.Stage = "dev";
95+
})
96+
.AddInstrumentation(); // Enable GraphQL telemetry
97+
98+
services
99+
.AddOpenTelemetry()
100+
.WithTracing(x =>
101+
{
102+
x.AddHttpClientInstrumentation();
103+
x.AddAspNetCoreInstrumentation();
104+
x.AddBananaCakePopExporter();
105+
// Register more instrumentation providers such as Entity Framework Core, HttpClient, etc.
106+
});
107+
```
108+
109+
> **Tip: Using Environment Variables**
110+
>
111+
> Alternatively, you can also set the required values using environment variables.
112+
113+
This configuration enables your subgraph to interact with the BananaCakePop services, including telemetry and instrumentation.
114+
115+
### Step 3: Create a Subgraph Configuration File
116+
117+
Each subgraph requires a specific configuration file named `subgraph-config.json`. This file should be placed in the root directory of the subgraph project, next to the `.csproj` file.
118+
119+
Here’s an example of what the `subgraph-config.json` file should look like:
120+
121+
```json
122+
{
123+
"subgraph": "Order", // Name of the subgraph
124+
"http": { "baseAddress": "http://localhost:59093/graphql" }, // Default HTTP settings
125+
"extensions": {
126+
"bcp": {
127+
"apiId": "<<your-subgraph-api-id>>"
128+
}
129+
}
130+
}
131+
```
132+
133+
This file is required for the topology to recognize and display your subgraph correctly.
134+
135+
### Step 4: Pack your subgraph and compose your Gateway
136+
137+
After configuring your subgraph you have to `pack` your subgraph and `compose` your gateway.
138+
This process links your subgraph with the gateway, ensuring a cohesive GraphQL architecture.
139+
70140
## Integration into your CI/CD pipeline
71141
The deployment of a subgraph is a multi step process. To integrate BananaCakePop into this process you need to install Barista, the BananaCakePop CLI. You can find more information about Barista in the [Barista Documentation](/docs/barista/v1).
72142
```bash

website/src/docs/barista/v1/commands/api-key.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ The `barista api-key` command provides a set of subcommands that allow you to ma
88

99
The `barista api-key create` command is used to create a new API key.
1010

11+
> **Important:** Use the value prefixed with `Secret:` as the api key value you pass to `BananaCakePop.Services`
12+
1113
```shell
1214
barista api-key create --api-id abc123
1315
```

website/src/docs/barista/v1/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ Barista is a powerful .NET command-line tool used for managing your GraphQL API'
77
To install Barista, use the .NET Core CLI command:
88

99
```
10-
dotnet tool install --global barista --prerelease
10+
dotnet tool install --global barista
1111
```

0 commit comments

Comments
 (0)