LanternlyDocs

Configure

Plugins

Plugins add service kinds, pages, settings and timers without the core knowing about them. Lanternly ships with one, Amazon Web Services, and you can write your own.

Turning plugins on and off

Owners open Settings → Plugins → Manage plugins. Each plugin says what it adds and what turning it off does. A fresh install starts with every plugin off.

Turning a plugin off hides its pages, menu items and buttons, but never stops what it created: services keep running, backed up and monitored, and servers it made stay listed so they can still be followed and deleted.

Included plugins

Write a plugin

A plugin lives in src/plugins/<id>/. The AWS plugin (src/plugins/aws/) is a complete example.

  1. Describe it. Create src/plugins/<id>/plugin.ts exporting a DeployerPlugin (typed in src/plugins/types.ts): id, name, description, icon, the pages it owns, optional side-menu items ({ href, label, icon, group }) and service kinds.
  2. Register it. Add one line to src/plugins/installed.ts. If it has server code (timers, service kind steps, a latestVersion check), add a line to installed-hooks.ts; if it has React parts (a settings card, Servers or Services page parts, a service's page), to installed-parts.ts.
  3. Guard its pages. Pages under src/app/admin/(console)/ that belong to the plugin call requirePlugin('<id>'); its server actions return pluginOffError('<id>') while it's off.
  4. Server steps. A service kind's own steps on the server go in agent/kinds/<id>.sh, which clubctl loads when present.
  5. Test it. Tests go in tests/plugins/<id>/. Nothing the plugin adds should show while it's off.

How the core reaches plugins

The core never imports a plugin directly. It goes through two files:

  • src/plugins/server.ts: server-side hooks, such as startPlugins() (timers, called at start-up), projectCosts(), serverBusy() and serviceKind() for create, configure and upgrade steps of a plugin's service kind.
  • src/plugins/parts.ts: React parts, such as serversPageParts() (toolbar, notices, footer), parts for the Services page, a service kind's page and its list cells.

Tagging plugin lines

Every line in a shared file that mentions a plugin ends with a comment plugin:<id>, and longer stretches sit between plugin:<id>:start and plugin:<id>:end. A file whose first line carries the tag belongs to the plugin. This lets scripts/export-core.mjs produce a copy without a given plugin (useful for keeping a plugin private), so keep the tags when you edit those lines.

import { awsPlugin } from './aws/plugin' // plugin:aws

Edit this page on GitHub