Repository navigation
Description
Relates to:
- Include service type in health check enpoint #1409
- Overhaul stats: Start collecting stats per server instance (per socket) #1403
In the tracker configuration you can only specify the bind address for all services. It usually uses the wildcard IP:
[metadata]
app = "torrust-tracker"
purpose = "configuration"
schema_version = "2.0.0"
[logging]
threshold = "info"
[core]
listed = false
private = false
[[udp_trackers]]
bind_address = "0.0.0.0:6969"
[[http_trackers]]
bind_address = "0.0.0.0:7070"
[http_api]
bind_address = "0.0.0.0:1212"Therefore the application does not know the public URLs for the services it's running.
Even if you bind one service to a concrete interface like for example:
[[http_trackers]]
bind_address = "203.0.113.0:7070"
The tracker could run behind a reverse proxy.
It would be good for some use cases if the application has that information. For example:
- In logs.
- In the API endpoints to make APIs more self-discoverable. For example in the health check API endpoint. See Include service type in health check enpoint #1409.
- Notifications.
- In metrics.
In metrics I'm working of exporting metrics with labels in the Prometheus format (see issue #1403):
announce_requests_received_total{ ip_version="ipv4", protocol="http", url="http://0.0.0.0:7070"} 1
scrape_requests_received_total{ ip_version="ipv4", protocol="http", url="http://0.0.0.0:7070"} 1
The label url is the listen URL. I'm planning to add a new instance label to identify the running app when you run more than one tracker. However, in more complex scenarios you could run one single tracker behind many different URls. For example:
- https://tracker1.torrust-demo.com/announce (HTTP tracker 01)
- https://tracker1.torrust-demo.com/announce (HTTP tracker 02)
- ...
All pointing to the same server (IP) running only one torrust tracker process. The "instance" would be the same.
There would be no way to calculate aggregate data per domain unless we include it as a label:
announce_requests_received_total{ ip_version="ipv4", protocol="http", url="http://0.0.0.0:7070" public_url="https://tracker1.torrust-demo.com/"} 1
scrape_requests_received_total{ ip_version="ipv4", protocol="http", url="http://0.0.0.0:7070" public_url="https://tracker2.torrust-demo.com/"} 1
My proposal is to add the public service URL to the config:
[metadata]
app = "torrust-tracker"
purpose = "configuration"
schema_version = "2.0.0"
[logging]
threshold = "info"
[core]
listed = false
private = false
[[udp_trackers]]
public_url = "udp://udp.torrust-demo.com"
bind_address = "0.0.0.0:6969"
[[http_trackers]]
public_url = "https://tracker.torrust-demo.com/announce"
bind_address = "0.0.0.0:7070"
[http_api]
public_url = "https://tracker.torrust-demo.com/api"
bind_address = "0.0.0.0:1212"This is not a priority. I think the most important use case is metrics and it's not a common setup (I guess).
Activity
fix(1640): remove duplicate issue torrust#1417 in related-artifacts
docs(1640): add issue spec for per-instance Network config
Merge #1937: docs(1640): add issue spec for per-instance Network config
josecelano commentedon Jul 15, 2026
Spec update (2026-07-15)
This issue has been incorporated into EPIC #1978 — Configuration Overhaul (schema v3.0.0) as subissue #4 of 9.
Spec:
docs/issues/open/1417-1978-add-public-service-url-to-configuration.mdKey design decisions
Field placement:
public_urlis a flat field on each config struct (HttpTracker,UdpTracker,HttpApi,HealthCheckApi) — NOT inside theNetworkblock being established by #1640. Rationale:Networkgroups network topology (how the tracker connects);public_urlis about public exposure (how users reach the service). They are independently configurable.Protocol validation: The URL protocol is validated at deserialization time:
http://orhttps://udp://http://orhttps://Scope: Config only — the field is stored and available for consumers (metrics, logs, health check). Runtime use in those systems is separate follow-up work.
EPIC position: Depends on #1640 (subissue #3) for the
Networkblock placement decision. Implemented after #1640 is complete.Merge #1982: docs(configuration): add Configuration Overhaul EPIC spe…
docs(issues): address second round of Copilot review suggestions
docs(issues): start #1417; mark #1640 done in EPIC
feat(configuration): add typed public_url to v3 tracker config structs
docs(issues): align implementation plan table in #1417 spec
Merge torrust#2016: feat(configuration): add typed public_url fields …
Merge #2021: chore(issues): archive closed specs and enforce dual-for…
docs(configuration): convert epic to folder type and add migration guide