Developing on a remote code base

Every now and then I need to work on a system that has so many dependencies that it’s easiest to run it on a remote machine. Previously, I’ve used sshfs to mount the remote file system locally and worked on the project in vim that way but the internet connection I was using wasn’t great, so that wasn’t an option.

Initially, I was going to try out PHPStorm and it’s SFTP functionality, but then Nils reminded me that I could use something to watch the code directory and rsync it with the remote host automatically. I was going to hack something together with inotify and rsync initially but a quick Google lead me to lsyncd.

lsyncd is awesome. So, so simple to set up. Just run the following command to make sure that files are synced as soon as they are saved

lsyncd -rsync /path/to/code -delay 0 -nodaemon

The -nodaemon flag will run it in the foreground so that you can make sure things are working as expected. You can delete this flag if you want it to run in the background.

March 03, 2016

How To