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
| Name | Type | Description |
|---|---|---|
| $name | string | the service name, as compose would key it (`^[a-z][a-z0-9-]{0,62}$`) |
| $image | string | the container image, e.g. `dunglas/mercure` |
| $ports | list<PortMapping> | the ports the service listens on, with the host port when it is published |
| $env | list<EnvVar> | the environment the service reads |
| $volumes | list<string> | compose-style `source:target[:mode]` entries, or named volumes |
| $command | list<string> | an explicit command, empty for the image's default |
| $summary | string | why 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(): ?intThe host port a reachability probe should try, or null when the service publishes none.