Prerequisites
- A PlanetScale organization, and permission to create service tokens and webhooks in it.
- A Squasher API key with the
project:writepermission, if you connect with the CLI or the API. See API keys.
Create a service token
- In PlanetScale, open your organization settings and create a service token.
- Give the token these organization permissions. All of them are read-only.
- Copy the token ID and the token. PlanetScale shows the token one time.
Connect PlanetScale
- Dashboard
- CLI
- API
- Open your project and select Settings in the sidebar, then the Integrations tab.
- On the PlanetScale card, select Connect.
- Enter the organization name, the token ID, and the token, then save.
webhook_url for the next step.
Send deploy events
Deploy requests and branch events come from a PlanetScale webhook. Squasher records each event as a deployment.1
Add the webhook in PlanetScale
In the database settings in PlanetScale, add a webhook. Use the webhook URL that Squasher shows
after you connect. Select the
deploy_request.* events and branch.ready.2
Save the signing secret in Squasher
PlanetScale shows a signing secret for the webhook. Squasher uses it to check each delivery.
Paste it on the PlanetScale card, or pipe it to the CLI:The API request is
PUT /v1/projects/{project_id}/provider-connections/planetscale/webhook
with {"secret": "..."}. The secret has at least 8 characters.
Squasher drops a delivery when its
x-planetscale-signature does not match the saved secret.
What Squasher pulls
Every 5 minutes, Squasher reads the database and branch list and the Prometheus metrics endpoint of each branch. It stores the metrics as OpenTelemetry metrics, for exampleplanetscale_vtgate_query_executions_total, planetscale_vtgate_errors_total,
planetscale_vtgate_queries_duration, planetscale_mysql_replica_lag_seconds, and
planetscale_pods_cpu_util_percentages. Squasher sends your service token only to
https://api.planetscale.com. It does not read a metrics endpoint on any other host.
Each branch metric has these resource attributes:
Query the metrics in Metrics, or see the databases and branches with their key metrics under
Infrastructure, on the Providers tab.
Check the connection
Troubleshooting
Next steps
Provider connections
Connect other providers and check their state.
Deployments API
Read the deployments that deploy requests create.