When launching containerized Chromium, use Tailscale with TS_AUTHKEY#69
Merged
When launching containerized Chromium, use Tailscale with TS_AUTHKEY#69
Conversation
If CDP_URL is not given, then try to launch a containerized Chromium (using chromium-live image). However, if TS_AUTHKEY is supplied, there is no need to launch that containerized Chromium with host networking. Instead, use it to install and setup Tailscale (with that given TS_AUTHKEY). To try, find that auth key for devices in Tailscale admin and then: ```bash TS_AUTHKEY=yourkey uv run middleman.py ``` After a while, the tailnet IP address of the launched container will be shown: ``` ✘ No existing CDP found ⇢ Launching local Chromium container with Tailscale... ✓ Container started: name=chromium-n9vap id=f89421629271 ⇢ Setting up Tailscale in container f89421629271eee ⇢ Executing Tailscale setup: Step 1/4 ⇢ Executing Tailscale setup: Step 2/4 ⇢ Executing Tailscale setup: Step 3/4 ⇢ Executing Tailscale setup: Step 4/4 ✓ All Tailscale setup steps completed successfully ✓ Tailscale IP address: 100.84.70.110 ✓ Set CDP_URL to http://100.84.70.110:9222 ⇢ Checking CDP availability... ⇢ Checking for remote Chrome with CDP at http://100.84.70.110:9222... ✓ CDP is detected. ✓ Local Chromium CDP is ready Listening on port 3000 INFO: Started server process [595678] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit) ``` Use a web browser to see the live view, in this example it will be at 100.84.70.110:3001. This is the remote containerized Chromium dynamically launched by Middleman during its initial bootstrap. While watching the above live view, open Middleman example page as usual at localhost:3000 and click on the NPR example. The live view should show Chromium navigating to the NPR website for the headlines extraction.
bin-ario
approved these changes
Dec 18, 2025
middleman.py
Outdated
| if os.getenv("TS_AUTHKEY"): | ||
| if asyncio.run(launch_tailscaled_chromium()) is False: | ||
| print("Fatal error: Unable to detect or launch Chromium with Tailscale!") | ||
| # sys.exit(-1) |
Contributor
Author
There was a problem hiding this comment.
Good point, I think it's better to remove it. Without a working containerized Chromium, Middleman will not effectivly work (i.e. unable to distill pages) but having it running means someone can drop in and perform some troubleshooting.
| cmd = [ | ||
| "run", | ||
| "-d", | ||
| "--rm", |
Contributor
There was a problem hiding this comment.
so we want to rm the container right away?
Contributor
Author
There was a problem hiding this comment.
Middleman does not have any code that stop or kill the container anyway.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If CDP_URL is not given, then try to launch a containerized Chromium (using chromium-live image).
However, if TS_AUTHKEY is supplied, there is no need to launch that containerized Chromium with host networking. Instead, use it to install and setup Tailscale (with that given TS_AUTHKEY).
To try, find that auth key for devices in Tailscale admin and then:
After a while, the tailnet IP address of the launched container will be shown:
Use a web browser to see the live view, in this example it will be at 100.84.70.110:3001. This is the remote containerized Chromium dynamically launched by Middleman during its initial bootstrap.
While watching the above live view, open Middleman example page as usual at localhost:3000 and click on the NPR example. The live view should show Chromium navigating to the NPR website for the headlines extraction.