How to use terminal-code with Herdr for remote development while keeping the client local?
Hi! I'm trying to figure out the recommended way to use terminal-code together with Herdr for remote development.
My desired setup is:
Local machine
├── Herdr client / TUI
└── terminal-code client / frontend
│ SSH
▼
Remote machine
├── Herdr server / terminals
├── project files
└── terminal-code / code-server backend
In other words, I want all project-related servers/processes to run on the remote machine, while the interactive clients/rendering stay on my local machine.
Both tools seem to support this independently:
- With terminal-code, I can run
tode --ssh <host>locally, so the backend runs remotely while the frontend stays local. - With Herdr, I can use
herdr --remote <host>and keep the Herdr client local while the actual terminals/processes live on the remote machine.
The part I'm unsure about is how to combine them.
Once I'm inside a terminal created by the remote Herdr session, that shell is already running on the remote machine. If I run:
tode
from that terminal, tode itself is launched remotely, which means the terminal-code client/frontend also ends up running on the remote side instead of locally.
I also noticed that this repository already includes a Herdr plugin, but from what I understand, open-split invokes tode --split right from the current Herdr pane, so I assume the same issue would apply when Herdr itself is attached to a remote machine.
Is there currently a supported/recommended way to achieve the topology above?
Ideally, I'd like to be able to trigger tode from a remote Herdr pane, but have it:
- start or connect to the terminal-code backend on that remote machine, and
- open the terminal-code frontend on my local machine.
For example, is there some mechanism for the remote tode command / Herdr plugin to communicate back to a local terminal-code client, similar to how tode --ssh works when initiated locally?
If this isn't currently supported, would this be something that could potentially be supported by the Herdr plugin?
Thanks!
I dug into this because I hit the same topology from the other direction. Short version: as things stand,
tode cannot put its frontend on your local machine while running inside a herdr pane on the remote one.
What the code says (v0.4.3):
- The tode "frontend" is the pixel/Electron window process. It is spawned on the machine where
toderuns (src/launch.ts→spawnDaemon()/windowCommand()), so atodestarted in a remote herdr pane necessarily opens its window on the remote host. herdr's remote mode forwards terminal content over SSH — the remote server owns the panes (herdrdev/herdr#2448has the maintainer's explanation of that ownership) — so there is no channel through which a remote pane could ask your local herdr client to spawn a local process. tode --ssh <host>does keep the frontend local, but in the opposite direction:sshOpen()builds a remote bundle, runs it over SSH, and then opens a localPaneconnected to it. It has to be invoked from the machine that has the display, so it cannot be triggered from inside a remote pane.
Two ways people square this today:
- Run herdr locally (client + server local) and use
tode --ssh <host>in a local pane: UI local, code-server + files on the remote box. You lose herdr's remote panes for the tode window itself. - Run everything remote (what you have), and accept that the window is remote too.
Also relevant if you pick option 2: on Linux, tode currently needs a display on the pane's host —
it has no headless fallback and aborts with Missing X server or $DISPLAY when the pane env has no
DISPLAY/WAYLAND_DISPLAY (filed as zenbu-labs/terminal-code#52). So a remote herdr server on a
headless machine can't run tode at all yet, independent of where the client is.
@darongliu I believe I have a solution that would allow for this. I will update this thread if/when I release this solution into terminal-code