Skip to main content

Making an API Extension

Walkthroughs

Get the sample code

Get the sample code

Read the api docs for information about how plugins work

Buiding & Running

Typically, plugins are placed into the plugins directory. These will be included in backups.

Copy the API sample

cp -R ../api_sample_plugin my_plugin
cd my_plugin
docker compose build
export SUPERDIR=/home/spr/super/ #path where super is
docker compose up

API Calls

The plugin can export API extensions over a unix socket to the API. Configuration can be set by updating configs/base/api.json and adding a new entry to the Plugins list

{
"Name": "my_plugin",
"URI": "my_plugin"",
"UnixPath": "/state/plugins/my_plugin/socket",
"Enabled": true,
"Plus": false,
"GitURL": "",
"ComposeFilePath": ""
},

or by updating the UI

extensions-plugin

Configuring the plugin to auto-start

In an upcoming release, this mechanism will be streamlined for advanced users.

For now, SPR does not allow arbitrary containers to be configured for auto-start from the UI alone. Update the configs/base/custom_compose_paths.json to add the plugin. It is expected to be relative from the super/ directory, for example plugins/my_plugin/docker-compose.yml

SPRBus notes

SPRBus is our event bus where the API can send events. The sample includes commented code for how to use it.