Webhooks for for actions with clones, branches, and snapshots (4.0)
Goal
Allow DBLab admin to configure webhooks in the DBLab config, that would be called by the DBLab engine on any major event related to clones, snapshots, and branches.
The final goal is to be able to start and stop additional software for each clone when it's created or deleted – e.g., some UI, BI tool, REST/GraphQL API, and so on. This is going to be very helpful for those who are going to use DBLab to build "preview" environments, created automatically, say, for each Git branch.
TODO / How to implement
-
Extend DBLab config to support webhooks: -
clone create -
clone delete -
clone reset -
branch create -
branch delete -
branch pointer shifted to different snapshot -
snapshot create -
snapshot delete
-
-
Pre and post -
Multiple hooks can be added for each action -
Engine calls each hook on specific action (we expect either http or https), and logs the HTTP response status -
Advanced: log full response in DEBUG mode – we need to distinguish different objects of the same time (e.g., 5 different clones -> 5 different webhook calls, 3 failed & 2 succeeded) -
Advanced: allow using variables in webhook URL (urlencoded): -
clone / snapshot / branch ID (name) -
clone port (e.g. 6000) -
clone's DB connection string -
clone's container (e.g. dblab_clone_6000) -
self-assigned ID -
if it's feasible, all properties that clone / snapshot / branch has -
anything else?
-
-
GET /clone/{id}
shows info about plugins
Acceptance criteria
As an admin, I can use webhooks – for example:
- I can run PostgREST for each clone, provisioned and deprovisioned automatically via my CI/CD – and my code in Git can work with REST API
- I can have separate client tool deployed for each clone (and destroyed when clone destroyed), for example CloudBeaver or Metabase, so I can work with Postgres via GUI.
Edited by Nikolay Samokhvalov