feat: [#236] make Docker Compose tracker ports dynamic#237
Merged
josecelano merged 4 commits intomainfrom Dec 15, 2025
Merged
Conversation
- Add udp_tracker_ports, http_tracker_ports, http_api_port fields to DockerComposeContext - Update new_sqlite() and new_mysql() constructors to accept port parameters - Add getter methods for port fields - Implement extract_tracker_ports() helper in RenderDockerComposeTemplatesStep - Update all unit tests to provide port values - Phase 1 complete: Context extended, port extraction implemented
- Replace hardcoded UDP ports (6868, 6969) with loop over udp_tracker_ports - Replace hardcoded HTTP port (7070) with loop over http_tracker_ports - Replace hardcoded API port (1212) with http_api_port variable - Add descriptive comments explaining dynamic configuration - Phase 4 complete: Template now renders ports from context
- Add assertions to check default ports (6969 UDP, 7070 HTTP, 1212 API) are rendered - Verify hardcoded port 6868 is NOT present in output - Ensures template correctly uses Tera variables instead of hardcoded values - Phase 5 complete: Testing and verification added
…s struct - Create TrackerPorts struct to group port parameters (udp_tracker_ports, http_tracker_ports, http_api_port) - Reduces DockerComposeContext::new_mysql() from 8 to 6 parameters (below clippy limit of 7) - Update all constructors and call sites to use TrackerPorts - Export TrackerPorts from docker_compose module for public API - Add TrackerPorts imports in test modules only where needed
Member
Author
|
ACK 95d5e13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR implements dynamic tracker ports in Docker Compose templates, replacing hardcoded port values with Tera template variables extracted from the tracker configuration.
Closes #236
Changes
Core Implementation
DockerComposeContextwith tracker port fields (udp_tracker_ports, http_tracker_ports, http_api_port)TrackerPortsstruct to group port parameters and resolve clippytoo_many_argumentswarningextract_tracker_ports()helper to extract ports fromTrackerConfigdomain modeldocker-compose.yml.teratemplate with Tera loops for dynamic port renderingFiles Modified
src/infrastructure/templating/docker_compose/template/wrappers/docker_compose/context.rs- Added TrackerPorts struct and port fieldssrc/application/steps/rendering/docker_compose_templates.rs- Implemented port extraction logictemplates/docker-compose/docker-compose.yml.tera- Replaced hardcoded ports with dynamic Tera variablesTesting
Automated Tests ✅
Manual E2E Test ✅
Successfully completed full deployment workflow with custom port configuration.
Test Configuration:
Test Results:
curl http://10.140.190.152:3030/api/health_check→{"status":"Ok"}curl http://10.140.190.152:9090/announce→ Respondingcurl http://10.140.190.152:9091/announce→ RespondingKey Achievements:
Implementation Details
Before (Hardcoded):
After (Dynamic):
Architecture
The implementation follows the existing pattern established by
AnsibleVariablesContext:RenderDockerComposeTemplatesStepTrackerConfig) as source of truthCommits
Checklist