Permalink
Browse files

start couch with mccouch in membase-server.sh

Couch options preparation code is taken from bin/couchdb in couchdb
distribution.

We also set +K true (which enables efficient socket polling) as set in
bin/couchdb.

Change-Id: Ib252517c77d4a3741324f2d34fe3923c5d6928ca
Reviewed-on: http://review.couchbase.org/7068
Reviewed-by: Dustin Sallings <dustin@spy.net>
Tested-by: Steve Yen <steve.yen@gmail.com>
  • Loading branch information...
1 parent d3c8c01 commit 018f2ffe70aef73dd28f2c831e2e17c9512c2e0b Aliaksey Kandratsenka committed with steveyen Jun 18, 2011
Showing with 48 additions and 4 deletions.
  1. +48 −4 membase-server.sh.in
View
@@ -1,8 +1,20 @@
#! /bin/sh
#
-# Copyright (c) 2010, Membase, Inc.
+# Copyright (c) 2011, Couchbase, Inc.
# All rights reserved
#
+# 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.
+
PATH="@PREFIX@/bin":$PATH
export PATH
@@ -32,17 +44,49 @@ then
exit 1
fi
-ERL_LIBS="@PREFIX@/lib/couchdb/erlang/lib:@PREFIX@/lib/ns_server/erlang/lib"
+ERL_LIBS="@PREFIX@/lib/couchdb/erlang/lib:@PREFIX@/lib/ns_server/erlang/lib:@PREFIX@/lib/couchdb/plugins"
export ERL_LIBS
-DONT_START_COUCH=1
-export DONT_START_COUCH
+DEFAULT_CONFIG_DIR="@PREFIX@/etc/couchdb/default.d"
+DEFAULT_CONFIG_FILE="@PREFIX@/etc/couchdb/default.ini"
+LOCAL_CONFIG_DIR="@PREFIX@/etc/couchdb/local.d"
+LOCAL_CONFIG_FILE="@PREFIX@/etc/couchdb/local.ini"
+
+couch_start_arguments=""
+
+_add_config_file () {
+ couch_start_arguments="$couch_start_arguments $1"
+}
+
+_add_config_dir () {
+ for file in "$1"/*.ini; do
+ if [ -r "$file" ]; then
+ _add_config_file "$file"
+ fi
+ done
+}
+
+_load_config () {
+ _add_config_file "$DEFAULT_CONFIG_FILE"
+ _add_config_dir "$DEFAULT_CONFIG_DIR"
+ _add_config_file "$LOCAL_CONFIG_FILE"
+ _add_config_dir "$LOCAL_CONFIG_DIR"
+ if [ "$COUCHDB_ADDITIONAL_CONFIG_FILE" != '' ]
+ then
+ _add_config_file "$COUCHDB_ADDITIONAL_CONFIG_FILE"
+ fi
+}
+
+_load_config
+
exec erl \
+A 16 \
+ +K true \
-setcookie nocookie \
-kernel inet_dist_listen_min 21100 inet_dist_listen_max 21299 \
$* \
-run ns_bootstrap -- \
+ -couch_ini $couch_start_arguments \
-ns_server config_path "\"@PREFIX@/etc/membase/static_config\"" \
-ns_server pidfile "\"@PREFIX@/var/lib/membase/membase-server.pid\""

0 comments on commit 018f2ff

Please sign in to comment.