serviceops

package
v1.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 6 Imported by: 0

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

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

func EnsureServiceRunning(name string) error

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 IsBuiltin

func IsBuiltin(name string) bool

IsBuiltin reports whether name is a built-in lerd service.

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

func ServiceFamily(name string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL