ra-multiplex icon indicating copy to clipboard operation
ra-multiplex copied to clipboard

[Question] Can ra-multiplex server running on remote machine, and client running on my local machine?

Open eval-exec opened this issue 1 year ago • 4 comments

Hello, I noticed that rust-analyzer is using too much CPU on my local laptop, which has relatively low specs. My remote server has much better hardware. Is it possible to run the ra-multiplex server on the remote server and have the ra-multiplex client run on my local laptop? Thank you!

eval-exec avatar Jul 21 '24 02:07 eval-exec

Theoretically yes, you can port-forward the TCP socket through SSH for example. But I haven't tried it and I expect trouble around file synchronization between the language server and the editor. If you want to try it you probably also want the filesystem to be shared between your computer and the remote server and you'll have to match the absolute paths of the project.

Simpler option is, if you use a terminal editor, is to just run the whole editor remotely through SSH.

pr2502 avatar Jul 25 '24 21:07 pr2502

@eval-exec This is a bit late, but I hope it is helpful. I've tried this approach out since I use a terminal editor (helix) and preferred running it locally for low latency and running the LSP on the server.

You can indeed forward the TCP socket through SSH with the -L 27631:127.0.0.1:27631 option. As @pr2502 mentioned, you need to match the absolute paths. In my case, I symlinked the real project on the server to match my paths locally: ln -s /home/fc/project /Users/fc/repos/project. You would also need to ensure the files on the server stay up to date: it appears rust-analyzer sometimes needs the files on disk. I achieved this with watchman running rsync to the server on every local file save.

You can also set SSH connections to be reused for faster rsync's:

host *
  ControlMaster auto
  ControlPath ~/.ssh/ssh_mux_%h_%p_%r

With this, the sync's were low latency enough for rust-analyzer to not complain. I tried virtual file systems (sshfs, catfs) previously but they were too slow for just listing files in helix.

Tweoss avatar Aug 30 '24 04:08 Tweoss

You can also set SSH connections to be reused for faster rsync's:

host *
  ControlMaster auto
  ControlPath ~/.ssh/ssh_mux_%h_%p_%r

Thank you, it helped me a lot.

eval-exec avatar Aug 30 '24 04:08 eval-exec

I want to create a Docker container to run on a remote server. In the Docker container, I need the container's absolute paths to mirror the paths on my local machine.

For example: On my laptop: /home/eval-exec/work/project On the server: /home/server/work/project I want to mount the Docker container's path like -v /home/server/work/project:/home/eval-exec/work/project.

When I launch ra-multiplex in the Docker container, it should see the same paths inside the container as on my laptop.

@pr2502, if you’re interested, I’d like to submit a Dockerfile PR for ra-multiplex.

eval-exec avatar Aug 30 '24 08:08 eval-exec