Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
lay down cloudant build system.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Anderson authored and kocolosk committed Aug 18, 2010
1 parent 6d18638 commit bb9e2ce
Show file tree
Hide file tree
Showing 14 changed files with 557 additions and 109 deletions.
113 changes: 14 additions & 99 deletions .gitignore
@@ -1,104 +1,19 @@
*.beam
*.gz
*.tpl
*.o *.o
*.lo *.so
*.la *.Tpo
*.m4 *.beam
*.in
*~
*.orig
*.rej
erl_crash.dump 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 Makefile
bin/Makefile rebar.config
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


# testing
.eunit
@abs_top_builddir@/
apps/couch/test/temp*
test/etap/
3 changes: 3 additions & 0 deletions .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"}.
123 changes: 123 additions & 0 deletions .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
5 changes: 5 additions & 0 deletions .rebar/templates/make.template
@@ -0,0 +1,5 @@
{variables, [{prefix, "/opt"},
{data, "/srv/db"},
{view, "/srv/view_index"},
{user, "dbcore"}]}.
{template, "./Makefile", "Makefile"}.
8 changes: 8 additions & 0 deletions .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"}.
14 changes: 14 additions & 0 deletions .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]}.
15 changes: 15 additions & 0 deletions .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]}.
33 changes: 33 additions & 0 deletions 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/

0 comments on commit bb9e2ce

Please sign in to comment.