browser icon indicating copy to clipboard operation
browser copied to clipboard

Other container web service auto detection not working

Open bbugh opened this issue 9 months ago • 1 comments

The auto detection of another container's web ports does not seem to be working, at least as described in the README. Here is a minimal reproduction:

version: '2'

volumes:
  settings:

services:
  browser:
    restart: always
    image: bh.cr/balenalabs/browser-aarch64
    privileged: true
    volumes:
      - 'settings:/data'
    ports:
      - '5011' # management API (optional)
  web:
    restart: always
    image: nginx:1.25.2
    ports:
      - '80'
  1. When starting, it will output:

    [Logs]    [2023-10-03T00:26:12.869Z] [browser] LAUNCH_URL environment variable not set.
    [Logs]    [2023-10-03T00:26:12.871Z] [browser] Looking for local HTTP/S services.
    [Logs]    [2023-10-03T00:26:12.876Z] [browser] No service found on port 80
    [Logs]    [2023-10-03T00:26:12.881Z] [browser] No service found on port 443
    [Logs]    [2023-10-03T00:26:12.886Z] [browser] No service found on port 8080
    [Logs]    [2023-10-03T00:26:12.887Z] [browser] Displaying default HTML page
    
  2. If you force it to load web via the API, it will work fine:

    ADDRESS=`sudo balena scan --json | jq -r '.[0].address'`
    curl --data "url=web" http://$ADDRESS:5011/url
    

    This will show the "welcome to nginx" page on the device

  3. If you tell it to re-scan via the API, it still won't find the local container.

    curl -X POST http://$ADDRESS:5011/scan
    

    💩

    [Logs]    [2023-10-03T00:34:14.361Z] [browser] LAUNCH_URL environment variable not set.
    [Logs]    [2023-10-03T00:34:14.363Z] [browser] Looking for local HTTP/S services.
    [Logs]    [2023-10-03T00:34:14.369Z] [browser] No service found on port 80
    [Logs]    [2023-10-03T00:34:14.374Z] [browser] No service found on port 443
    [Logs]    [2023-10-03T00:34:14.378Z] [browser] No service found on port 8080
    [Logs]    [2023-10-03T00:34:14.383Z] [browser] Displaying default HTML page
    
  4. but if you manually specify LAUNCH_URL to the other container...

    services:
      browser:
        environment:
          LAUNCH_URL: http://web
    

    ... it works:

    image

bbugh avatar Oct 03 '23 00:10 bbugh