Set up local editing + remote build workflow using Mutagen file sync with Coder workspaces. Includes the `rexec` helper script for running commands on remote machines. Use when the user mentions rexec, mutagen, remote builds, Coder workspaces, or syncing files to a remote GPU server.
Set up a local editing + remote build/execution workflow using Mutagen file sync. This enables:
┌─────────────────────┐ Mutagen Sync ┌─────────────────────┐
│ Local MacBook │ ◄───────────────────────────►│ Coder Workspace │
│ │ (one-way-replica) │ │
│ ~/work/modular │ │ ~/work/modular │
│ - neovim (local) │ │ - ./bazelw build │
│ - AI agent (local) │ │ - GPU execution │
│ - git (local) │ │ - nvitop monitoring │
└─────────────────────┘ └─────────────────────┘
# In ~/work/modular
mutagen project start # Start sync from mutagen.yml
r ./bazelw build //path:target # Run command remotely (flushes first)
rexec hostname # Run command remotely (no flush)
setup-b200-shared-sync # Ensure remote->local shared sync exists
rlog --label smoke -- /bin/echo "hello" # Run remote cmd + mirror logs locally
| File | Purpose |
|---|---|
~/work/modular/mutagen.yml | Declarative Mutagen sync config |
~/.local/bin/rexec | Remote execution helper (Python) |
~/.local/bin/r | Wrapper: flush + rexec |
~/.local/bin/rlog | Remote command runner with mirrored logs |
~/.local/bin/setup-b200-shared-sync | Creates/repairs shared remote->local Mutagen sync |
/home/ubuntu/shared/logs | Remote log root (source of mirrored logs) |
~/shared/b200-hydra/logs | Local mirrored log root |
~/.ssh/config | SSH multiplexing config |
coder config-ssh already run)ssh <workspace>.coder works)brew install mutagen-io/mutagen/mutagen
mutagen version # Verify: should show 0.18.x or higher
Add to ~/.ssh/config:
Host *.coder coder.*
# Speed: connection multiplexing
ControlMaster auto
ControlPath ~/.ssh/cm/%C
ControlPersist 10m
# Reliability
ServerAliveInterval 60
ServerAliveCountMax 10
TCPKeepAlive yes
# Don't pay X11 tax for every short command
ForwardX11 no
ForwardX11Trusted no
StrictHostKeyChecking no
ConnectTimeout 0
Create socket directory:
mkdir -p ~/.ssh/cm
Test (second command should be <0.5s):
time ssh b200-hydra.coder hostname # ~2s first time
time ssh b200-hydra.coder hostname # <0.5s with multiplexing
Create ~/work/modular/mutagen.yml (gitignored):