refactor: [#300] Phase 3 Port Topology Template Integration (P3.4) #302
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Integrates the
PortBindingdomain types (created in #298) into the Docker Compose template rendering, completing Phase 3 of the topology refactoring.Changes
Port Derivation (
port_derivation.rs)derive_tracker_ports()- UDP always exposed, HTTP/API only when no TLSderive_caddy_ports()- Always exposes 80, 443, 443/udpderive_prometheus_ports()- 9090 on localhost onlyderive_grafana_ports()- 3000 only when no TLSderive_mysql_ports()- No exposed portsPort Definition DTO (
port_definition.rs)PortDefinitionstruct withbindinganddescriptionfieldsFrom<&PortBinding>trait for idiomatic conversionService Context Updates
ports: Vec<PortDefinition>to all service configsTemplate Simplification (
docker-compose.yml.tera)# {{ port.description }}needs_ports_sectionchecks (replaced byports | length > 0)Validation
try_build()method onDockerComposeContextBuildervalidates port uniquenessPortConflictErrorwithhelp()method for actionable error messagesDockerComposeTopology::new()returnsResultDocumentation
Testing
PortDefinitionconversiontry_build()validationRendered Output Example
Checklist
./scripts/pre-commit.shservice.portstry_build()Related
docs/issues/300-phase-3-port-topology-template-integration.md