feat: [#272] Add HTTPS support with Caddy for all HTTP services #273
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
Add HTTPS support with Caddy reverse proxy for automatic TLS termination on all HTTP services (Tracker API, HTTP Trackers, Grafana).
Closes #272
What's Implemented
Phase 1: Template Creation ✅
templates/caddy/Caddyfile.terawith conditional service blocksdocs/contributing/templates/caddy.mddocumenting template variablestemplates/docker-compose/docker-compose.yml.terawith Caddy service blockCaddyProjectGeneratorwith 14 unit testsPhase 2: Configuration DTOs ✅
HttpsSectionDTO withadmin_emailanduse_stagingfieldsTlsSectionDTO withdomainfield for service-specific TLSHttpApiSection,HttpTrackerSection,GrafanaSectionwith optionaltlshas_any_tls_configured, https/tls consistency)Emailtype insrc/shared/email.rsfor email format validationDomainNametype insrc/shared/domain_name.rsfor domain validationPhase 3: Template Rendering Integration ✅
RenderCaddyTemplatesStepfor template renderingDeployCaddyConfigStepfor Ansible deploymentdeploy-caddy-config.ymlAnsible playbookRenderCaddyTemplatesandDeployCaddyConfigToRemotetoReleaseStepenumCaddyContextinto Docker Compose template renderingCaddyConfigDeploymenterror variant with actionable help textPhase 6: E2E Testing (Partial) ✅
Manual E2E testing verified:
.localdomainsWhat's Remaining (Work in Progress)
docs/user-guide/https-setup.md)Configuration Example
{ "https": { "admin_email": "admin@example.com", "use_staging": true }, "tracker": { "http_api": { "bind_address": "0.0.0.0:1212", "admin_token": "secret", "tls": { "domain": "api.tracker.local" } }, "http_trackers": [ { "bind_address": "0.0.0.0:7070", "tls": { "domain": "http1.tracker.local" } } ] }, "grafana": { "admin_user": "admin", "admin_password": "admin", "tls": { "domain": "grafana.tracker.local" } } }Testing
Notes for Reviewers
This is a draft PR - the implementation is functional but there are still remaining phases to complete. Early feedback on the architecture and approach is welcome.
Key files to review:
templates/caddy/Caddyfile.tera- Caddy templatesrc/application/command_handlers/create/config/https.rs- HTTPS configuration DTOssrc/application/command_handlers/release/handler.rs- Release workflow integrationsrc/infrastructure/templating/caddy/- Caddy template rendering