summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore113
-rw-r--r--.rebar/templates/dev.template3
-rw-r--r--.rebar/templates/etc/default.ini123
-rw-r--r--.rebar/templates/make.template5
-rw-r--r--.rebar/templates/production.template8
-rw-r--r--.rebar/templates/rebar-dev.config14
-rw-r--r--.rebar/templates/rebar.config15
-rw-r--r--INSTALL.md33
-rw-r--r--LICENSE178
-rw-r--r--README.md108
-rw-r--r--apps/chttpd/Makefile10
-rwxr-xr-xapps/chttpd/rebarbin63470 -> 0 bytes
-rwxr-xr-xbootstrap5
-rwxr-xr-xconfigure51
14 files changed, 557 insertions, 109 deletions
diff --git a/.gitignore b/.gitignore
index 62e83a6e..ff1bc3d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,104 +1,19 @@
-*.beam
-*.gz
-*.tpl
*.o
-*.lo
-*.la
-*.m4
-*.in
-*~
-*.orig
-*.rej
+*.so
+*.Tpo
+*.beam
erl_crash.dump
-configure
-autom4te.cache
-build-aux
-*.diff
-
-# ./configure
+# building
+apps/*/ebin/
+rel/overlay/etc/default*.ini
+rel/dbcore
+rel/overlay/erts-vsn/bin/erl_call
Makefile
-bin/Makefile
-config.h
-config.log
-config.status
-etc/Makefile
-etc/couchdb/Makefile
-etc/default/Makefile
-etc/init/Makefile
-etc/launchd/Makefile
-etc/logrotate.d/Makefile
-libtool
-share/Makefile
-src/couchdb/.deps/*
-src/couchdb/Makefile
-src/couchdb/priv/Makefile
-src/mochiweb/Makefile
-stamp-h1
-test/.deps/
-test/Makefile
-test/javascript/run_js_tests.sh
-var/Makefile
-
-# for make
-
-bin/couchdb
-bin/couchdb.1
-bin/couchjs
-bin/couchjs.1
-etc/couchdb/default.ini
-etc/launchd/org.apache.couchdb.plist
-etc/logrotate.d/couchdb
-src/couchdb/.libs/*
-src/couchdb/couch.app
-src/couchdb/couchjs
-src/couchdb/edoc-info
-src/couchdb/erlang.png
-src/couchdb/stylesheet.css
-src/couchdb/priv/.deps/
-src/couchdb/priv/.libs/
-src/couchdb/priv/couch_icu_driver.la
-src/couchdb/priv/couchjs
-src/couchdb/priv/couchspawnkillable
-src/couchdb/priv/stat_descriptions.cfg
-src/erlang-oauth/oauth.app
-src/ibrowse/ibrowse.app
-src/mochiweb/mochiweb.app
-test/local.ini
-test/etap/run
-test/etap/test_util.erl
-test/javascript/run
-share/server/main.js
-
-# for make dev
-
-bin/.deps/
-bin/couchjs_dev
-bin/couchpw
-etc/couchdb/default_dev.ini
-etc/couchdb/local_dev.ini
-utils/run
-tmp
-src/couchdb/priv/stat_descriptions.cfg
-src/erlang-oauth/oauth.app
-src/ibrowse/ibrowse.app
-src/mochiweb/mochiweb.app
-test/etap/run
-
-# for make check
-
-test/etap/temp.*
-test/bench/run
-couchdb.stderr
-couchdb.stdout
-
-# for make cover
-
-cover/*
-INSTALL
-
-# for rebar
-
-apps/*/ebin
-apps/couch/priv/couch_icu_driver.so
+rebar.config
+# testing
+.eunit
+@abs_top_builddir@/
+apps/couch/test/temp*
+test/etap/
diff --git a/.rebar/templates/dev.template b/.rebar/templates/dev.template
new file mode 100644
index 00000000..91a97f2e
--- /dev/null
+++ b/.rebar/templates/dev.template
@@ -0,0 +1,3 @@
+{variables, [{base_dir, "/opt/dbcore"}]}.
+{template, "./etc/default.ini", "rel/overlay/etc/default.ini"}.
+{file, "rebar-dev.config", "rebar.config"}.
diff --git a/.rebar/templates/etc/default.ini b/.rebar/templates/etc/default.ini
new file mode 100644
index 00000000..d055217e
--- /dev/null
+++ b/.rebar/templates/etc/default.ini
@@ -0,0 +1,123 @@
+[couchdb]
+database_dir = {{data_dir}}
+view_index_dir = {{view_dir}}
+max_document_size = 67108864
+os_process_timeout = 5000
+max_dbs_open = 500
+max_view_index_lag = 9999999999
+delayed_commits = false
+
+[cluster]
+q=8
+r=2
+w=2
+n=3
+
+[chttpd]
+port = 5984
+backlog = 512
+docroot = {{core_dir}}/var/share/www
+
+[httpd]
+port = 5986
+bind_address = 0.0.0.0
+authentication_handlers = {couch_httpd_auth, cookie_authentication_handler}, {couch_httpd_auth, default_authentication_handler}
+default_handler = {couch_httpd_db, handle_request}
+WWW-Authenticate = Basic realm="Cloudant Private Database"
+backlog = 512
+secure_rewrites = true
+
+[log]
+file = /dev/null
+level = info
+
+[metrics]
+db = metrics_specs
+
+[couch_httpd_auth]
+authentication_redirect = /_utils/session.html
+authentication_db = users
+secret = replace this with a real secret in your local.ini file
+require_valid_user = false
+timeout = 600 ; number of seconds before automatic logout
+auth_cache_size = 50 ; size is number of cache entries
+
+[query_servers]
+javascript = {{core_dir}}/bin/couchjs {{core_dir}}/var/share/server/main.js
+
+[query_server_config]
+reduce_limit = true
+
+[daemons]
+view_manager={couch_view, start_link, []}
+external_manager={couch_external_manager, start_link, []}
+query_servers={couch_query_servers, start_link, []}
+httpd={couch_httpd, start_link, []}
+stats_aggregator={couch_stats_aggregator, start, []}
+stats_collector={couch_stats_collector, start, []}
+uuids={couch_uuids, start, []}
+auth_cache={couch_auth_cache, start_link, []}
+
+[httpd_global_handlers]
+/ = {couch_httpd_misc_handlers, handle_welcome_req, <<"Welcome">>}
+favicon.ico = {couch_httpd_misc_handlers, handle_favicon_req, "{{core_dir}}/var/share/www"}
+
+_utils = {couch_httpd_misc_handlers, handle_utils_dir_req, "{{core_dir}}/var/share/www"}
+_all_dbs = {couch_httpd_misc_handlers, handle_all_dbs_req}
+_active_tasks = {couch_httpd_misc_handlers, handle_task_status_req}
+_config = {couch_httpd_misc_handlers, handle_config_req}
+_replicate = {couch_httpd_misc_handlers, handle_replicate_req}
+_uuids = {couch_httpd_misc_handlers, handle_uuids_req}
+_restart = {couch_httpd_misc_handlers, handle_restart_req}
+_stats = {couch_httpd_stats_handlers, handle_stats_req}
+_log = {couch_httpd_misc_handlers, handle_log_req}
+_session = {couch_httpd_auth, handle_session_req}
+_oauth = {couch_httpd_oauth, handle_oauth_req}
+_user = {couch_httpd_auth, handle_user_req}
+_metrics = {couch_httpd_metrics_handlers, handle_metrics_req}
+_system = {chttpd_misc, handle_system_req}
+
+_cloudant = {showroom_httpd_admin, handle_cloudant_req}
+_membership = {membership_httpd, handle_membership_req}
+
+[httpd_db_handlers]
+_view_cleanup = {couch_httpd_db, handle_view_cleanup_req}
+_compact = {couch_httpd_db, handle_compact_req}
+_design = {couch_httpd_db, handle_design_req}
+_temp_view = {couch_httpd_view, handle_temp_view_req}
+_changes = {couch_httpd_db, handle_changes_req}
+_search = {couch_httpd_external, handle_external_req, <<"search">>}
+
+[httpd_design_handlers]
+_view = {couch_httpd_view, handle_view_req}
+_show = {couch_httpd_show, handle_doc_show_req}
+_list = {couch_httpd_show, handle_view_list_req}
+_info = {couch_httpd_db, handle_design_info_req}
+_rewrite = {couch_httpd_rewrite, handle_rewrite_req}
+_update = {couch_httpd_show, handle_doc_update_req}
+
+[uuids]
+; Known algorithms:
+; random - 128 bits of random awesome
+; All awesome, all the time.
+; sequential - monotonically increasing ids with random increments
+; First 26 hex characters are random. Last 6 increment in
+; random amounts until an overflow occurs. On overflow, the
+; random prefix is regenerated and the process starts over.
+; utc_random - Time since Jan 1, 1970 UTC with microseconds
+; First 14 characters are the time in hex. Last 18 are random.
+algorithm = sequential
+
+[stats]
+; rate is in milliseconds
+rate = 1000
+; sample intervals are in seconds
+samples = [0, 60, 300, 900]
+
+[attachments]
+compression_level = 8 ; from 1 (lowest, fastest) to 9 (highest, slowest), 0 to disable compression
+compressible_types = text/*, application/javascript, application/json, application/xml
+
+[replicator]
+max_http_sessions = 10
+max_http_pipeline_size = 10 \ No newline at end of file
diff --git a/.rebar/templates/make.template b/.rebar/templates/make.template
new file mode 100644
index 00000000..2c40ba37
--- /dev/null
+++ b/.rebar/templates/make.template
@@ -0,0 +1,5 @@
+{variables, [{prefix, "/opt"},
+ {data, "/srv/db"},
+ {view, "/srv/view_index"},
+ {user, "dbcore"}]}.
+{template, "./Makefile", "Makefile"}.
diff --git a/.rebar/templates/production.template b/.rebar/templates/production.template
new file mode 100644
index 00000000..d4090266
--- /dev/null
+++ b/.rebar/templates/production.template
@@ -0,0 +1,8 @@
+{variables, [{prefix, "{{prefix}}"},
+ {core_dir, "{{prefix}}/dbcore"},
+ {data_dir, "/srv/db"},
+ {view_dir, "/srv/view_index"}]}.
+{template, "./etc/default.ini", "rel/overlay/etc/default.ini"}.
+{file, "rebar.config", "rebar.config"}.
+{file, "/usr/local/lib/erlang/lib/erl_interface-3.6.5/bin/erl_call", "rel/overlay/erts-vsn/bin/erl_call"}.
+{chmod, 8#755, "rel/overlay/erts-vsn/bin/erl_call"}.
diff --git a/.rebar/templates/rebar-dev.config b/.rebar/templates/rebar-dev.config
new file mode 100644
index 00000000..8d0e3966
--- /dev/null
+++ b/.rebar/templates/rebar-dev.config
@@ -0,0 +1,14 @@
+{sub_dirs, [
+ "apps/chttpd",
+ "apps/couch",
+ "apps/etap",
+ "apps/fabric",
+ "apps/ibrowse",
+ "apps/mem3",
+ "apps/mochiweb",
+ "apps/oauth",
+ "apps/rexi",
+ "apps/showroom",
+ "rel"
+]}.
+{erl_opts, [debug_info]}. \ No newline at end of file
diff --git a/.rebar/templates/rebar.config b/.rebar/templates/rebar.config
new file mode 100644
index 00000000..e83927a9
--- /dev/null
+++ b/.rebar/templates/rebar.config
@@ -0,0 +1,15 @@
+{sub_dirs, [
+ "apps/chttpd",
+ "apps/couch",
+ "apps/etap",
+ "apps/fabric",
+ "apps/ibrowse",
+ "apps/mem3",
+ "apps/mochiweb",
+ "apps/oauth",
+ "apps/rexi",
+ "apps/showroom",
+ "rel"
+]}.
+{cover_enabled, true}.
+{erl_opts, [debug_info, fail_on_warning]}.
diff --git a/INSTALL.md b/INSTALL.md
new file mode 100644
index 00000000..ac60f41a
--- /dev/null
+++ b/INSTALL.md
@@ -0,0 +1,33 @@
+1. Getting Started
+
+Cloudant-core uses a rebar-based build system. Custom build paths and the like
+are available using templates. If you want to customize those templates, run
+the `bootstrap` command to install the defaults into ~/.rebar and go from there.
+This step is optional.
+
+2. Dependencies
+
+ * Erlang R13B03 or higher
+ * ICU (4.2 is preferable)
+ * Spidermonkey (1.9.2 preferable, [https://launchpad.net/~commonjs/+archive/ppa/][6]) and symlink /usr/lib/libmozjs-1.9.2.so to /usr/lib/libmozjs.so to make things easier
+ * OpenSSL
+ * make
+
+On OS X the Erlang and ICU dependencies are easily satisfied by Homebrew:
+
+ brew install erlang icu4c
+ brew ln icu4c
+
+Once the dependencies are installed you can use `make` to build the code,
+`make check` to run unit tests, and `make clean` to reset.
+
+3. Release Generation
+
+The `make dist` command will build a standard release in `rel/dbcore`. The
+release includes a start script at `rel/dbcore/bin/dbcore`
+
+4. Caveats
+
+The build system really really wants the couch .ini files to be in
+`/opt/dbcore/etc`, and the data files to be in `/srv`. It wouldn't be too
+difficult to template this. But for now, the recommended installation is to move the rel/dbcore folder to /opt/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..e454a525
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,178 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..183fc670
--- /dev/null
+++ b/README.md
@@ -0,0 +1,108 @@
+## cloudant-dbcore
+
+### Overview
+
+Cloudant-dbcore is a highly available, fault-tolerant, clustered, fully api-compliant version of [Apache CouchDB][1]. While it appears to the end-user as one CouchDB instance, it is in fact one or more nodes in an elastic cluster, acting in concert to store and retrieve documents, index and serve views, and serve CouchApps. Dbcore has been developed and is continually maintained by [Cloudant][2] who offer hosted CouchDB as a service.
+
+Clusters behave according to concepts outlined in [Amazon's Dynamo paper][4], namely that each node can accept requests, data is placed on partitions based on a consistent hashing algorithm, and quorum protocols are for read/write operations.
+
+### Contents
+
+ * README.md this file
+ * INSTALL instructions on how to install dbcore
+ * LICENSE open-source license governing dbcore
+
+### Getting Started
+
+For detailed installation instructions, please consult the INSTALL file
+
+#### Prerequisites
+
+ * Erlang R13B03 or higher
+ * ICU (4.2 is preferable)
+ * Spidermonkey (1.9.2 preferable, [https://launchpad.net/~commonjs/+archive/ppa/][6]) and symlink /usr/lib/libmozjs-1.9.2.so to /usr/lib/libmozjs.so to make things easier
+ * OpenSSL
+ * make
+
+#### Building and installing dbcore
+
+`$CLOUDANT_SRC` is the directory holding your downloaded source files, while `$CLOUDANT_PREFIX` is the prefix to which the software is installed (defaults to `/opt`):
+
+ $ cd $CLOUDANT_SRC
+ $ ./configure -p $CLOUDANT_PREFIX
+ $ make
+ $ sudo make install
+
+#### Starting dbcore
+
+ $ $CLOUDANT_PREFIX/dbcore/bin/dbcore
+
+Now, visit http://localhost:5984/_utils in a browser to verify the CouchDB node is operational.
+
+Note: see the rel/sv/README file for information on using runit to stop/start dbcore.
+
+#### Joining a new node to the cluster
+
+First, dbcore listens on two ports. Defaults and explanations:
+
+ * 5984 - front door, cluster-aware port, appears as a standalone CouchDB.
+ * 5986 - back door, single-node port, used for admin functions
+
+Next, once the first node is started, and assuming its hostname is 'node1_host' start dbcore on another node, with hostname 'node2_host'. Once it's started successfully, on node1_host, join the new node:
+ $ curl -X PUT http://localhost:5986/nodes/dbcore@node2_host -d {}
+
+To verify the two-node cluster has been linked properly, on either node, try:
+ $ curl http://locahost:5984/_membership
+
+You should see something similar to this:
+ {"all_nodes":["dbcore@node1_host","dbcore@node2_host"],"cluster_nodes":["dbcore@node1_host","dbcore@node2_host"]}
+
+#### Now What?
+
+If the above steps were successful, you should have a running dbcore cluster that looks just like a standalone CouchDB. You may interact with it the same way you would a standalone CouchDB, via the HTTP REST interface.
+
+Because every node can handle requests equally, you may want to put a load balancer in front of the cluster and set up a round-robin strategy for distributing incoming requests across all of your cluster's nodes.
+
+##### Create a database:
+
+ curl -X PUT http://loadbalancer:5984/test_db
+
+Also note that 'q' and 'n' are query string arguments that may be specified. These are Cloudant-specific options, and their values and defaults are discussed in the Configuration section below. Ex: &q=12 or &n=4.
+
+##### Create a document:
+
+ curl -X PUT http://loadbalancer:5984/test_db/doc_1 -d '{"a":1,"b":2}'
+
+You may also provide 'r' and 'w' on the GET and PUT/POST document operations respectively. Their values and defaults are discussed in the Configuration section below. Ex: &r=3 for high consistency reads, or &w=1 for higher throughput writes.
+
+##### Check out Futon, CouchDB's web UI:
+
+ * [http://loadbalancer:5984/_utils][5]
+
+### Configuration
+
+#### Cluster constants
+
+_Q_ - number of partitions per database. Q is specified in the default.ini file, but may be provided as a URL parameter when creating a database. Default value is 8, query parameter is &q=12 or similar.
+
+_N_ - replication constant. N defaults to 3, but can vary by database just as Q can vary. N copies of each document will be written to the data store, on N different nodes.
+
+_R_ - read quorum constant. N writes have occurred for each document, as noted above. When reads are requested, N reads are sent to the N nodes that store the particular document. The system will return to the requesting client with the document when R successful reads have returned, and agree on versioning. R defaults to 2. Lower R values often result in faster reads at the expense of consistency. Higher R values usually result in slower reads, but more consistent, or agreed-upon data values returning.
+
+_W_ - write quorum constant. When writing the N copies, the data store will respond to the write client after W successful writes have completed. The remaining N-W writes are still being attempted in the background, but the client receives a 201 Created status and can resume execution. W defaults to 2. Lower W values mean more write throughput, and higher W values mean more data durability.
+
+### Contact
+
+Cloudant folks are usually hanging out in IRC. Freenode, channel #cloudant. We may also be reached:
+
+ * [http://cloudant.com][2]
+ * [info@cloudant.com][3]
+
+----
+
+[1]: http://couchdb.apache.org
+[2]: http://cloudant.com
+[3]: mailto:info@cloudant.com
+[4]: http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html
+[5]: http://loadbalancer:5984/_utils
+[6]: https://launchpad.net/~commonjs/+archive/ppa/
diff --git a/apps/chttpd/Makefile b/apps/chttpd/Makefile
deleted file mode 100644
index 206156f9..00000000
--- a/apps/chttpd/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-all: compile
-
-compile:
- @./rebar compile
-
-clean:
- @./rebar clean
-
-compilenative:
- @./rebar compile erl_opts=native
diff --git a/apps/chttpd/rebar b/apps/chttpd/rebar
deleted file mode 100755
index 68e1ec23..00000000
--- a/apps/chttpd/rebar
+++ /dev/null
Binary files differ
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 00000000..a3fa7a2d
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# copy templates into place
+echo "copying default rebar templates to ~/.rebar"
+cp -R .rebar ~/
diff --git a/configure b/configure
new file mode 100755
index 00000000..e758f798
--- /dev/null
+++ b/configure
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+function quit {
+ exit
+}
+
+PREFIX="/opt"
+TEMPLATE="production"
+DATA="/srv/db"
+VIEW="/srv/view_index"
+DBCORE_USER=`whoami`
+
+while [ $# -gt 0 ]
+do
+ case $1
+ in
+ -p)
+ PREFIX=$2
+ shift 2
+ ;;
+ -t)
+ TEMPLATE=$2
+ shift 2
+ ;;
+ -d)
+ DATA=$2
+ shift 2
+ ;;
+ -v)
+ VIEW=$2
+ shift 2
+ ;;
+ -u)
+ DBCORE_USER=$2
+ shift 2
+ ;;
+ *)
+ echo "usage: $0 [-p {prefix} -t {template} -d {data_dir} -v {view_dir} -u {user}]"
+ quit
+ ;;
+ esac
+done
+
+
+echo "configuring dbcore"
+
+rm -f rebar.config
+# Makefile
+./rebar create template=make prefix=$PREFIX data=$DATA view=$VIEW user=$DBCORE_USER force=1
+# dbcore template
+./rebar create template=$TEMPLATE prefix=$PREFIX force=1