Skip to content

Worker Backend

The worker administration backend runs through native Perl controllers and models. Frontend requests use /workeradmin/api?path=..., and lib/Baseliner/Controller/WorkerAdmin.pm dispatches endpoint behavior to lib/Baseliner/Model/Worker.pm.

Worker registration and unregistration by token are handled by a separate action register_api that does not require a user session — the worker binary authenticates via passkey (for registration) or token (for unregistration).

The backend covers:

  • Worker listing with query and type filtering
  • Global passkey generation and retrieval
  • Passkey invalidation
  • Worker enable/disable toggle
  • Worker shutdown via pubsub
  • Worker registration (passkey-authenticated, no session required)
  • Worker unregistration by token (no session required)
  • Worker unregistration by admin (session-authenticated)
  • Worker REPL command execution
  • Worker rename, which republishes worker.rename and re-keys the PubSub connection under the new ID

When a worker first registers, the backend auto-creates a matching generic_server CI so the worker is immediately available as a deployment target in the resource catalog.

Endpoints

Admin API (/workeradmin/api)

All endpoints require the action.admin.worker permission.

Path Method Description
list GET List all workers
passkey GET Get or generate global passkey
invalidate GET Invalidate global passkey
toggle POST Enable/disable a worker
shutdown POST Shut down a worker
rename POST Rename a worker (re-keys PubSub connection)
unregister POST Remove a worker registration (by admin)
repl GET Execute a command on a worker

Registration API (/workeradmin/register_api)

These endpoints do not require a user session. Authentication is via passkey or token.

Path Method Description
register POST Register a worker (authenticated via passkey)
unregister_by_token POST Unregister a worker (authenticated via id + token)

Validation

./bin/cla exec perl -c lib/Baseliner/Controller/WorkerAdmin.pm
./bin/cla exec perl -c lib/Baseliner/Model/Worker.pm
./bin/cla prove t/baseliner/controller/worker_admin.t
./bin/cla prove t/baseliner/model/worker.t