Using WebStorm (JetBrains) with SSHFS mounted development server (Mavericks, OSXFUSE)? Constantly dismounts drive - osx-mavericks

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 — 

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.

Related

Filesharing between OS X & Windows 10 on a htdocs directory?

I had a practical question for my own work at home. I want to use quad monitor for my coding and other work. I can do this with my macbook pro attached to external triple monitor. But it is not practical because of all the cable management and Macbook Pro is barely keeping up with the performance running it. So what I wanted to do was having my PC run triple monitor and my Macbook as forth screen. Code on my pc and share/update the files in the htdocs directory on my OS X. Like how FTP works.
I found this link: http://www.itworld.com/article/2844141/how-to-share-mac-os-x-yosemite-files-with-windows-10.html
But I'm not sure if I will face sudden obstacles in doing this with my htdocs directory or other directories where my work is stored and updated from time to time.(example:Symfony projects)
I hope I mentioned everything. Thanks in advance!
Well, you can use one of the free cloud based, file-sharig service, like Microsoft OneDrive, Google Drive or Dropbox.
But files will not be updated immediately, you need to wait few seconds (in the best case scenario). So it might get frustrating quickly.
Also, from my experience, OneDrive on Mac is not the best choice when it comes to a Symfony project - it stops working after a while, probably because a lot of cache files, so I need to restart it and it's not usable at all.
Another solution might be using a version control system (f.e. Git) - but you would be able to see the code changes only after a commit and push (and do it manually, of course).

Is there an efficient way to do remote editing over server using sublime Text 3?

I am writing some projects and need frequently compile and test on remote machine.
I am not a vim user thou :(
What I end up now is to use Fetch to browse the project folder and directly open those file using sublime by changing the default editor in Fetch. It somehow works, but one thing not perfect is that I cannot have a “project” structure in my sublime.
I am wondering anyone has a better way to use Terminal (or iTerm whatsoever) with sublime better.
Although this question is over two years old, I will try to answer it. Maybe it will be helpful for you or others that find it.
First, there is sshfs, which you can install via Homebrew or MacPorts. A simple approach would be as following:
mkdir -p ~/mnt/server
sshfs user#server.example.com:/path/on/server ~/mnt/server
Afterwards, you have the complete folder structure from server.example.com locally available at ~/mnt/server. Make sure you set up SSH keys to avoid entering the user password every time. You can find tutorials on that everywhere on the net.
For servers that only offer FTP access (shared hosting and the like), you can use curlftpfs in the same fashion.
To close the connection, simply unmount:
umount ~/mnt
For a GUI-based approach, you have several options. There is Transmit, which features mounting connections as volumes, Forklift which is a Finder replacement that can do the same, ExpanDrive and my favorite Mountain Duck.
If you plan to move lots of data, especially a lot of small files, Mountain Duck performs the best in my testing.
You could use TransmitFTP. Any FTP/SFTP/WebDAV/S3 server connection can be mounted as a volume, e.g., /Volumes/Example. Then you can browse to it when opening a folder in SB and add to your project like any other directory on your filesystem.

Hosting Visual Studio projects in dropbox

I develop both on my desktop and laptop, and I am frequently switching between them. Are there any problems that could arise from keeping a project folder in my dropbox and always accessing/editing from there? I'm running the VS2010 on both, but W7 on one and W8 on the other.
I'm using it often. But I do experience some issues. It seems that sometime VS and Dropbox conflict. This shows by leaving some temporary source files or by errors during compilation of file being locked.
In fact I came here while looking how to solve them. But still they are only a little issue and I keep using it that way for a long time.
EDIT: It is not just me. See Visual studio 2012 and dropbox don't play nice together question on SuperUser.
I'm using Dropbox to host my project and I edit and build directly on there and have experienced no problems, ever. Win7, VS2010, CPP. I find Dropbox to be simpler and equally robust to than version control software. I'm a big fan. I should say Microsoft OneDrive once failed me, horribly, and I no longer trust it. With Dropbox, I always check the icon in the systray carefully to make sure it is finished updating before I turn my computer off.
I use both git and Dropbox, as I also switch which machine I'm working on. This way I can use source control with the rest of my team, while also able to pick up where I left off. My 2 PCs that sync are my one at work and at home. Both desktops, both almost always on and running dropbox.
Rarely I get conflicts, when a machine is offline or something. The solution 99% of the time is to simply delete any conflicting files. Because I'm constantly up to date with git, it's fine if I ever have to delete all my local code, since I can always get it back.
So it's really for nothing other than being able to run out of work on an urgent task, and then resume where I left off when I got home.

Script to automatically sync on directory/file modification in between Mac OSX machine and Linux machine

I have some source code on my Mac, and in order to test I'm interested in synchronizing it with a VM containing a similar web server setup to the production environment. Therefore I need to be able to automatically copy files over to the VM every time there are changes.
I know I can use rsync to do this manually whenever a script is run but I need some way of getting it to run in the background every single time a file in a particular directory or one of its sub-directories is modified.
I know inotifywait exists on Linux machines and could solve this problem. I've also read about the FSEvents API and kqueue. However, none of these seem to be accessible from the command line and I really don't want to spend a long time making something to do this...
I guess I could use a cronjob but a minute is a pretty long time to wait to see changes on a website...
Any ideas?
I do this all the time, developing on a Windows/Linux/Mac workstation, and saving changes to a remote Linux server where they're immediately served back to my workstation's browser for testing. You've got a couple options:
You could mount the remote files locally (like via sshfs) and make changes directly to them. I.e., your Mac thinks the files are local, so you can edit them with your GUI editor, but when you File->Save, it actually saves the file remotely. The main downside to this is that you can't work when disconnected from the server.
Mount the local files remotely. This would allow you to work locally while disconnected but won't allow the test site to work when disconnected -- which may not be a big deal. This option might not be doable if you don't have the right tools/access on the remote server.
(My preference.) Use NetBeans IDE, which has a very nice "copy to remote" feature. You maintain a full copy of all files locally, and edit them directly. When you hit File->Save on a file, NetBeans will save it locally and transparently scp/ftp it to your remote server.
How about using a DVCS like git or mercurial, and having the local repo run post-commit hooks to run the rsync and then the test itself?
I'm a bit confused about why you can't just run rsync from the same script that runs the test. If you run rsync -e ssh you can set up automatic public key authentication between the VM and the Mac. There won't be anything manual about the rsync in that case.
You might be able to set up a launchd agent to do what you want for a simple setup. See this question and the man page for launchd.plist for more information about the launchd WatchPath key. But it looks like WatchPath may not work for changes within sub-directories.

Automatic file upload

Is there any way, any free software capable of automatic file upload? Let's say I edit php code on my local computer with my favorite IDE. I won't change my IDE, it's great. I want something that would detect a file is changed in my project directory and upload it with FTP/SFTP onto remote server. That's it - just that simple.
What I've already tried:
FTPDrive + FileSync Eclipse Plugin - it's quite slow, uploads ALL the files way to often, works buggy under Vista and Windows 7.
WinSCP automatic synchronization - bugs again, refuses to upload files randomly. Would be the best if it worked right.
Eclipse's native SFTP support - it's USELESS! You cannot use PDT projects with this feature. PDT without projects is no better than Notepad++.
Aptana FTP feature. It's worse than manual! Gawd, it sucks!
Running my own PHP/MySQL server under windows. First, it took me ages to set it up, then, it didn't work EXACTLY as my production environment - I hadn't been able to test my code correctly.
How it should work? I change file here, and it's uploaded there. It would be best, if it sit quietly in tray and bother me only if upload error occured.
Ok, if it's not free, maybe there's something cheap at least?
If there's nothing like it, is there something like FTPDrive?
rsync does exactly what you're asking.
Well, almost: it doesn't watch your filesystem and automatically upload files - you'd have to set up a task to run it every minute or whatever. But it does efficiently upload only the changes. If you're on Linux, lsyncd does the watching part and drives rsync to do the efficient upload part.
In the rails world, we tend to use source control and a deployment tool like vlad or capistrano. It's a bit safer and more consistent than FTP. This is a guide on how to use it with svn and php http://www.simplisticcomplexity.com/2006/08/16/automated-php-deployment-with-capistrano/.
You really should try to get your development server running on your personal machine. It's a much better way and it is worth the initial pain of trying to make it work. There are good tutorials on that out there somewhere.
You can use WebDrive or ExpanDrive, mount a complete remote directory as a local disk drive and directly edit your files on the server. However this highly depends on your connection and how your tools are written. Another approach could be to use one of these tools and with another tool sync all the changes asynchronously.

Resources