Skip to content

Latest commit

 

History

History

noderings-backend

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@noderings/backstage-plugin-noderings-backend

Backstage backend plugin for NodeRings. Serves the NodeRings virtual machines, snapshots and DNS records of catalog entities to @noderings/backstage-plugin-noderings, using the official noderings SDK. The NodeRings token stays here.

Full guide: https://docs.noderings.com/docs/client-guides/backstage

Install

New backend system:

yarn --cwd packages/backend add @noderings/backstage-plugin-noderings-backend
// packages/backend/src/index.ts
backend.add(import('@noderings/backstage-plugin-noderings-backend'));

Configure

noderings:
  token: ${NODERINGS_TOKEN} # NodeRings service account token (secret)
  # organizationId: ${NODERINGS_ORGANIZATION_ID}
  # baseUrl: https://api.noderings.com
  cacheTtlSeconds: 60
  allowPowerActions: false

Without a token the plugin starts, logs a warning, and answers 503.

Routes

All under /api/noderings. Every data route needs a signed-in user and an entityRef; the entity is read from the catalog with the caller's credentials, and servers are only returned when they match the entity's noderings.com/vm-tag or noderings.com/vm-ids.

Route Permission
GET /health (no auth) none
GET /entity/virtual-machines?entityRef=…[&refresh=true] noderings.virtualMachine.read
GET /virtual-machines/:id?entityRef=… noderings.virtualMachine.read
GET /virtual-machines/:id/snapshots?entityRef=… noderings.virtualMachine.read
POST /virtual-machines/:id/power { entityRef, action: start|stop|restart } noderings.virtualMachine.power; 404 unless allowPowerActions
GET /entity/dns-records?entityRef=… noderings.dns.read

Server lists are cached per entity for cacheTtlSeconds in the Backstage cache service and invalidated after a power action. NodeRings errors become short answers: 401/403 from NodeRings → 502, 404 → 404, rate limit → 503 with Retry-After, busy or conflict → 409, quota → 409 with the reason, network → 503. Power actions are logged and recorded with the auditor service.

Replace nodeRingsServiceRef to change how the plugin talks to NodeRings.

License: Apache-2.0. Source: https://github.com/noderings/backstage-plugins.