Problem statement
When a compose-managed workload has no explicit dnsweaver.hostname, dnsweaver currently derives the hostname from the instance/container name plus the domain suffix. For scaled services this produces per-replica names: deploy.replicas: 3 yields proxy-1, proxy-2, proxy-3, so with a lan suffix you get proxy-1.lan, proxy-2.lan, proxy-3.lan.
Requested by @jochumdev in #132 (review of PR #133). Both incus-compose and Docker Compose expose a stable service label:
Proposed solution
Add an opt-in mode that derives the hostname from the compose service label when no explicit hostname is set, so all replicas of a service share one round-robin name:
proxy-1, proxy-2, proxy-3 -> proxy.lan (3 A records, round-robin)
This is a behavior change with a deliberate semantic difference from the current per-replica naming, so it must be opt-in with clear precedence, not a silent default.
Design questions to settle
- Opt-in switch: a per-source or global toggle (e.g.
DNSWEAVER_..._SERVICE_HOSTNAME=true)? Default off.
- Precedence: explicit
dnsweaver.hostname > service-label-derived > instance-name-derived. Confirm ordering.
- Round-robin semantics: multiple instances sharing a name emit multiple A records to the same hostname. Confirm the reconciler/providers handle N records per name cleanly (ownership, updates, orphan cleanup).
- Cross-platform: implement once, keyed off both
incus-compose.service and com.docker.compose.service, so Docker Compose users benefit too.
- Domain suffix: service-derived names still get the domain suffix appended the same way.
Scope
Problem statement
When a compose-managed workload has no explicit
dnsweaver.hostname, dnsweaver currently derives the hostname from the instance/container name plus the domain suffix. For scaled services this produces per-replica names:deploy.replicas: 3yieldsproxy-1,proxy-2,proxy-3, so with alansuffix you getproxy-1.lan,proxy-2.lan,proxy-3.lan.Requested by @jochumdev in #132 (review of PR #133). Both incus-compose and Docker Compose expose a stable service label:
incus-compose.service(surfaced de-prefixed fromuser.label.incus-compose.serviceafter [Feature]: add support for incus-compose #131)com.docker.compose.serviceProposed solution
Add an opt-in mode that derives the hostname from the compose service label when no explicit hostname is set, so all replicas of a service share one round-robin name:
This is a behavior change with a deliberate semantic difference from the current per-replica naming, so it must be opt-in with clear precedence, not a silent default.
Design questions to settle
DNSWEAVER_..._SERVICE_HOSTNAME=true)? Default off.dnsweaver.hostname> service-label-derived > instance-name-derived. Confirm ordering.incus-compose.serviceandcom.docker.compose.service, so Docker Compose users benefit too.Scope