Permalink
Browse files

Merge runtimeconfig branch back into trunk

git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@687336 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent ad6fd47 commit 2bc4be3dbf9e8ea3b67c62f2d99087ff4b43c17b @janl janl committed Aug 20, 2008
View
@@ -10,7 +10,7 @@
## License for the specific language governing permissions and limitations
## under the License.
-SUBDIRS = bin etc src share var
+SUBDIRS = bin etc src/couchdb src/mochiweb share test var
localdoc_DATA = AUTHORS.gz BUGS.gz CHANGES.gz NEWS.gz README.gz THANKS.gz
View
4 README
@@ -114,7 +114,7 @@ Note: All the examples assume you have installed into `/usr/local`.
If everything was successful you should see the following message:
- You have configured Apache CouchDB. Time to relax.
+ You have configured Apache CouchDB, time to relax.
Relax.
@@ -177,7 +177,7 @@ This uses the `sudo` command to run the `couchdb` command as the `couchdb` user.
When Apache CouchDB starts it should eventually display the following message:
- Apache CouchDB has started. Time to relax.
+ Apache CouchDB has started, time to relax. See http://localhost:5984/_utils/index.html
Relax.
View
@@ -26,7 +26,9 @@ RESPAWN_TIMEOUT=0
LIB_DIRECTORY=%localstatelibdir%
LOG_DIRECTORY=%localstatelogdir%
-INI_FILE=%localconfdir%/couch.ini
+DEFAULT_INI_FILE=%localconfdir%/default.ini
+LOCAL_INI_FILE=%localconfdir%/local.ini
+
PID_FILE=%localstatedir%/run/couchdb.pid
STDOUT_FILE=couchdb.stdout
@@ -70,10 +72,10 @@ Options:
-h display a short help message and exit
-V display version information and exit
- -c FILE set the configuration FILE (defaults to $INI_FILE)
+ -c FILE use configuration FILE (chainable, resets system default)
-i use the interactive Erlang shell
-b spawn as a background process
- -p FILE set the background PID FILE (defaults to $PID_FILE)
+ -p FILE set the background PID FILE (overrides system default)
-r SECONDS respawn background process after SECONDS (defaults to no respawn)
-o FILE redirect background stdout to FILE (defaults to $STDOUT_FILE)
-e FILE redirect background stderr to FILE (defaults to $STDERR_FILE)
@@ -105,7 +107,7 @@ check_status () {
PID=`_get_pid`
if test -n "$PID"; then
if kill -0 $PID 2> /dev/null; then
- echo "Apache CouchDB is running as process $PID. Time to relax."
+ echo "Apache CouchDB is running as process $PID, time to relax."
return $SCRIPT_OK
else
echo >&2 << EOF
@@ -168,6 +170,17 @@ start_couchdb () {
touch $PID_FILE
interactive_option="+Bd -noinput"
fi
+ if test -n "$INI_FILES"; then
+ ini_files="$INI_FILES"
+ else
+ ini_files="$DEFAULT_INI_FILE $LOCAL_INI_FILE"
+ fi
+ for file in $ini_files; do
+ if test -n "$start_arguments"; then
+ start_arguments="$start_arguments, ";
+ fi
+ start_arguments="$start_arguments \\\"$file\\\""
+ done
command="`%ICU_CONFIG% --invoke` \
%ERL% $interactive_option -smp auto -sasl errlog_type error \
-pa %localerlanglibdir%/couch-%version%/ebin \
@@ -177,13 +190,12 @@ start_couchdb () {
-eval \"application:load(couch)\" \
-eval \"crypto:start()\" \
-eval \"inets:start()\" \
- -eval \"couch_server:start(), receive done -> done end.\" \
- -couchini $INI_FILE"
+ -eval \"couch_server:start([$start_arguments]), receive done -> done end.\" "
if test "$BACKGROUND_BOOLEAN" = "true" \
-a "$RECURSED_BOOLEAN" = "false"; then
$0 -c $INI_FILE -b -r $RESPAWN_TIMEOUT -p $PID_FILE \
-o $STDOUT_FILE -e $STDERR_FILE -R &
- echo "Apache CouchDB has started. Time to relax."
+ echo "Apache CouchDB has started, time to relax."
else
if test "$RECURSED_BOOLEAN" = "true"; then
while true; do
@@ -257,7 +269,7 @@ parse_script_option_list () {
case "$1" in
-h) shift; display_help; exit $SCRIPT_OK;;
-V) shift; display_version; exit $SCRIPT_OK;;
- -c) shift; INI_FILE=$1; shift;;
+ -c) shift; INI_FILES="$INI_FILES $1"; shift;;
-i) shift; INTERACTIVE_BOOLEAN=true;;
-b) shift; BACKGROUND_BOOLEAN=true;;
-r) shift; RESPAWN_TIMEOUT=$1; shift;;
View
@@ -188,7 +188,7 @@ run_command_collection () {
run_autoconf
cat << EOF
-You have bootstrapped Apache CouchDB. Time to relax.
+You have bootstrapped Apache CouchDB, time to relax.
Run \`./configure' to configure the source before you install.
EOF
View
@@ -232,7 +232,7 @@ AC_CONFIG_FILES([bin/couchjs.tpl])
AC_CONFIG_FILES([bin/couchdb.tpl])
AC_CONFIG_FILES([bin/Makefile])
AC_CONFIG_FILES([etc/couchdb/Makefile])
-AC_CONFIG_FILES([etc/couchdb/couch.ini.tpl])
+AC_CONFIG_FILES([etc/couchdb/default.ini.tpl])
AC_CONFIG_FILES([etc/default/couchdb.tpl])
AC_CONFIG_FILES([etc/default/Makefile])
AC_CONFIG_FILES([etc/init/couchdb.tpl])
@@ -246,12 +246,12 @@ AC_CONFIG_FILES([share/Makefile])
AC_CONFIG_FILES([src/couchdb/couch.app.tpl])
AC_CONFIG_FILES([src/couchdb/Makefile])
AC_CONFIG_FILES([src/mochiweb/Makefile])
-AC_CONFIG_FILES([src/Makefile])
+AC_CONFIG_FILES([test/Makefile])
AC_CONFIG_FILES([var/Makefile])
AC_OUTPUT
echo
-echo "You have configured Apache CouchDB. Time to relax."
+echo "You have configured Apache CouchDB, time to relax."
echo
echo "Run \`make && make install' to install."
View
@@ -10,16 +10,16 @@
## License for the specific language governing permissions and limitations
## under the License.
-localconf_DATA = couch.ini
+couchprivlibdir = $(localerlanglibdir)/couch-$(version)/priv/lib
+
+localconf_DATA = default.ini
CLEANFILES = $(localconf_DATA)
transform = @program_transform_name@
couchjs_command_name = `echo couchjs | sed '$(transform)'`
-couchprivlibdir = $(localerlanglibdir)/couch-$(version)/priv/lib
-
-couch.ini: couch.ini.tpl
+default.ini: default.ini.tpl
sed -e "s|%bindir%|$(bindir)|g" \
-e "s|%localconfdir%|$(localconfdir)|g" \
-e "s|%localdatadir%|$(localdatadir)|g" \
@@ -28,3 +28,11 @@ couch.ini: couch.ini.tpl
-e "s|%couchprivlibdir%|$(couchprivlibdir)|g" \
-e "s|%couchjs_command_name%|$(couchjs_command_name)|g" \
< $< > $@
+
+install-data-hook:
+ if test ! -f "$(localconfdir)/local.ini"; then \
+ cp local.ini $(localconfdir)/local.ini; \
+ fi
+
+uninstall-local:
+ rm -f $(localconfdir)/local.ini
@@ -1,21 +0,0 @@
-[Couch]
-
-ConsoleStartupMsg=Apache CouchDB is starting.
-
-DbRootDir=%localstatelibdir%
-
-Port=5984
-
-BindAddress=127.0.0.1
-
-DocumentRoot=%localdatadir%/www
-
-LogFile=%localstatelogdir%/couch.log
-
-UtilDriverDir=%couchprivlibdir%
-
-LogLevel=info
-
-[Couch Query Servers]
-
-javascript=%bindir%/%couchjs_command_name% %localdatadir%/server/main.js
@@ -388,12 +388,12 @@ var tests = {
result = db.query(map, reduce, {startkey: i, endkey: numDocs - i});
T(result.rows[0].value == 2*(summate(numDocs-i) - summate(i-1)));
}
-
+
db.deleteDb();
db.createDb();
for(var i=1; i <= 5; i++) {
-
+
for(var j=0; j < 10; j++) {
// these docs are in the order of the keys collation, for clarity
var docs = [];
@@ -411,12 +411,12 @@ var tests = {
T(db.bulkSave(docs).ok);
T(db.info().doc_count == ((i - 1) * 10 * 11) + ((j + 1) * 11));
}
-
+
map = function (doc) {emit(doc.keys, 1)};
reduce = function (keys, values) { return sum(values); };
-
+
var results = db.query(map, reduce, {group:true});
-
+
//group by exact key match
T(equals(results.rows[0], {key:["a"],value:20*i}));
T(equals(results.rows[1], {key:["a","b"],value:20*i}));
@@ -432,7 +432,7 @@ var tests = {
var results = db.query(map, reduce, {group_level:1});
T(equals(results.rows[0], {key:["a"],value:70*i}));
T(equals(results.rows[1], {key:["d"],value:40*i}));
-
+
//group by the first 2 elements in the key array
var results = db.query(map, reduce, {group_level:2});
T(equals(results.rows[0], {key:["a"],value:20*i}));
@@ -443,21 +443,21 @@ var tests = {
T(equals(results.rows[5], {key:["d","b"],value:10*i}));
T(equals(results.rows[6], {key:["d","c"],value:10*i}));
}
-
+
// now test out more complex reductions that need to use the combine option.
-
+
db.deleteDb();
db.createDb();
-
+
var map = function (doc) {emit(doc.val, doc.val)};
var reduceCombine = function (keys, values, rereduce) {
// This computes the standard deviation of the mapped results
var stdDeviation=0.0;
var count=0;
var total=0.0;
var sqrTotal=0.0;
-
+
if (!rereduce) {
// This is the reduce phase, we are reducing over emitted values from
// the map functions.
@@ -467,7 +467,7 @@ var tests = {
}
count = values.length;
}
- else {
+ else {
// This is the rereduce phase, we are re-reducing previosuly
// reduced values.
for(var i in values) {
@@ -476,17 +476,18 @@ var tests = {
sqrTotal = sqrTotal + values[i].sqrTotal;
}
}
-
+
var variance = (sqrTotal - ((total * total)/count)) / count;
stdDeviation = Math.sqrt(variance);
-
+
// the reduce result. It contains enough information to be rereduced
// with other reduce results.
return {"stdDeviation":stdDeviation,"count":count,
"total":total,"sqrTotal":sqrTotal};
};
-
+
// Save a bunch a docs.
+
for(var i=0; i < 10; i++) {
var docs = [];
docs.push({val:10});
@@ -786,7 +787,7 @@ var tests = {
if (debug) debugger;
var numDocs = 500;
-
+
function makebigstring(power) {
var str = "a";
while(power-- > 0) {
View
@@ -1,13 +0,0 @@
-## Licensed under the Apache License, Version 2.0 (the "License"); you may not
-## use this file except in compliance with the License. You may obtain a copy
-## of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-## License for the specific language governing permissions and limitations
-## under the License.
-
-SUBDIRS = couchdb mochiweb
Oops, something went wrong.

0 comments on commit 2bc4be3

Please sign in to comment.