1

To make a long story short, I need to build a simple dropbox clone to sync files with my server.

I did my homework, I did lots of research, but none of the solutions I found (both code and already baked solutions) seemed to be good enough.

I have read the other posts here on stackoverflow too, the only difference is that I need the sync task to be triggered on filesystem events. Also, git is already being used for real version control purposes, and I can't use it for this sync task.

Here's my setup:

I have a git repository on github and I do regular deployments with capistrano. Here's my problem: we have infrastructure and data implications which make it impossible to do real local development.

My code can exist locally, I can version it on github, but it needs to run on the server, even as I do development. In order to avoid cowboy development, I came up with this solution:

  • keep in mind that this is only for the front-end layer, which involves hundreds of tpl (html + smarty), css and js files *

  • The master branch runs for the public

  • When logged in on our live app, developers can switch to "developer mode" and point to a different repository that exists on the server. This "ghost" repository is simply an exact replica of the developer's local working copy. It is kept in sync with the dev's local repo trough the dropbox clone.

That way, this can be our workflow:

  1. Developer does work locally on all the stuff
  2. Every time something is changed locally, the "ghost" developer repository is updated too and things can be tested on the server
  3. When the dev is happy with the results, he can then commit and push to the development branch
  4. When the team is ready for a new release, all the commits can be deployed trough capistrano

This way, the ghost repository of each developer is completely out of the picture when it comes to the git workflow (as far as git is concerned, these ghost repositories don't even exist, they are just a utility for the developer).

Given this (long!) premise, these are the features I would need:

  • ability to sync over ssh
  • trigger the sync on filesystem events (creating/updating/deleting files and directories)
  • only syncing updates in rsync style (delta encoding), basically just differences
  • possibly a cross platform (windows/mac) solution

Among the "already made" solutions:

  • GoodSync
  • Super Flexible File Synchroniser
  • ChronoSync

Only GoodSync seemed to offer what I needed, but I couldn't make the auto update feature (sync on filesystem updates) work in any possible way.

Among the recipes I'd have to make myself, I've read about FSEvents, inotify (linux) + rsync options, but they may be a bit out of my league (I can do basic applescripts, probably not a lot with the FSEvents API or inotify)

So this is where I am at right now. I am open to any type of suggestion, and I thank you in advance for anything you may share on the subject.

Thanks!

The Bug Fool
  • 63
  • 1
  • 4

2 Answers2

2

Use lsyncd and samba shares for windows compatibility

I would recommend a local linux server with samba shares on which developers work locally. The local server would then sync with your remote server using lsyncd (user friendly inotify/rsync/ssh solution). I've deployed a very successful solution like this and it's very easy to setup (no advanced/custom scripting).

Also have a look at the following:

Community
  • 1
  • 1
Rudolf Meijering
  • 1,559
  • 1
  • 14
  • 20
0

It looks to me like you're trying to do it the hard way.

I work on a software project that has a large source base and is best built on the server, rather than my home machine, and I just ssh into the server and edit the source that way. (Actually, I use NX to use a remote X-windows session, but it amounts to the same thing.) The server is in California, I'm in the UK, and the latency is not an issue, so unless you're operating over a terrible connection, I don't see the point of anything fancier.

If you must use a local editor, try mounting the remote system with sshfs. It's not ideal, but it works. I wouldn't recommend doing anything that scans a lot of files that way though.

Otherwise, if you must use a mirrored directory, why does it have to be automatic? Surely the developer knows when he wants to test a change and can just hit an rsync button?

ams
  • 24,923
  • 4
  • 54
  • 75
  • Hello, thanks for your answer. Not everyone on the dev team is a fan of console text editors so we're also trying to give them the possibility to choose the tools they work best with (TextMate, even SublimeText is pretty big these days). You actually made a good point on the rsync, I think that's ultimately the option we are going to go for. It's probably a bit irresponsible to hit the server on every change, considering how many developers (myself included) can't hit cmd+s less than 5 times a minute :) - so I'll just have an apple script trigger the rsync on a keyboard combo chosen by the dev – The Bug Fool Apr 27 '12 at 13:25