Skip to content

feat: REMOTE_CONNECT_HOST and STF_PROVIDER_CONNECT_PORT for the remote debug of STF - #230

Open
azarouski wants to merge 2 commits into
developfrom
feat/remote-connect-host
Open

azarouski wants to merge 2 commits into
developfrom
feat/remote-connect-host

Conversation

@azarouski

@azarouski azarouski commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What

Two settings for the remote debug (adb connect <host>:<port>) of STF.

REMOTE_CONNECT_HOST

  • The host of the --connect-url-pattern of STF, used for both stf provider (Android) and stf ios-device (iOS).
  • Default empty = STF_PROVIDER_HOST, so nothing changes. The pattern is computed once: "${REMOTE_CONNECT_HOST:-$STF_PROVIDER_HOST}:<%= publicPort %>".
  • It is not named STF_PROVIDER_*: stf provider reads those as its options, and the entrypoint unsets the empty ones.
  • Validated: a host name or address without a scheme, port, / or whitespace. An invalid value is logged as ERROR and the entrypoint exits with 0.
  • --host, STF_PROVIDER_HOST and the screen WebSocket URL pattern still use STF_PROVIDER_HOST.

STF_PROVIDER_CONNECT_PORT (Android)

  • The fixed remote debug port of the device: the new --connect-port option of stf provider in the STF fork. It replaces the second port of the STF_PROVIDER_MIN_PORT..STF_PROVIDER_MAX_PORT pool. mcloud-agent sets it from the connect_port setting of the device and publishes the port.
  • stf provider reads it from its environment (.env('STF_PROVIDER')). The entrypoint only removes the empty STF_PROVIDER_* variables, so a set value reaches the provider and no extra argument is needed. Empty = the second port of the range, as before.
  • Validated for Android: a port 1024-65535 when set. An invalid value is logged as ERROR and the entrypoint exits with 0.
  • Needs an STF image whose stf provider has the --connect-port option. The provider is strict, so an older one stops on the unknown option.
  • iOS ignores it: stf ios-device has no env prefix, and its --connect-port is MJPEG_PORT (unchanged).

Both are in the Dockerfile ENV ("", STF provider group) and in the README Configuration table.

Why

Device hosts (mcloud-agent) can sit in a private LAN behind one public MCloud server. Everything already goes through the MCloud server except the remote debug: STF shows adb connect <LAN address of the agent>:<port>, which users outside the LAN can't reach.

  • The optional TCP relay of mcloud (ADB_RELAY_HOSTS, nginx stream) forwards the device ports of the agents from the public address of MCloud. With it, REMOTE_CONNECT_HOST is the public name of MCloud.
  • A fixed STF_PROVIDER_CONNECT_PORT per device makes the port predictable, so it can be published and relayed.

Tests

  • tests/entrypoint_test.sh:
    • REMOTE_CONNECT_HOST:
      • when it is empty or unset, the connect URL uses STF_PROVIDER_HOST;
      • a set value is used for Android and iOS;
      • the screen WebSocket URL pattern, --host (iOS) and STF_PROVIDER_HOST (Android) are unchanged;
      • invalid values are reported and exit with 0.
    • STF_PROVIDER_CONNECT_PORT:
      • empty: removed from the provider environment;
      • set: passed in the provider environment and not passed twice as an argument;
      • invalid values (abc, 80, 1023, 65536, 99999, 07400, 0x1F90, trailing space, negative) are reported, exit with 0 and start nothing;
      • 1024, 7400 and 65535 are valid;
      • iOS ignores it: no validation, and --connect-port stays MJPEG_PORT.
  • make test: all entrypoint tests pass. The only failure is in tests/repo_test.sh and also happens on develop: "the base image and the build stage are :@sha256:". FROM public.ecr.aws/zebrunner/stf:3.1 has no digest.
  • make lint: passes except one check with the same cause: "README lists the Dockerfile version of FROM ...stf...@" (the pattern needs the digest).
  • make docker: the image tests did not run. The build fails first with public.ecr.aws/zebrunner/stf:3.1: not found: the base image is not published yet.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…droid device

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azarouski azarouski changed the title feat: REMOTE_CONNECT_HOST for the adb connect url of STF feat: REMOTE_CONNECT_HOST and STF_PROVIDER_CONNECT_PORT for the remote debug of STF Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant