Skip to content

Rewrite chromium wrapper.sh as a Go binary#234

Draft
sjmiller609 wants to merge 1 commit intomainfrom
hypeship/go-wrapper
Draft

Rewrite chromium wrapper.sh as a Go binary#234
sjmiller609 wants to merge 1 commit intomainfrom
hypeship/go-wrapper

Conversation

@sjmiller609
Copy link
Copy Markdown
Contributor

Summary

Replaces the bash wrapper.sh shipped in chromium-headful and chromium-headless with a single Go binary (server/cmd/wrapper) that detects the profile at boot from supervisor's conf.d (xorg.conf → headful, xvfb.conf → headless).

The Go wrapper preserves behaviour parity with the bash scripts but removes serial dead time on the boot path:

  • Phase A starts xorg/xvfb, dbus, and chromedriver in a single supervisorctl invocation; readiness is then probed concurrently.
  • Envoy bootstrap (cert generation, NSS DB, template render) runs in a goroutine alongside Phase A. Phase B gates on its completion because chromium reads the system CA trust store at process start and needs the envoy self-signed cert in place.
  • Phase B starts chromium, kernel-images-api, and (headful) mutter + optional neko in one call so their bring-up overlaps chromium boot rather than trailing CDP.
  • Final readiness waits on the union of CDP, chromedriver, forward-proxy, and (when enabled) neko + envoy probes in parallel.

Per-service tweaks:

  • supervisor confs: startsecs=20 so supervisorctl start returns as soon as the program is launched (the Go wrapper probes readiness directly).
  • init-envoy.sh: drop the trailing 50-iteration port poll and curl-through-proxy test; the Go wrapper's waitAllReady covers both.
  • Kraftfile cmd updated from /wrapper.sh to /wrapper.

Cosmetic + non-critical work (pulseaudio, --no-sandbox infobar dismissal) runs off the hot path.

Test plan

  • go build ./cmd/wrapper and go vet ./cmd/wrapper pass
  • Build chromium-headless image and confirm container reaches CDP-ready
  • Build chromium-headful image and confirm container reaches CDP-ready (with and without ENABLE_WEBRTC=true)
  • Confirm envoy comes up and the forward-proxy listener is reachable when INST_NAME/METRO_NAME/XDS_SERVER/KERNEL_INSTANCE_JWT are set
  • Confirm RUN_AS_ROOT=true headful flow still dismisses the --no-sandbox infobar
  • Confirm SIGTERM/SIGINT propagates to supervisord and child services exit cleanly

Replaces the bash wrapper.sh shipped in both browser images with a single
Go binary (server/cmd/wrapper) that detects the headful vs headless
profile from supervisor's conf.d at boot.

The Go wrapper preserves behaviour parity with the bash scripts but
removes serial dead time on the boot path:

  - Phase A starts xorg/xvfb, dbus, and chromedriver in a single
    supervisorctl invocation; readiness is then probed concurrently.
  - Envoy bootstrap (cert generation, NSS DB, template render) runs
    in a goroutine alongside Phase A. Phase B gates on it because
    chromium reads the system CA trust store at process start.
  - Phase B starts chromium, kernel-images-api, and (headful) mutter
    + optional neko in one call so their bring-up overlaps chromium boot.
  - Final readiness waits on the union of CDP, chromedriver,
    forward-proxy, and (when enabled) neko + envoy in parallel.

Per-service tweaks:

  - supervisor confs: startsecs=2 → 0 so supervisorctl start returns
    as soon as the program is launched (Go probes readiness directly).
  - init-envoy.sh: drop the trailing 50-iteration port poll and
    curl-through-proxy test; the Go wrapper's waitAllReady covers it.
  - Kraftfile cmd updated from /wrapper.sh to /wrapper.

Cosmetic + non-critical work (pulseaudio, --no-sandbox infobar
dismissal) runs off the hot path.
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