Chocobozzz/PeerTube

Configurable public URL for remote-runner job payloads

jDmacD opened this issue · 1 comments

Describe the problem to be solved

Our peertube instance is configured with remote-runners connecting via a local address peertube.lan

peertube-runner \
  register \
  --url http://peertube.lan \
  --registration-token ptrrt-xxxx \
  --runner-name local-runner

When a job is submitted he payload for the runner contains the public URL peertube.io

{
  "input": {
    "videoFileUrl": "https://peertube.io/api/v1/runners/jobs/6da7ce67-870f-43d8-9bdf-74990ee48efe/files/videos/b2e4826d-8a11-43a5-be51-19239578e200/max-quality",
    "separatedAudioFileUrl": []
  },
  "output": {
    "fps": 25,
    "resolution": 576,
    "separatedAudio": false
  }
}

The runner pulls the job from the public URL

[10:10:55.829] INFO (1): Connected to http://peertube.lan/runners socket                                                    
[10:10:55.831] INFO (1): Checking available jobs on http://peertube.lan
[10:24:29.854] INFO (1): [http://peertube.lan] Processing job of type vod-web-video-transcoding: 648ae271-545c-4e34-a34d-15
[10:24:29.857] INFO (1): Downloading input file https://peertube.io/api/v1/runners/jobs/648ae271-545c-4e34-a34d-15c6d2df6ae7/files/videos/b2e4

Our instance is behind Cloudflare, which provides load balancing, TLS termination and a CDN. The preferable situation would be for the runners to pull jobs and files from peertube.lan, as opposed to the longer, more expensive, trip via Cloudflare to peertube.io.

Describe the solution you would like

A configuration option that would allow the setting of a base FQDN and scheme for the videoFileUrl that is supplied to the remote-runners. For instance:

PEERTUBE_REMOTE_RUNNER_JOB_BASE_URL: "http://peertube.lan"

The same result could be achieved purely on the peertube-runner side. Either have the --url flag dictate which address it pulls assets from, or introduce another flag.