Knowledge sharing is crucial to success when rolling out Chaos Engineering in your organization. With the recent release of experiment templates, we invested heavily in making it easier to share knowledge and help teams get started with Chaos Engineering.
Administrators can create their own experiment templates to offer tailored experiment suggestions to their teams. However, as some of our customers use Steadybit on-premise and run multiple platform instances, keeping all templates in sync across platform instances has always been challenging. This blog post covers how to solve this challenge using hub connections and API-based template synchronization.
Let’s quickly recap why experiment templates are so powerful for knowledge sharing and helping your teams to start with Chaos Engineering.
First, let’s focus on using a template to create a new experiment: You are guided step-by-step through the creation of the experiment via a customizable wizard. This approach helps to build the overall scenario. Of course, you get the same powerful auto-completion of values to avoid trial-and-error when setting up everything.
Naturally, administrators can tailor the available templates and create their own experiment templates in the template editor. Here, they get the powerful drag-and-drop editor to design their scenario easily.
To make a template universally applicable, you can use template placeholders that result in wizard steps when using the template. You can arrange the placeholders freely, describe them via Markdown, and reference them across multiple steps. This makes it easy for teams to use a template by giving them full context on what to fill in.
Now, with hub connections, you can connect Reliability Hubs – like the one from Steadybit available at https://hub.steadybit.com/ – to sync content to your platform.
Steadybit’s Reliability Hub is connected by default, and templates may already be synced to your platform. You can import new templates or update already imported ones whenever you want. This way, the Hub is always the single point of truth for all your Chaos Engineering efforts. In addition, you can host your own private hub, as you’ll learn in the next section.
Hosting your own private hub is easy! All you need is a JSON-based index file served via HTTP that references available content (i.e., template).
The easiest way to learn how it works is to check out Steadybit’s Reliability Hub Database, which is available as a public GitHub repository: steadybit/reliability-hub-db. The index.json contains a `lastChange` UNIX timestamp and references all supported templates. An individual template.json file is exactly the template file exported from the platform.
Whenever you sync the platform with the hub, it only fetches all individual templates when the `lastChange` UNIX timestamp has changed.
To keep multiple platforms in sync, you can use the Hub as a single source of truth by connecting it to all your on-premise platforms and periodically re-importing existing templates. This is a perfect job for automation via API!
To do this, you need to set up an Administrator Access Token. Once authenticated, you need to perform three simple steps:
The first step is to connect the new hub. This step only needs to be done once. When connecting the hub, you can also immediately fetch all templates, but we’ll do this in step 2.
curl 'https://platform.steadybit.com/api/hubs?synchronize=false' \ --header 'Content-Type: application/json' \ --header 'Accept: application/vnd.steadybit.api.v1+json' \ --header 'Authorization: accessToken <replace-access-token>' \ --data '{ Â Â "hubName": "My Private Reliability Hub", Â Â "repositoryUrl": "<link-to-index.json>", Â Â "hubLink": "<optional-public-link-for-hosted-UI>" }'
The response body contains the id of the newly added hub, which you can extract by piping it to jq (appending `| jq ‘.id’` to the above command).
Now, you must fetch all the templates available in the connected hub. You can easily do that using the following curl command, referencing the added hub of step 1 via id.
curl -X POST 'https://platform.steadybit.com/api/hubs/<replace-hub-id>/resync' \ --header 'Content-Type: application/json' \ --header 'Authorization: accessToken <replace-access-token>' | jq -r '.templates | map(.id)'
The body contains all template IDs you can import in the last step.
[   "0363a90e-9563-494c-bd25-81da6e4c3d20",   "0363a90e-9563-494c-bd25-81da6e4c3d21",   //… ]
Finally, we import the templates from the connected hub via a single API command. You can decide always to overwrite or just import the missing ones.
curl --location 'https://platform.steadybit.com/api/experiments/templates/imports?overwrite=true' \ --header 'Content-Type: application/json' \ --header 'Authorization: accessToken <replace-access-token>' \ --data '{ Â Â "hubId": "<replace-hub-id>", Â Â "templates": [ Â Â Â Â <replace-template-ids> Â Â ] }'
In this blog post, we addressed the challenge of maintaining the consistency of experiment templates across multiple on-premise platforms by providing a robust solution using hub connections and API-based synchronization. You can ensure your templates remain up-to-date by leveraging Steadybit’s Reliability Hub or hosting your own private hub.
If you want to explore which templates we provide, check out the Steadybit Reliability Hub or sign up for a free trial at signup.steadybit.com and create your first experiment using one of the templates.
Cookies simplify provisioning of our services. By using our services,
you agree that we use cookies. Further information.
Show Cookies