8 ms·
As someone who codes on a remote server the whole day, mosh is absolutely necessary and it is fantastic Advantages: - you dont see any lag when you type, it i
by polote 7y ago
As someone who codes on a remote server the whole day, mosh is absolutely necessary and it is fantastic
Advantages:
- you dont see any lag when you type, it is exactly as if you were on your local machine
- when network disconnect, the terminal freeze and when network is up again, the terminal becomes interactive again preserving everything in between
- connection is preserved as long as the terminal is open, so even after hibernation your session is preserved
Drawbacks:
- you can't scroll , but if you use tmux then it is possible . I've tried using Eternal terminal, as it allows to scroll but it doesn't perform well at all on laggy connections
- You can't detach and re attach mosh connections (same for ET)
- I'm not sure it is possible to preserve middle-click copy/paste (at least I've not managed to make it work)
- time to connect is a bit longer than normal ssh
- clarry 7y agoWhy do you code on a remote server?
- polote 7y agoI'm creating a PoC (well more the MVP of a company) and this includes a scrapper which requires a very reliable connection, which I don't have locally
- jsjddbbwj 7y agoThere are solutions to mount the remote filesystem locally and use any regular code editor
- clarry 7y agoThere are also editors that can use a plenty of various protocols to read & save remote files while performing editing locally.
- Piskvorrr 7y agoAnd most of them either rely on SSH+rsync, syncthing, or something along those lines - in other words, tools that will sync the files reliably, even on bad links...eventually. Never have I seen a backend that's built for editing...the remote-mount abstraction mostly works, but leaks specifically in these edge cases.
- ctrl4 7y agoYou can code locally, push to a repository, and have the changes almost instantly on your server ready to be run.
- polote 7y agoyes, i prefer to save those 10 seconds as I do that a thousand times a day
- MereInterest 7y agoPretty common for physics experiments. My computer has neither direct access to the data being collected, nor the processing power to deal with it. Sure, I could code locally, push to a repo, and then test remotely, but the additional turnaround would be obnoxious. Far easier to open up a terminal and run emacs remotely.
- jerf 7y agoIf you're using emacs, you may be able to use Tramp to remotely access the file. It depends on how IDE-ish you've got your emacs set up. As long as you've got reasonable latency I find that much nicer. (If you already know, well, I'm sure someone else just learned something today.)
- MereInterest 7y agoOh absolutely. I like using tramp to edit individual config files remotely. If there is one particular data acquisition computer that is performing incorrectly, I can quickly open up that file to compare, without needing to leave the editor. The issue I ran into with editing code through tramp is the integration with make. I use `M-x compile` to compile from emacs, with a few modifications to find the appropriate makefile depending on which project I am working on. If I try to compile locally based on remote files, my compile times go through the roof. I suppose I could have opened an ssh session in which to run make, but it was easier to open emacs remotely. The other advantage is that I could use tmux+emacs to have everything remote, and to connect to that same session from multiple computers. A typical day during an experiment might have me start in an office, later head to an experiment monitoring room, and later head down to the experiment vault to see if an issue is being caused by hardware. With remote editing, I could have the the entire session, including any files that I have already opened, no matter where I am physically located.
- alexhutcheson 7y agoIf you are in a buffer for a remote file, then M-x compile should run make on the remote machine. Docs are here: https://www.gnu.org/software/tramp/#index-compile https://www.gnu.org/software/tramp/#index-compile
- jasonpeacock 7y agoBecause my local server is my laptop at home with cheap ISP bandwidth; my remote server is in a data center with high-speed bandwidth and much more CPU/RAM/SSD than my laptop. Why do you suffer to use a local server/internet for development? I've been using the "laptop is a dumb terminal" paradigm for many, many years and I've avoided a lot of headache that I've seen in others trying to get everything to work "locally". Yes, this means I need to be online to work, but almost nobody works offline anymore - between googling issues, downloading/updating dependencies, and browsing while compiling, having an internet connection is assumed.
- jonfw 7y agoWhy not write code locally and push to build/test remote? I feel like this is the best of both worlds- but it does require some up front effort to build the pipeline
- jasonpeacock 7y agoYes, that works too, especially if you're using graphical IDEs/tools for development.
- foobarian 7y agoFor me the axis is not computer quality, it's IDE quality. My productivity in a large codebase jumped 10x when I switched from emacs to IntelliJ (for Java). Going back would be like blindfolding myself after I grew up blind and got my eyesight restored once. Remote development is tricky indeed. Many people run the IDE locally and use its remote development functionality. I run it remotely over VNC.
- WildGreenLeave 7y agoYou run your IDE over VNC? I've been wanting to try out remote developing for multiple years now, it would allow me to get an iPad with a perfect battery life or an Macbook Air that would tag along all day without charging. But because I cannot work with vim/emacs and my IDEs (IntelliJ) do not support anything like remote development I am stuck with a huge Macbook Pro including a battery draining IDE that cannot be ran remotely. VNC added too much lag for me to use all day.
- Piskvorrr 7y agomosh is very useful for intermittent connectivity. Anytime I had to rely on spotty 2G/3G/wifi, the usual workflow "work locally ; git push" failed, as it's TLS/TCP and not resumable. Had to autossh+rsync the diffs out onto a stable host in the cloud, and then essentially worked from there. Also, I have a mosh client on my smartphone; setting up the dev environment there would be a bear. Essentially the mainframe model ;)
- kitotik 7y agoNot OP, but I frequently code remotely from an iPad and from laptops that may not have a full dev environment available. It didn’t even occur to me that this was a foreign concept to folks!
- p1esk 7y agoHe might be asking why your laptop does not have a full dev environment.
- loeg 7y agoSpace? Performance? Builds typically perform best directly adjacent to storage, and if you're working with a large project syncing that back and forth may be slow.
- kitotik 7y agoAh fair enough. As someone who’s been fairly mobile/nomadic most of my career, I have always enjoyed the thin client approach. I can get many more years of service from my client hardware when offloading the bulk of compute, storage, and stable bandwidth needs to beefy servers. I’ve found that it’s just generally more economical and efficient this way. Plus, the few times I’ve had laptops die, get stolen, damaged etc to have a much lower impact when they don’t have anything all that important on them.
- deleted 7y ago[deleted]
- p1esk 7y agoI want to use Windows on my local machine, but my code (deep learning models) runs faster, and is better supported, on a linux server.
- trimbo 7y agoSince no one has put this reason out there: to have one's development OS mirror production[1]. IME, the "develop on Mac, break on Linux" problem is not uncommon, even with high level abstractions. Plus, things like docker are native. This can be all done in a VM, of course. I personally like the remote server, especially since they can be spun up so easily with cloud services now. [1] - Though sometimes that's impossible. I.e. embedded.
- loeg 7y agoMy work prefers their IP be kept inside their network, so to speak. Yes, nothing really prevents me from cloning my work git over the VPN and doing the work locally, except for norms and limited local disk space.
- lrem 7y agoMy laptop does not have enough disk space to check out my repository. Also, security policies. But I like the first reason more. Then again, my laptop won't run friggin mosh, because of security policies.
- FullyFunctional 7y agoBecause I can literally walk away in the middle of a debugging session, grab any random notebook in the house, travel to Djibouti and resume exactly where I left off (ok, replace Djibouti with a random coffee shop). It has completely changed how I work and I love it (mosh + tmux = <3). ADD: I do switch frequently between my desktop and multiple notebooks. Working this way means I can have a beefy/noisy development server and a light & quiet notebook which just needs mosh.
- CJefferson 7y agoDrawbacks: - No commits in github in over 9 months, PRs and issues are stacking up. - I've had friends report clipboard broken in latest Mac OS X version. Don't get too attached to mosh.
- elwell 7y agoOr, get so attached that you become the new maintainer either amicably or by fork.
- X6S1x6Okd1st 7y agoNew commits are not a necessary part of good software. Your second point is a much better point
- Eldt 7y agoIt kind of is when the issues continue to climb as suggested in the post you responded to
- X6S1x6Okd1st 7y agoI used to use mosh fairly extensively and only really had two problems I wanted solved. I didn't care enough to learn to code them myself so I called it good enough.
- wyclif 7y agoWhy isn't mosh being maintained?
- lilyball 7y agoWhat does mosh have to do with the clipboard?
- CJefferson 7y agoI went and found the issue. Some terminal apps interact with the system clipboard and mosh isnt forwarding this correctly. https://github.com/mobile-shell/mosh/issues/967 https://github.com/mobile-shell/mosh/issues/967
- smichael 7y agoI detach/reattach mosh sessions all the time, using the excellent dtach tool.
- jasonpeacock 7y agoBut you do see lag - if you have auto/tab-complete, history search, command suggestions, etc, those all will still lag because they are waiting for a response from the server. The lag that is eliminated is the local echo of characters as you type, as mosh is sending those asynchronously in the background. If you have fancy, more interactive prompt/cmdline on the remote server then you'll still see the issue. Ditto if you run tmux on the remote server. I really wanted to like/use mosh, but there's too many issues of reality that it can't gloss over. If you're just maintaining basic SSH sessions into remote servers, then it's great. But if you have a nice, interactive remote development environment then you still get the same lag and latency issues.
- mbreese 7y agoBut what’s the alternative? Local development with syncing back to a server? The lag is something that I can deal with. For me, the killer feature is the automatic reconnects. I usually only use mosh when I’m traveling and at conferences. In that scenario, I’m either using my iPad (with keyboard) where the client might be killed anytime I switch apps or I’m using the conference WiFi, with is always spotty. In either case, using a mosh client makes me less likely to throw my laptop or iPad down in anger every 5 minutes.
- acoard 7y ago>But what’s the alternative? Local development with syncing back to a server? I'd say this is a perfectly fine solution for a lot of cases. Not all, of course, like your iPad one sounds a great fit for mosh (and I'm gonna try it out!) But even a RaspberryPi can power a really powerful terminal. You can use sshfs[0] to mount a remote drive over ssh. Obviously there will still be some lag - `ls` will require a round trip - but your local terminal will be much snappier. [0] https://github.com/libfuse/sshfs https://github.com/libfuse/sshfs
- anamexis 7y agoBlink is a great and open source SSH/Mosh client for iPad. https://blink.sh/ https://blink.sh/