decnet.engine.services_live exposes add_service / remove_service for
both fleet and topology decky scopes. The host's _compose() wrapper
already supported per-service targeting (up --no-deps -d <svc>,
stop, rm -f); what was missing was the orchestration around it:
* add: validate against decnet.services.registry (rejects unknown +
fleet_singleton); persist the new services list; re-render the
per-scope compose file (so future redeploys reflect the change);
run docker compose up -d --no-deps --build <decky>-<svc>.
* remove: stop + rm -f the service container; persist; re-render
compose so a future up -d doesn't bring it back.
Both publish decky.<name>.service.added / .removed on the bus, with
the post-mutation services list. Topic constants added to
decnet.bus.topics; the matching wiki entry in wiki-checkout/Service-Bus.md
ships in a separate commit on the wiki repo (wiki-checkout/ is gitignored).
Four new admin endpoints:
* POST/DELETE /api/v1/deckies/{name}/services{,/svc}
* POST/DELETE /api/v1/topologies/{id}/deckies/{name}/services{,/svc}
ServiceMutationError messages are mapped at the API boundary to 404
(decky/topology missing), 409 (idempotency violation), 422 (unknown
or fleet_singleton service).
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
"""Cross-cutting decky operation endpoints.
|
|
|
|
These routes apply to both fleet and MazeNET (topology) deckies; the
|
|
MazeNET case is selected by passing ``topology_id`` in the request body.
|
|
|
|
Compare with:
|
|
|
|
* :mod:`decnet.web.router.fleet` — fleet-only CRUD (deploy, mutate,
|
|
list).
|
|
* :mod:`decnet.web.router.topology` — topology-only CRUD.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter
|
|
|
|
from .api_file_drop import router as file_drop_router
|
|
from .api_services import (
|
|
fleet_services_router,
|
|
topology_services_router,
|
|
)
|
|
|
|
deckies_router = APIRouter()
|
|
deckies_router.include_router(file_drop_router)
|
|
deckies_router.include_router(fleet_services_router)
|
|
# Topology service routes live under /topologies/{id}/... — the prefix
|
|
# is set on the router itself. Mounted under the same `deckies_router`
|
|
# umbrella because the *operation* (add/remove a service on a deployed
|
|
# decky) is identical; only the addressing scheme differs.
|
|
deckies_router.include_router(topology_services_router)
|
|
|
|
__all__ = ["deckies_router"]
|