3
votes

UPDATE: I saw that someone was trying to use PyCharm with SSHFS and JetBrains said: "no". Perhaps this just won't work?

I'm trying to work with WebStorm on an SSHFS mounted disk at a client's office I'm working at — I've never used SSHFS before. I am using OSX 10.9.2, installed SSHFS thru home-brew and installed OSXFUSE.

The SSHFS mount dismounts periodically in any case, but since I started trying to use WebStorm with it it dismounts every time I start WebStorm and it starts scanning the files on the SSHFS disk — WebStorm gives the message "external file changes sync may be slow: Project files cannot be watched (are they under network mount?)" and if I try to open files it freezes. The SSHFS disc meanwhile has been dismounted. If I remount via terminal WebStorm isn't happy and either freezes or just sits there.

I set up the WebStorm project using "New project from existing files" — is there a way to set it up using SSHFS as a server? Beyond the login and password to the SSHFS disc I don't have any other server-specific info, but perhaps could get it.

Thanks for any help — 

1
I recall reading a few years ago that SSHFS shouldn't be relied on as an actual filesystem because certain changes don't propagate instantly... but now I can't find where I read that. That's unfortunate, since the page I'm thinking of had some tweaks that would make it more well-behaved. Since it was years ago, maybe the filesystem itself has improved so those tweaks aren't necessary; but that still doesn't help you, I'm afraid.echristopherson
Did you ever find a solution to this?Gabriel Fair

1 Answers

6
votes

This is how I operate, and maybe it can help you. If there's a config setting I seem to have glossed over, just ask and I'll fix this up. But all in all, this is wonderfully successful:

My build environment is tucked away on a Linux distro, but my development environment is co-located on a Mac Desktop (when I'm at work) and a Mac Air (when I'm at home). My projects are enormous, and contractually I can't move the code to any machine where it might be accessible if my laptop is stolen. So I pretty much have to use ssh (and sshfs) to get anything done.

When I am at home, and I sit down to work, I manually initiate the VPN -- since there are so many variations, I'll assume you know how to do this part.

I open a terminal and invoke:

caffeinate &

because I hate getting disconnected whenever the computer goes into screen saver. This may be why you get disconnected? I leave this terminal open whenever I'm developing. I also use tmux so that my terminal session can be shared between computers. Anyway...

I set up a mount point set up between the server and the client. I have a script that I run when the mount point goes down (customize for your own work):

umount -f /Volumes/$MOUNTDIR/
umount -f /Users/$HOMEUSER/$MOUNTDIR
mkdir /Users/$HOMEUSER/$MOUNTDIR
sshfs $HOMEUSER@@SERVERADDR:/usr/$HOMEUSER/$MOUNTDIR /Users/$HOMEUSER/$MOUNTDIR

I then launch Webstorm, PyCharm, ADS, IntelliJ (I'm a Jetbrains fan).

At this point you can open the directory within $MOUNTDIR and start working. If you find that you need to run builds, here's a tip -- do not build locally. Instead use SSH to issue the build commands (or run scripts) on the server. The overhead of synching after the build has run is most likely far less than fetching and writing all of the steps of the build.

I only find I get disconnected if I lose the VPN. I used to get disconnected whenever the computer would sleep. Caffeinate fixed that.

For reasonable sized projects, this is probably all you need. So what follows is an optimization -- only do it if you are having headaches:

To speed up load times, what I do is create a local project that is not part of the mount. There is a .IDEA directory that gets created and written to a lot at the base of the first directory you open as a project. Inside of this directory are lots of files that get written to a lot, and depending on your network speed, it might cause grief. It does mean some settings have to be maintained everywhere you go, but in my case it's a small price to pay for big performance gains.

So because I do this, I'll have to manually add directories to my project (Under Preferences/Directories). But if you work with huge APIs, you might be doing this anyway. I am careful to mark directories I don't need to reference as 'excluded', to make life easier on the indexer. I work in a shared directory structure with thousands of other employees, and I make sure the streams don't cross.

Now I have many many thousands of files, and it is true that sync can be slow. But sync is only triggered when you leave the app and come back in. And honestly, it's not that terrible, so long as you have a reasonable internet connection.

I hope this helps. Once I started using this as my workflow, I never went back.