Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

implemented make install with new directory layout

We now have very simple configure script that accepts prefix. And we
expect membase binaries (memcached, moxi) in that prefix.

We also install ns_server into that prefix. Directory layout is
similar to couchdb. .beams go to
$(prefix)/lib/ns_server/erlang/lib/ns_server. Data goes to
$(prefix)/var/lib/membase. Static config files (like "init.sql") go to
$(prefix)/etc/membase

Change-Id: I656bf3bbbe09494e1fab96b6d33293b2d91a22ca
Reviewed-on: http://review.membase.org/5268
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
  • Loading branch information...
commit 0963a0ff952eaa16ff7593b35172ce6f4279f77f 1 parent cf87b02
@alk alk authored alk committed
View
1  .gitignore
@@ -1,6 +1,7 @@
*.beam
*~
.DS_Store
+.configuration
.eunit
.project
.settings
View
78 Makefile
@@ -22,8 +22,20 @@ REBAR=./rebar
# up-to-date
.PHONY: $(TMP_VER)
+ifneq (,$(wildcard .configuration))
all: ebins deps_all priv/public/js/all-images.js
+fail-unless-configured:
+ @true
+
+else
+all fail-unless-configured:
+ @echo
+ @echo "you need to run ./configure with --prefix option to be able to run ns_server"
+ @echo
+ @false
+endif
+
deps_smtp:
(cd deps/gen_smtp && $(MAKE) ebins)
@@ -52,43 +64,46 @@ $(TMP_VER):
test -d $(TMP_DIR) || mkdir $(TMP_DIR)
git describe | sed s/-/_/g > $(TMP_VER)
-ifdef PREFIX
-
REST_PREFIX := $(PREFIX)
NS_SERVER := $(PREFIX)/ns_server
-install:
- mkdir -p $(NS_SERVER)
- tar cf - cluster_connect cluster_run scripts/mkcouch.sh mbcollect_info \
- ebin \
- deps/*/ebin \
- deps/*/deps/*/ebin \
- priv/public \
- deps/erlwsh/priv | (cd $(PREFIX)/ns_server && tar xf -)
- mkdir -p ns_server/bin ns_server/lib/memcached
- ln -f -s $(REST_PREFIX)/bin/memcached $(NS_SERVER)/bin/memcached || true
- ln -f -s $(REST_PREFIX)/lib/memcached/default_engine.so $(NS_SERVER)/lib/memcached/default_engine.so || true
- ln -f -s $(REST_PREFIX)/lib/memcached/stdin_term_handler.so $(NS_SERVER)/lib/memcached/stdin_term_handler.so || true
- mkdir -p $(NS_SERVER)/bin/bucket_engine
- ln -f -s $(REST_PREFIX)/lib/bucket_engine.so $(NS_SERVER)/bin/bucket_engine/bucket_engine.so || true
- mkdir -p $(NS_SERVER)/bin/ep_engine
- ln -f -s $(REST_PREFIX)/lib/ep.so $(NS_SERVER)/bin/ep_engine/ep.so || true
- mkdir -p $(NS_SERVER)/bin/moxi
- ln -f -s $(REST_PREFIX)/bin/moxi $(NS_SERVER)/bin/moxi/moxi || true
- mkdir -p $(NS_SERVER)/bin/vbucketmigrator
- ln -f -s $(REST_PREFIX)/bin/vbucketmigrator $(NS_SERVER)/bin/vbucketmigrator/vbucketmigrator || true
+install: all $(TMP_VER) fail-unless-configured
+ $(MAKE) do-install "NS_SERVER_VER=$(strip $(shell cat $(TMP_VER)))" "PREFIX=$(strip $(shell . `pwd`/.configuration && echo $$prefix))"
+ifdef NS_SERVER_VER
+
+ifeq (,$(PREFIX))
+$(error "need PREFIX defined")
endif
-bdist: clean ebins deps_all
- (cd .. && tar cf - \
- ns_server/mbcollect_info \
- ns_server/ebin \
- ns_server/deps/*/ebin \
- ns_server/priv/public \
- ns_server/deps/erlwsh/priv | gzip -9 -c > \
- ns_server/ns_server_`cat ns_server/$(TMP_VER)`.tar.gz )
- echo created ns_server_`cat $(TMP_VER)`.tar.gz
+NS_SERVER_LIBDIR := $(PREFIX)/lib/ns_server/erlang/lib/ns_server-$(NS_SERVER_VER)
+ERLWSH_LIBDIR := $(PREFIX)/lib/ns_server/erlang/lib/erlwsh
+GEN_SMTP_LIBDIR := $(PREFIX)/lib/ns_server/erlang/lib/gen_smtp
+MOCHIWEB_LIBDIR := $(PREFIX)/lib/ns_server/erlang/lib/mochiweb
+
+do-install:
+ echo $(PREFIX)
+ mkdir -p $(NS_SERVER_LIBDIR)
+ cp -r ebin $(NS_SERVER_LIBDIR)/
+ mkdir -p $(NS_SERVER_LIBDIR)/priv
+ cp -r priv/public $(NS_SERVER_LIBDIR)/priv/
+ mkdir -p $(ERLWSH_LIBDIR)
+ cp -r deps/erlwsh/ebin $(ERLWSH_LIBDIR)/
+ cp -r deps/erlwsh/priv $(ERLWSH_LIBDIR)/
+ @true mkdir -p $(GEN_SMTP_LIBDIR)
+ @true cp -r deps/gen_smtp/ebin $(GEN_SMTP_LIBDIR)/
+ mkdir -p $(MOCHIWEB_LIBDIR)
+ cp -r deps/mochiweb/ebin $(MOCHIWEB_LIBDIR)/
+ mkdir -p $(PREFIX)/etc/membase
+ sed -e 's|@PREFIX@|$(PREFIX)|g' <etc/static_config.in >$(PREFIX)/etc/membase/static_config
+ touch $(PREFIX)/etc/membase/config
+ sed -e 's|@PREFIX@|$(PREFIX)|g' <membase-server.sh.in >$(PREFIX)/bin/membase-server
+ chmod +x $(PREFIX)/bin/membase-server
+ mkdir -p $(PREFIX)/var/lib/membase/mnesia
+ mkdir -p $(PREFIX)/var/lib/membase/logs
+ cp priv/init.sql $(PREFIX)/etc/membase/
+
+endif
clean clean_all:
@(cd deps/gen_smtp && $(MAKE) clean)
@@ -105,6 +120,7 @@ clean clean_all:
rm -rf ebin
rm -rf docs
+# TODO: adjust
dataclean:
rm -rf $(TMP_DIR)
rm -rf Mnesia*
View
19 cluster_run
@@ -8,7 +8,7 @@ def testament_child_death():
os._exit(0)
os.waitpid(rv, os.WUNTRACED)
-COUCH_PATH = "lib/couchdb"
+PREFIX = subprocess.Popen(". $(pwd)/.configuration && echo $prefix", shell = True, stdout=subprocess.PIPE).communicate()[0].rstrip()
def setup_path():
def ebin_search(path):
@@ -16,7 +16,7 @@ def setup_path():
stdout=subprocess.PIPE).communicate()[0].split()
path = ebin_search(".")
- couchpath = ebin_search("{0}/lib/couchdb/erlang/lib".format(COUCH_PATH))
+ couchpath = ebin_search("{0}/lib/couchdb/erlang/lib".format(PREFIX))
if len(couchpath) == 0:
print("Couch libs wasn't found. Will disable couch support\n")
@@ -38,17 +38,26 @@ def start_cluster(num_nodes, extra_args):
os.makedirs(logdir)
except:
pass
+ try:
+ os.stat("data/n_{0}/mnesia".format(i))
+ except:
+ os.makedirs("data/n_{0}/mnesia".format(i))
subprocess.Popen(["./scripts/mkcouch.sh", "n_{0}".format(i), str(base_couch_port + i)]).communicate()
args = ["erl", "+A", "16", "-pa"] + ebin_path + [
"-setcookie", "nocookie",
"-kernel", "inet_dist_listen_min", "21100",
"inet_dist_listen_max", "21199",
- "-couch_ini", "{0}/etc/couchdb/default.ini".format(COUCH_PATH), "couch/n_{0}_conf.ini".format(i),
- "-ns_server", "error_logger_mf_dir", '"{0}"'.format(logdir),
+ "-couch_ini", "{0}/etc/couchdb/default.ini".format(PREFIX), "couch/n_{0}_conf.ini".format(i),
+ "-ns_server", "config_path", '"etc/static_config.in"',
+ "error_logger_mf_dir", '"{0}"'.format(logdir),
"error_logger_mf_maxbytes", "10485760",
"error_logger_mf_maxfiles", "10",
"dont_suppress_stderr_logger", "true",
- "path_prefix", '"n_{0}"'.format(i),
+ "path_config_etcdir", '"priv"',
+ "path_config_bindir", '"{0}"'.format(PREFIX+"/bin"),
+ "path_config_libdir", '"{0}"'.format(PREFIX+"/lib"),
+ "path_config_datadir", '"data/n_{0}"'.format(i),
+ "path_config_tmpdir", '"tmp/"',
"rest_port", str(base_api_port + i),
"memcached_port", str(base_direct_port + i * 2),
"moxi_port", str(base_direct_port + i * 2 + 1),
View
52 configure
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+usage() {
+cat <<EOF
+\`$0' configures ns_server to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]...
+
+Configuration:
+ -h, --help display this help and exit
+
+Installation directories:
+ --prefix=PREFIX install files in PREFIX (required)
+
+EOF
+}
+
+prefix=
+for config_arg do
+ case "$config_arg" in
+ --help|-h)
+ usage
+ exit 0
+ ;;
+ --prefix=/*)
+ prefix=${config_arg##--prefix=}
+ ;;
+ --prefix=*)
+ echo "--prefix needs to be absolute path"
+ exit 1
+ ;;
+ *)
+ echo "Unkown option: ${config_arg}"
+ exit 1
+ ;;
+ esac
+done
+
+if test -z "$prefix" ; then
+ usage
+ echo "Error: --prefix option is required"
+ exit 1
+fi
+
+cat <<EOF >${0%"${0##*/}"}/.configuration
+prefix=$prefix
+EOF
+
+echo
+echo "Membase management server is configured and is ready to be built!"
+echo "PREFIX: ${prefix}"
+echo
View
8 etc/static_config.in
@@ -0,0 +1,8 @@
+{error_logger_mf_dir, "@PREFIX@/var/lib/membase/logs"}.
+{error_logger_mf_maxbytes, 10485760}.
+{error_logger_mf_maxfiles, 10}.
+{path_config_bindir, "@PREFIX@/bin"}.
+{path_config_etcdir, "@PREFIX@/etc/membase"}.
+{path_config_libdir, "@PREFIX@/lib"}.
+{path_config_datadir, "@PREFIX@/var/lib/membase"}.
+{path_config_tmpdir, "@PREFIX@/var/lib/membase/tmp"}.
View
33 membase-server.sh.in
@@ -0,0 +1,33 @@
+#! /bin/sh
+#
+# Copyright (c) 2010, Membase, Inc.
+# All rights reserved
+#
+PATH="@PREFIX@/bin":$PATH
+export PATH
+
+datadir="@PREFIX@/var/lib/membase"
+
+test -d "$datadir" || mkdir -p "$datadir"
+cd "$datadir"
+
+# Initialize distributed erlang on the system (i.e. epmd)
+erl -noshell -setcookie nocookie -sname init -run init stop 2>&1 > /dev/null
+if [ $? -ne 0 ]
+then
+ exit 1
+fi
+
+ERL_LIBS="@PREFIX@/lib/couchdb/erlang/lib:@PREFIX@/lib/ns_server/erlang/lib"
+export ERL_LIBS
+
+set -x
+
+exec erl \
+ +A 16 \
+ -setcookie nocookie \
+ -kernel inet_dist_listen_min 21100 inet_dist_listen_max 21199 \
+ $* \
+ -run ns_bootstrap -- \
+ -ns_server config_path "\"@PREFIX@/etc/membase/static_config\"" \
+ -ns_server pidfile "\"@PREFIX@/var/lib/membase/membase-server.pid\""
View
6 src/dist_manager.erl
@@ -34,11 +34,7 @@ start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
ip_config_path() ->
- %% this smells bad, but we live higher on supervisor/process
- %% hierarchy than ns_config, so I see no other way
- {ok, CfgPath} = application:get_env(ns_server, ns_server_config),
- Path = filename:dirname(CfgPath),
- filename:join(Path, "ip").
+ path_config:component_path(data, "ip").
strip_full(String) ->
String2 = string:strip(String),
View
3  src/mb_mnesia.erl
@@ -446,6 +446,7 @@ is_mnesia_running() ->
%% @doc Start mnesia and wait for it to come up.
start_mnesia() ->
+ application:set_env(mnesia, dir, path_config:component_path(data, "mnesia")),
ok = mnesia:start(),
{ok, _} = mnesia:subscribe(system),
{ok, _} = mnesia:subscribe({table, schema, simple}),
@@ -454,7 +455,7 @@ start_mnesia() ->
%% @doc Hack.
tmpdir() ->
- ns_config_default:default_path("tmp").
+ path_config:component_path(tmp).
tmpdir(Filename) ->
View
2  src/menelaus_util.erl
@@ -233,7 +233,7 @@ pipe_through_command_rec(Port, Acc) ->
%% this is NOT secure, because I cannot make erlang ports work as
%% popen. We're missing ability to close write side of the port.
insecure_pipe_through_command(Command, IOList) ->
- TmpFile = filename:join(ns_config_default:default_path("tmp"),
+ TmpFile = filename:join(path_config:component_path(tmp),
"pipethrough." ++ integer_to_list(erlang:phash2([self(), os:getpid(), timestamp]))),
filelib:ensure_dir(TmpFile),
file:write_file(TmpFile, IOList),
View
6 src/ns_config.erl
@@ -611,9 +611,9 @@ load_file(bin, ConfigPath) ->
end.
save_file(bin, ConfigPath, X) ->
- TempFile = ns_config_default:tempfile(filename:dirname(ConfigPath),
- filename:basename(ConfigPath),
- ".tmp"),
+ TempFile = path_config:tempfile(filename:dirname(ConfigPath),
+ filename:basename(ConfigPath),
+ ".tmp"),
{ok, F} = file:open(TempFile, [write, raw]),
ok = file:write(F, term_to_binary(X)),
ok = file:sync(F),
View
112 src/ns_config_default.erl
@@ -15,94 +15,7 @@
%%
-module(ns_config_default).
--export([default/0, mergable/1,
- default_path/1,
- default_root_path/0,
- find_root/1, is_root/1,
- tempfile/2, tempfile/3]).
-
-default_path(Name) ->
- RootPath = default_root_path(),
- NamePath = filename:join(RootPath, Name),
- Path = case application:get_env(path_prefix) of
- undefined ->
- NamePath;
- {ok, Prefix} ->
- filename:join(NamePath, Prefix)
- end,
- ok = filelib:ensure_dir(Path),
- Path.
-
-% Returns the directory that best represents the product 'root'
-% install directory. In development, that might be the ns_server
-% directory. On windows, at install, that might be the
-% C:/Program Files/Membase/Server.
-% On linux, /opt/membase/<ver>/
-
-default_root_path() ->
- % When installed, we live in something that looks like...
- %
- % C:/Program Files/Membase/Server/
- % bin/
- % ns_server/ebin/ns_config_default.beam
- % priv/
- % config
- % data/ (installer created)
- %
- % /opt/membase/<ver>/
- % bin/
- % ns_server/ebin/ns_config_default.beam
- % data/ (installer created)
- %
- % /some/dev/work/dir/ns_server/
- % .git/
- % bin/
- % ebin/ns_config_default.beam
- % priv/
- % config
- % data/ (dynamically created)
- %
- P1 = filename:absname(code:which(ns_config_default)), % Our beam path.
- P2 = filename:dirname(P1), % "ebin"
- P3 = filename:dirname(P2), % "ns_server" (possibly)
- RootPath = case find_root(P3) of
- false -> filename:dirname(filename:dirname(P3));
- X -> X
- end,
- RootPath.
-
-% Go up dir paths and find a development root dir.
-
-find_root("") -> false;
-find_root(".") -> false;
-find_root("/") -> false;
-find_root(DirPath) ->
- case is_root(DirPath) of
- true -> DirPath;
- false -> DirNext = filename:dirname(DirPath),
- % Case when "c:/" =:= "c:/" on windows.
- case DirNext =/= DirPath of
- true -> find_root(DirNext);
- false -> false
- end
- end.
-
-tempfile(Dir, Prefix, Suffix) ->
- {_, _, MicroSecs} = erlang:now(),
- Pid = os:getpid(),
- Filename = Prefix ++ integer_to_list(MicroSecs) ++ "_" ++
- Pid ++ Suffix,
- filename:join(Dir, Filename).
-
-tempfile(Prefix, Suffix) ->
- Dir = ns_config_default:default_path("tmp"),
- tempfile(Dir, Prefix, Suffix).
-
-% Is a development root dir?
-
-is_root(DirPath) ->
- filelib:is_dir(filename:join(DirPath, "bin")) andalso
- filelib:is_dir(filename:join(DirPath, "priv")).
+-export([default/0, mergable/1]).
% Allow all keys to be mergable.
@@ -115,9 +28,7 @@ keys(KVLists) ->
end, KVLists).
default() ->
- {ok, ConfigFile} = application:get_env(ns_server_config),
- ConfigDir = filename:dirname(ConfigFile),
- RawDbDir = default_path("data"),
+ RawDbDir = path_config:component_path(data),
filelib:ensure_dir(RawDbDir),
file:make_dir(RawDbDir),
DbDir = case misc:realpath(RawDbDir, "/") of
@@ -129,7 +40,7 @@ default() ->
element(2, ns_storage_conf:allowed_node_quota_range(MemData));
_ -> undefined
end,
- [{directory, default_path("config")},
+ [{directory, path_config:component_path(data, "config")},
{nodes_wanted, [node()]},
{{node, node(), membership}, active},
% In general, the value in these key-value pairs are property lists,
@@ -169,12 +80,11 @@ default() ->
{dbdir, DbDir},
{admin_user, "_admin"},
{admin_pass, "_admin"},
- {bucket_engine,
- "./bin/bucket_engine/bucket_engine.so"},
- {engines, [{membase, [{engine, "bin/ep_engine/ep.so"},
+ {bucket_engine, path_config:component_path(lib, "memcached/bucket_engine.so")},
+ {engines, [{membase, [{engine, path_config:component_path(lib, "memcached/ep.so")},
{initfile,
- filename:join([ConfigDir, "init.sql"])}]},
- {memcached, [{engine, "lib/memcached/default_engine.so"}]}]},
+ path_config:component_path(etc, "init.sql")}]},
+ {memcached, [{engine, path_config:component_path(lib, "memcached/default_engine.so")}]}]},
{verbosity, ""}]},
{memory_quota, InitQuota},
@@ -195,7 +105,7 @@ default() ->
% This is a classic "should" key, where ns_port_sup needs
% to try to start child processes. If it fails, it should ns_log errors.
{port_servers,
- [{moxi, "./bin/moxi/moxi",
+ [{moxi, path_config:component_path(bin, "moxi"),
["-Z", {"port_listen=~B,default_bucket_name=default,downstream_max=1024,downstream_conn_max=4,"
"connect_max_errors=5,connect_retry_interval=30000,"
"connect_timeout=400,"
@@ -218,10 +128,10 @@ default() ->
stderr_to_stdout,
stream]
},
- {memcached, "./bin/memcached",
- ["-X", "./lib/memcached/stdin_term_handler.so",
+ {memcached, path_config:component_path(bin, "memcached"),
+ ["-X", path_config:component_path(lib, "memcached/stdin_term_handler.so"),
"-p", {"~B", [port]},
- "-E", "./bin/bucket_engine/bucket_engine.so",
+ "-E", path_config:component_path(lib, "memcached/bucket_engine.so"),
"-B", "binary",
"-r",
"-c", "10000",
View
5 src/ns_config_sup.erl
@@ -25,8 +25,9 @@ start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
- {ok, CfgPath} = application:get_env(ns_server_config),
- error_logger:info_msg("loading config from ~p~n", [CfgPath]),
+ CfgPath = path_config:component_path(etc, "config"),
+ % TODO: we'll likely kill that later, because static config is usually empty
+ error_logger:info_msg("loading static ns_config from ~p~n", [CfgPath]),
{ok, {{rest_for_one, 3, 10},
[
%% gen_event for the config events.
View
2  src/ns_log_browser.erl
@@ -56,7 +56,7 @@ start() ->
get_logs_as_file(Types, NumReports, RegExp) ->
catch rb:stop(),
- TempFile = ns_config_default:tempfile("nslogs", ".log"),
+ TempFile = path_config:tempfile("nslogs", ".log"),
filelib:ensure_dir(TempFile),
Options = [{start_log, TempFile}, {type, Types}, {max, NumReports}, {report_dir}],
Options1 = case application:get_env(error_logger_mf_dir) of
View
3  src/ns_server.app.src.in
@@ -48,6 +48,5 @@
% processes and then itself.
{env, [{max_r, 20},
- {max_t, 10},
- {ns_server_config, "priv/config"}]}
+ {max_t, 10}]}
]}.
View
25 src/ns_server.erl
@@ -20,7 +20,32 @@
-export([start/2, stop/1]).
start(_Type, _Args) ->
+ setup_static_config(),
ns_server_cluster_sup:start_link().
+get_config_path() ->
+ case application:get_env(ns_server, config_path) of
+ {ok, V} -> V;
+ _ -> error_logger:error_msg("config_path parameter for ns_server application is missing!\n"),
+ erlang:error("config_path parameter for ns_server application is missing!")
+ end.
+
+setup_static_config() ->
+ Terms = case file:consult(get_config_path()) of
+ {ok, T} when is_list(T) ->
+ T;
+ _ ->
+ erlang:error("failed to read static config: " ++ get_config_path() ++ ". It must be readable file with list of pairs~n")
+ end,
+ io:format("Terms = ~p~n", [Terms]),
+ lists:foreach(fun ({K,V}) ->
+ case application:get_env(ns_server, K) of
+ undefined ->
+ application:set_env(ns_server, K, V);
+ _ ->
+ error_logger:warning_msg("not overriding parameter ~p, which is given from command line~n", [K])
+ end
+ end, Terms).
+
stop(_State) ->
ok.
View
46 src/path_config.erl
@@ -0,0 +1,46 @@
+%% @author Northscale <info@northscale.com>
+%% @copyright 2009 NorthScale, Inc.
+%%
+%% 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.
+%%
+-module(path_config).
+
+-export([component_path/1, component_path/2,
+ tempfile/2, tempfile/3]).
+
+component_path_key(tmp) -> path_config_tmpdir;
+component_path_key(data) -> path_config_datadir;
+component_path_key(bin) -> path_config_bindir;
+component_path_key(lib) -> path_config_libdir;
+component_path_key(etc) -> path_config_etcdir.
+
+-spec component_path(etc | tmp | data | lib | bin) -> string().
+component_path(NameAtom) ->
+ {ok, RV} = application:get_env(component_path_key(NameAtom)),
+ ok = filelib:ensure_dir(RV),
+ RV.
+
+-spec component_path(tmp | data | lib | bin, string()) -> string().
+component_path(NameAtom, SubPath) ->
+ filename:join(component_path(NameAtom), SubPath).
+
+tempfile(Dir, Prefix, Suffix) ->
+ {_, _, MicroSecs} = erlang:now(),
+ Pid = os:getpid(),
+ Filename = Prefix ++ integer_to_list(MicroSecs) ++ "_" ++
+ Pid ++ Suffix,
+ filename:join(Dir, Filename).
+
+tempfile(Prefix, Suffix) ->
+ Dir = component_path(tmp),
+ tempfile(Dir, Prefix, Suffix).
View
5 src/system_stats_collector.erl
@@ -39,10 +39,11 @@ start_link() ->
init([]) ->
- Port = case filelib:is_regular("bin/sigar_port") of
+ Path = path_config:component_path(bin, "sigar_port"),
+ Port = case filelib:is_regular(Path) of
true ->
ns_pubsub:subscribe(ns_tick_event),
- open_port({spawn_executable, "bin/sigar_port"},
+ open_port({spawn_executable, Path},
[stream, use_stdio, exit_status,
binary, eof, {arg0, lists:flatten(io_lib:format("portsigar for ~s", [node()]))}]);
_ ->
View
22 start_shell.sh
@@ -1,10 +1,20 @@
#!/bin/sh
# Copyright (c) 2011, Membase, Inc.
# All rights reserved.
-basedir=${0##*/}
+basedir=${0%%${0##*/}}
cd "$basedir"
+test -f "$basedir/.configuration" || (echo "run ./configure and make first!" && false) || exit 1
+
+. "$basedir/.configuration"
+
+if test -z "$prefix" ; then
+ echo "configuration is damaged somehow. Re-running ./configure might help"
+ exit 1
+fi
+
mkdir logs > /dev/null 2>&1
+mkdir -p "data/ns_0/mnesia" >/dev/null 2>&1
# Initialize distributed erlang on the system (i.e. epmd)
if [ -z "$DONT_START_EPMD" ]; then
@@ -15,14 +25,20 @@ fi
exec erl \
+A 16 \
- -pa `find lib/couchdb/lib/couchdb/erlang/lib -type d -name ebin` \
+ -pa `find "${prefix}/lib/couchdb/erlang/lib" -type d -name ebin` \
-pa `find . -type d -name ebin` \
-setcookie nocookie \
-run ns_bootstrap \
- -couch_ini lib/couchdb/etc/couchdb/default.ini couch/n_0_conf.ini \
+ -couch_ini "${prefix}/etc/couchdb/default.ini" couch/n_0_conf.ini \
-ns_server error_logger_mf_dir '"logs"' \
-ns_server error_logger_mf_maxbytes 10485760 \
-ns_server error_logger_mf_maxfiles 10 \
-ns_server dont_suppress_stderr_logger true \
+ -ns_server config_path '"./etc/static_config.in"' \
+ -ns_server path_config_etcdir '"priv"' \
+ -ns_server path_config_bindir "\"${prefix}/bin\"" \
+ -ns_server path_config_libdir "\"${prefix}/lib\"" \
+ -ns_server path_config_datadir "\"data/ns_0\"" \
+ -ns_server path_config_tmpdir "\"tmp\"" \
-kernel inet_dist_listen_min 21100 inet_dist_listen_max 21199 \
-- "$@"
Please sign in to comment.
Something went wrong with that request. Please try again.