Skip to content
docsv0.17.0

ServiceDeclaration

One backing service a plugin needs, as data: the image to run, the ports it listens on, the environment it reads, the volumes it keeps. Deliberately the subset a compose file and a reachability probe need — nothing about how to orchestrate it. Future fields (healthcheck commands, networks, depends_on) enter when something needs them, not before.

ServiceDeclaration::__construct()

public function __construct(string $name, string $image, array $ports = [], array $env = [], array $volumes = [], array $command = [], string $summary = '', ?int $healthPort = null, ?Milpa\Runtime\Stack\ServiceSignature $signature = null):

Parameters

Parameters of __construct()
NameTypeDescription
$namestringthe service name, as compose would key it (`^[a-z][a-z0-9-]{0,62}$`)
$imagestringthe container image, e.g. `dunglas/mercure`
$portslist<PortMapping>the ports the service listens on, with the host port when it is published
$envlist<EnvVar>the environment the service reads
$volumeslist<string>compose-style `source:target[:mode]` entries, or named volumes
$commandlist<string>an explicit command, empty for the image's default
$summarystringwhy the plugin needs it — one line for a human
$healthPort(int | null)the host port a reachability probe should try; defaults to the first published port
$signature(ServiceSignature | null)what the service answers on that port that a squatter would not; without one, a port that accepts reads as the service (greenhouse decisions/0504)

ServiceDeclaration::probePort()

public function probePort(): ?int

The host port a reachability probe should try, or null when the service publishes none.