Set up the data plane
Deploy the Braintrust data plane infrastructure in your Google Cloud project.1
Configure the Terraform module
The Braintrust Terraform module contains all the necessary resources for a self-hosted Braintrust data plane. A dedicated Google Cloud project for your Braintrust deployment is recommended but not required.
-
Copy the entire contents of the
examples/braintrust-data-planedirectory from the terraform-google-braintrust-data-plane repository into your own repository. -
In
provider.tf, configure your Google Cloud project and region. -
In
backend.tf, set up your remote backend (typically a GCS bucket). -
In
main.tf, customize the Braintrust deployment settings. The defaults are for suitable for a large production-sized deployment. Adjust them based on your needs, but keep in mind the hardware requirements.
2
Enable Google Cloud APIs
Before deploying, enable the required Google Cloud services. Run the following in Cloud Shell:
-
In a Cloud Shell, set the project to deploy Braintrust into:
-
Enable the required services:
3
Deploy the Terraform module
Initialize and apply the Terraform configuration:This will create all necessary GCP resources including:
- GKE cluster for running Braintrust services
- Cloud SQL PostgreSQL database
- Cloud Memorystore Redis cache
- Cloud Storage buckets
- VPC network and subnets
- Cloud KMS key for encryption
4
Connect to GKE cluster
After the Terraform deployment completes, connect to your GKE cluster:Verify the connection:
5
Create Kubernetes namespace
Create the namespace for Braintrust:
6
Create Kubernetes secrets
Create the required Kubernetes secrets for your deployment. You’ll need to create secrets for:
REDIS_URL: Redis connection stringPG_URL: PostgreSQL connection stringGCS_ACCESS_KEY_IDandGCS_SECRET_ACCESS_KEY: Credentials for object storeFUNCTION_SECRET_KEY: Randomly-generated secret string- Brainstore license key
7
Configure Helm values
Create a
helm-values.yaml file for your deployment. Refer to the Helm chart documentation for configuration options.8
Deploy Helm chart
Deploy the Braintrust Helm chart to your cluster. Refer to the Helm chart documentation for configuration options.
9
Get your API URL
The dataplane requires a HTTPS connection to the API pods. This connection will require a valid HTTPS certificate that is trusted by the clients connecting to the data plane. Although Google doesn’t have a native service, there are several ways to provide a DNS name with a SSL certificate.
- Use Cloud Run to run a NGINX container to do SSL termination.
- Use a Load balancer for the API service with a certificate from an internal CA or with Let’s Encrypt.
Configure your organization
Connect your Braintrust organization to your newly deployed data plane.1
Point your organization to your data plane
- In the Braintrust UI, go to Settings > Data plane.
- In API URL area, select Edit.
- Enter the API URL from the last step.
- Leave the other fields blank.
- Select Save.
2
Verify the connection
The UI will automatically test the connection to your new data plane. Verify that the ping to each endpoint is successful.
Update the deployment
Updating your GCP deployment involves two steps: updating infrastructure with Terraform and updating services with Helm.Update infrastructure (Terraform)
Runterraform apply to update infrastructure components (database, Redis, networking, storage, etc.):
?ref=<version> to the module source:
Update services (Helm)
After updating infrastructure, upgrade the Helm chart to update service containers and configurations:In some cases, Terraform changes must be applied before Helm upgrades. Check the release notes for any specific upgrade ordering requirements.