Reprinted: http://blog.dloh.org/Riak,-haproxy,-and-client-side-applications
Last night I switched my local phosgl development from a Django app to running a riaksearch cluster fronted by haproxy. the amount of change required was mapping the old URLs to the new Riak buckets. I created buckets for objects, images, sounds, shaders,
And models. I also created an application bucket that serves the default HTML document. the immediate advantage of this is I can now have javascript put new documents directly into the Riak key value store. for primay Source Control, I have a git-hook which
Callthe 'make install' script which rebuilds the manifest file, revs it's version, and curls all of the files in version control into their appropriate buckets.
Currently since this deployment scheme is destructive, rolling back changes is just a matter of reversing the commit and having the make install Command run. in the not too distant future I'm going to integrate a uuid script to generate universally unique IDs
For each object in the datastore, and use a client side router object which manages mapping canonical names to uuids.
The advantage here is that publishing a single routing table is all that is necessary to do a release, and reverting changes just amounts to pushing the old route object. the other very clever bit is I can publish a timeline object which contains routes
All the previous route objects, and run the app as it existed at any point in time.
since I already have a module loader and data access layer, it only requires a minimal prefetch and one indirection IN THE USE method to imement. this same interface can also support put for revisions of objects wherein each revision merely puts a new object
and the uuid mapping can generate future routes and not deploy them. this way I can build for a future release in place and it will simply be a matter of updating the canonical route object with the appropriate UUID.
This is obviusly really simple, as we only use http get and put. riak handles distribution, and haproxy multiplexes and loadbalances. but the coolest bit is search. because I am storing code and data in a SOLR indexed key value store, my application can discover
Events and objects via search. more over using a got-hook to publish diffs to the key value store allows us to search for changes. finally since every entity will have a uuid, it is possible to search for every version of an object that ever implemented
Or called a method, protocol, or referenced a static or global entity.
Once the webgl editor is nice enough with a subset of VI commands my fingers refuse to unlearn, I will probably stop using git entirely. this will mean implementing diff in Javascript, but someone has probably done that already.