Zend Studio: syncing files with remote server using unison

Zend Studio + unison

Let’s suppose you’re developing some web project. It’s a common situation when you need to sync some files with your server, isn’t it? I’ve first ran into this need two weeks ago, and I found a lack of complete solutions/guides… I’ll only share my experience. Hope this would help someone. So, what do we got?

  • Shared hosting:
    • No root access.
    • Gentoo (this method should work on MANY other systems too, see compatibility table here)
    • We can “make”
    • We can’t “emerge”
    • Lots of free space

What we are going to do?

Although “rsync” tool is accessible on my hosting, unison was not installed. And There’s not enough privileges to “emerge unison”. That’s why we need to Bootstrap Gentoo-Prefix first – it allows to install packages to your local package manager.

Although installation itself is quite straightforward, there a trap with compatibility.

 

Although there’s a well-written unison user’s manual, there’s still some crutches required to launch it on prefix.

 

Although unison itself doesn’t require weird configuration options, here’s some hints on how to pair it with cygwin ssh, Zend Studio, Eclipse, NetBeans and Araxis merge.

 

Lyrical Digression: «Why do I need a sync tool? »

  1. One may use Zend Studio’s Remote Systems feature, to edit files on your server directly … However:
  2. It is impossible to use Search, autocompletion (almost)…
    1. I’d like to store my repository locally.
  3. One may use Zend Studio’s Remote Server Support (RSS) (upload on save), but
    1. Zend Studio 9 ignores “hidden” folders (“.*” – name beginning with a dot). Here’s a topic I’ve created on this on their official forum.
    2. RSS won’t notify about updates on the server.
  4. One may mount remote folder through (s)ftp using FtpUse, NetDrive or DokanSSHFS. Though:
    1. Although ping to my server is ~15ms, and bandwidth is ~4MB/s, performance is poor: each directory listing required not less than a second, so did each operation with a file. (Although FtpUse was a bit faster). Parsing a project would take ages.
    2. Of these three – NetDrive is working together with mklink. I believe this is a DokanFS bug.

Lyrical Digression: «Why Unison? »

Because, in contrast to rsync, it’s a two-way sync tool. It monitors changes.

  • If you try to use rsync for a while, you’ll end up with a question like this: Two way sync with rsync and you best-answer would be “try unison”.
  • It won’t overwrite newer file

  • It won’t delete new file

  • It allows to merge two changed files into new one

  • It only transfers diffs – so, it is fast even for 50 000 files.

  • It’s crossplatform.
About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s