Overview
Integrate the PortBinding domain types (created in #298) into the Docker Compose template rendering. This completes Phase 3 of the topology refactoring by moving port exposure logic from Tera template conditionals to the domain layer.
Parent Epic
Specification
See detailed specification: docs/issues/300-phase-3-port-topology-template-integration.md
Problem Statement
The current template has complex conditional logic for port exposure:
{%- if tracker.needs_ports_section %}
ports:
{%- for udp_tracker in tracker.udp_trackers %}
- "{{ udp_tracker.port }}:{{ udp_tracker.port }}/udp"
{%- endfor %}
{%- for http_tracker_port in tracker.http_tracker_ports_without_tls %}
- "{{ http_tracker_port }}:{{ http_tracker_port }}"
{%- endfor %}
{%- if not tracker.http_api_has_tls %}
- "{{ tracker.http_api_port }}:{{ tracker.http_api_port }}"
{%- endif %}
{%- endif %}
This should become simple loops using the PortBinding types from domain:
{%- if service.ports | length > 0 %}
ports:
{%- for port in service.ports %}
# {{ port.description }}
- "{{ port.binding }}"
{%- endfor %}
{%- endif %}
Implementation Plan
P3.4.1: Create Port Derivation Functions
P3.4.2: Create Template Context Types
P3.4.3: Update Context Builder
P3.4.4: Simplify Template
P3.4.5: Validation Integration
Acceptance Criteria
Related
Overview
Integrate the
PortBindingdomain types (created in #298) into the Docker Compose template rendering. This completes Phase 3 of the topology refactoring by moving port exposure logic from Tera template conditionals to the domain layer.Parent Epic
Specification
See detailed specification: docs/issues/300-phase-3-port-topology-template-integration.md
Problem Statement
The current template has complex conditional logic for port exposure:
This should become simple loops using the
PortBindingtypes from domain:Implementation Plan
P3.4.1: Create Port Derivation Functions
P3.4.2: Create Template Context Types
PortDefinitionstruct for template renderingPortBindingP3.4.3: Update Context Builder
DockerComposeTopologywith derived portsvalidate_port_uniqueness()before renderingP3.4.4: Simplify Template
P3.4.5: Validation Integration
Acceptance Criteria
./scripts/pre-commit.shRelated