Sync in general is easy. First, have CouchDB somewhere. Then tune its settings a little to enable CORS. Then create a bucket inside your CouchDB and paste it’s URL into CloudWall DB sync settings. Save settings — and you are synced.
There are several common scenarios, that are described step by step.
Nearly any web-connected machine can run CouchDB. It works pretty fine even in a very lean environment — 256Mb, old Celeron and so on. CouchDB is very reliable and power-off resistant.
Download and install appropriate distributive of CouchDB to your server. It takes minute or two, really. Ensure CouchDB launches on OS start.
Note, that you need 1.7.1+ version of CouchDB, and persistent web connection with static IP or bound URL. If you decide to keep original 5984 Couch port untouched, you must open this port for net connections.
When CouchDB is installed, run it — and you’ll get browser open with CouchDB admin panel, one of below versions.
Auth config is required to avoid annoying browser popups when bowsers connects to Couch. CORS is a feature turning off end users’ cross origin sandboxes.
Both are tuned using link Configuration in Futon right panel. Go to config and edit/add some config vars. They are:
|headers||accept, authorization, content-type, origin|
Process is one copy-paste long in general and described in Quickstart manual.
First, you need to create a bucket in CouchDB. You can do it using CouchDB admin panel, don’t forget to set security bits.
Then, in CloudWall, click Add new DB button at the bottom of left panel, and type remote bucket URL in popup. Short form like
/dbname is also ok for buckets in the same domain.
You may also set sync direction and interval.
After clicking Create DB popup button, new local bucket is created and synced with the remote CouchDB bucket you added.
There are two cases of a restricted group: a) all can read and write, b) there are users in read-only mode.
If you trust enough all contributors, you can create single login and password and restrict CouchDB access. Then link you share will look like http://user:email@example.com:5984/db.
You can make many user account inside Couch and manage their access rights individually. CouchDB has built-in interfaces for it.
Unfortunately, in this way you can not restrict some users to be in read-only mode.
To restrict write access to your shared bucket for several users, you can create special-structured doc inside your server DB. In Futon (CouchDB admin panel) go to DB, click Create new doc, copy below code and save.
The code allows only users of
_admin group to write updates. You can change code and grant write permissions to other groups.
There is nothing special about installing CouchDB to Amazon EC2 instance — just deploy and run instance, download CouchDB and install. Open 5984 port and do all the steps above.
If you have 10-20 users — T2.micro is really enough. May be you’ll need to extend storage — default is about 8Gb.
You can use Smileupps CouchDB instances without any specialties, just deploy an instance and set it up as regular CouchDB. Then you can install CloudWall using replication. as described in Quickstart manual.
Note, that Smileupps charges on per-request basis, so keeping replications continuous may be costly.
Keeping your data synced is a good practice since CloudWall is permanent beta, it is built on top of many open-source libraries. Also it is an open platform — you can receive code, that impacts system stability.
So be smart and get your local DBs synced with external CouchDB if you keep sensitive data in browser.
Real-time continuous replication can be traffic-consuming — so if you work with docs, that need no immediate propagation, set replication interval to number greater than zero. This approach also helps to save money if you are connected to Cloudant or Smileupps.