Skip to main content

Creating a plugin

Plugins enable Cortex users to pull more data into the portal from any source, expose custom metrics, and customize the UI to match other internal tools.

You can create a new plugin from scratch by using the Cortex Plugin Template in the Scaffolder.

creating plugins 1

You'll first be prompted to enter a Project Name and License for the plugin.

creating plugins 2

Next, you'll enter information about your plugin's repository. Through the Scaffolder, Cortex will automatically set up a React + TypeScript repository for you with the basic setup for your plugin to make it easy to get started.

The last step is configuring the plugin as a service, including a name, identifier, and description - these data will appear in the catalogs.

Once you’ve finished filling out the template form, press Create service to finish setting up the repository.

Clone the repository locally and install dependencies via yarn. Then run yarn build to generate a single HTML file representing your plugin (output at ./dist/ui.html).

If you want to make any changes to the plugin, modify the code before running or re-running the build command.

note

For simplicity, this guide uses yarn for operating commands and dependencies. npm also works so you can substitute commands as appropriate.

Go to the Plugins page in Cortex and click Register plugin.

creating plugins 3

Enter some basic display information about the plugin (name, tag, and description).

In the Plugin context section, you have a number of choices about where the plugin displays.

creating plugins 4

The Minimum user role will dictate the users who can see the plugin: MANAGER, OWNER, USER, or VIEWER.

If you've created one or more proxies, you can select one from the dropdown menu under Associated proxy.

Toggle on Include in global context if you want the plugin to appear under the All tab on the Plugins page.

Click Add another context if you want the plugin to appear on entity details pages. From there you can filter the types of entities the plugin should appear for.

creating plugins 5

Finally, upload the HTML file generated from the yarn build command to see a preview of the plugin.

tip

The preview is a good place to iterate on any changes you might want to make to the plugin.

You can toggle on Enable dev mode to view the preview using code running at http://localhost:9000/ui.html. Use yarn dev or npm run dev from your Scaffolded plugin to run your plugin code from this location.

When you’re satisfied with the output, press Save plugin to complete registration.

Plugin appearance in Cortex

Admins can configure where plugins appear from Appearance settings.

creating plugins 6

You can choose up to 5 plugins to display in the main nav. If 3 or more plugins are selected, they'll be nested under the Plugins menu in the nav.

Dev homepage plugins

You can choose up to 3 plugins to display on the Dev homepage. These will display as tabs after Pending verifications.

Proxies

You can create and manage proxies on the Plugins page from the Proxies tab.

creating plugins 7

To use proxies with sensitive information (like an access token), first create a secret in settings.

For a more in-depth look at creating plugins, including a sample plugin proxy configuration and sample plugin code, check out our plugin docs.