Documentation
¶
Overview ¶
Package serviceops contains the shared business logic for installing, starting, stopping, and removing lerd services. The CLI commands and the MCP tools both call into here so they enforce identical preset gating, dependency cascades, and dynamic_env regeneration.
Index ¶
- func EnsureCustomServiceQuadlet(svc *config.CustomService) error
- func EnsureServiceRunning(name string) error
- func InstallPresetByName(name, version string) (*config.CustomService, error)
- func IsBuiltin(name string) bool
- func MissingPresetDependencies(svc *config.CustomService) []string
- func RegenerateFamilyConsumers(family string)
- func RegenerateFamilyConsumersForService(name string)
- func ServiceFamily(name string) string
- func StartDependencies(svc *config.CustomService) error
- func StopWithDependents(name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureCustomServiceQuadlet ¶
func EnsureCustomServiceQuadlet(svc *config.CustomService) error
EnsureCustomServiceQuadlet writes the quadlet for a custom service and reloads systemd. Materialises any declared file mounts and resolves dynamic_env directives so the rendered quadlet has the computed values.
func EnsureServiceRunning ¶
EnsureServiceRunning starts the service if it is not already active and waits until it is ready. Recurses through depends_on for custom services.
func InstallPresetByName ¶
func InstallPresetByName(name, version string) (*config.CustomService, error)
InstallPresetByName materialises a bundled preset as a custom service. version selects a tag for multi-version presets; empty falls back to the preset's DefaultVersion.
func MissingPresetDependencies ¶
func MissingPresetDependencies(svc *config.CustomService) []string
MissingPresetDependencies returns the names of services that svc declares in depends_on but which are neither built-in nor already installed as custom services.
func RegenerateFamilyConsumers ¶
func RegenerateFamilyConsumers(family string)
RegenerateFamilyConsumers re-renders the quadlet of any installed custom service whose dynamic_env references the named family. Active consumers are stopped, removed, and started so the new generated unit is the one systemd loads.
func RegenerateFamilyConsumersForService ¶
func RegenerateFamilyConsumersForService(name string)
RegenerateFamilyConsumersForService is a convenience that wraps RegenerateFamilyConsumers in a no-op when name has no recognised family.
func ServiceFamily ¶
ServiceFamily returns the family of a service by name. Honours the explicit Family field on a custom service first, falls back to config.InferFamily for built-ins and pattern-matched alternates.
func StartDependencies ¶
func StartDependencies(svc *config.CustomService) error
StartDependencies ensures every entry in svc.DependsOn is up and ready before the parent is started.
func StopWithDependents ¶
func StopWithDependents(name string)
StopWithDependents stops every custom service that depends on name (depth-first), then stops name itself.
Types ¶
This section is empty.