My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

With the current trend of offline applications and solutions as Joyent Slingshot or Rails2Exe to run a stand-alone offline client app written in Rails, we end up having a problem ahead of us: offline data gathering and synchronization back and forth to a main online server.

There is virtually no solution for that matter unless you use some proprietary and expensive package. Google Gears comes to mind but it acts more like a static client-side caching providing no real replication of data. So 'acts_as_replica' was really made to scratch my own itch.

It was made for the scenario where you will have several clients working in an offline environment and then they'll connect at the end of the day to get new data from the server and also send back what it collected through out the day.

This is a very opinionated software, meaning that it was not made to cover every single synchronization scenario in the world, but small and mid-sized solutions should benefit. It uses HTTP to wire both peers and up until now formats the payload packages in YAML.

This plugin was very influenced by the plugin acts_as_syncable by Alex MacCaw. Actually I used his code as the initial structure but it's now very far departure from his original view.

This project was done under the support of my current employer, Surgeworks. I am not done yet, so this is a work in progress. Any collaboration and ideas will be welcome.

Read the HowToInstall, MustRead and HowToTest Wiki Pages for more information. And don't forget to download the Example Project so you can have a faster hands on.

If you have any suggestions, doubts, ideas contact me at fabio.akita@surgeworks.com.

Apr, 3rd, 2008 - Moving to Git

I am abandoning Subversion management. I will leave this homepage behind but the source code here is frozen. Newer updates will be only at Github.

http://github.com/akitaonrails/acts_as_replica/tree/master

I am very late updating this code, sorry for that, I will try to make it more user friendlier now.

Sep, 23th, 2007 - Lots of Changes

I just uploaded a batch of new features and bug fixes to the plugin. I finally had time to test it further and I am much more confident about it.

  • The Sync table was renamed to Replica - the daemons plugin seems to complain with this name
  • Added RemoteMachine table. Now the handshake process exchange Machine IDs (UUID), and the new Replica table keeps track of each machine_id. That way, the transactions are no longer bound to a single User in a single client App. The same username can be used in any client installation and still be able to safely replicate data back and forth.
  • The client and server no longer uses a timestamp (in the last_synced columns of User and RemoteClient) to track each others transaction log entry points. It has been replaced for a simple auto-increment integer number (the primary key for the new Replica table).
  • syncable.yml was deprecated in favor of a SyncSetting singleton Model. You will have to create your own administration screen, though.
  • It was asserted that SSL connection do works
  • Created a proper script/generator instead of the old manual file copy operation. I deprecated the use of the old Engine plugin because it was too buggy with dependency loading.
  • Added support for background jobs triggered through a controller. Sample controller and views included. It is cross platform as well. In nix I use the good ol' system() call and in Win32, the Process.create method. You can control what's happening tailing the log/replica.log file
  • Added experimental application self-upgrade. lib/daemons/upgrade.rb is a new background job that calls svn cleanup, svn update and rake db:migrate. That way the application can be updated remotely without direct SSH connection to the server
  • Batch control was finalized and tested: the syncs_helper.rb now implements a run_sync method that controls run_upload and run_download. Each can read its local batch_limit settings (see SyncSetting). Then it can retrive XX number of rows at a time. This can be used to refine transfer using slow connections, so to avoid timeouts.

Jul, 8th 2007 - New Project Member

I just added Marcus Derencius, a good friend of mine, as a contributor. He pointed out somethings that we could add to this project:

  • The User class is hardcoded. We need to make this configurable to allow for other authentication plugins that doesn't use a model named 'User'
  • Generate automated RDoc documentation
  • Add support for Rake tasks. And actually Slingshot expects to find a :up and :down tasks in its GUI
  • Devise some cronjob like scheduled task to actively check whether the network is on or not and automatically start replication in the background, thus avoiding having to replication too big packages only at the end of the day
  • Put in some connection checking before starting the 'perform_sync' process. If you start it without having the server part online, the client process simply hangs and you have to forcefully kill it.

Jul, 17th 2007 - Merged with Userstamp

I realized that the vanilla Userstamp plugin doesn't work properly with this plugin. Until I devise a better way, I merged the userstamp.rb in the lib folder of the plugin. The belongs_to proxy method fails in some cases and the usage of the UUID can conflict as well. So delete the original userstamp plugin and use the one in this plugin.

Powered by Google Project Hosting