Skip to content

Include public service URL in configuration #1417

Description

@josecelano

Relates to:

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 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:

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).

Metadata

Metadata

Assignees

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions