Skip to content

Commit 02da072

Browse files
committed
First packaged basho_bench
Through the effort to make smaller package, several changes to the code and dependent modules were done: - dependent modules updated; lager, mochiweb and getopt - some dependent modules removed; erlcql, velvet, casbench - deprecate R15 Andalso, there are some kludge to enable package install with node_package; - not using escriptize but just a proxy script installed - unnecessary directories like log, data created - unnecessary user and group named basho-bench created for this - not pinning dependent module versions yet
1 parent cde4190 commit 02da072

14 files changed

+187
-300
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
ebin/
22
deps/
33
tests/
4-
basho_bench
4+
/basho_bench
5+
/rel/basho_bench
6+
package
7+
.rebar
58
*~
69
#*#
710

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ REPO ?= basho_bench
22

33
PKG_REVISION ?= $(shell git describe --tags)
44
PKG_VERSION ?= $(shell git describe --tags | tr - .)
5-
PKG_ID = bashobench-$(PKG_VERSION)
5+
PKG_ID = basho-bench-$(PKG_VERSION)
66
PKG_BUILD = 1
77
BASE_DIR = $(shell pwd)
88
ERLANG_BIN = $(shell dirname $(shell which erl))
99
REBAR ?= $(BASE_DIR)/rebar
1010
OVERLAY_VARS ?=
1111

1212

13-
.PHONY: deps
14-
15-
rel: deps compile
16-
./rebar skip_deps=true escriptize
17-
1813
all: deps compile
1914
./rebar skip_deps=true escriptize
2015

16+
.PHONY: deps compile rel
17+
18+
rel: deps compile
19+
cd rel && ../rebar generate skip_deps=true $(OVERLAY_VARS)
20+
2121
deps:
2222
./rebar get-deps
2323

pkg.vars.config

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
%%
55
%% Packaging
66
%%
7-
{package_name, "bashobench"}.
8-
{package_install_name, "bashobench"}.
9-
{package_install_user, "bashobench"}.
10-
{package_install_group, "bashobench"}.
7+
{package_name, "basho-bench"}.
8+
{package_install_name, "basho_bench"}.
9+
{package_install_user, "basho-bench"}.
10+
{package_install_group, "basho-bench"}.
1111
{package_install_user_desc, "Basho-bench user"}.
12-
{package_shortdesc, "Bashobench benchmarking tool"}.
12+
{package_shortdesc, "Basho benchmarking tool"}.
1313
{package_desc, "Benchmarking tool"}.
14-
{package_commands, {list, [[{name, "bashobench"}]]}}.
14+
{package_commands, {list, [[{name, "basho_bench"}]]}}.
1515
{package_patch_dir, "basho-patches"}.
1616
{bin_or_sbin, "bin"}.
1717
{license_type, "OSS"}.
18-
{copyright, "2013 Basho Technologies, Inc"}.
18+
{copyright, "2014 Basho Technologies, Inc"}.
1919
{vendor_name, "Basho Technologies, Inc"}.
2020
{vendor_url, "http://basho.com"}.
2121
{vendor_contact_name, "Basho Package Maintainer"}.
2222
{vendor_contact_email, "[email protected]"}.
2323
{license_full_text, "This software is provided under license from Basho Technologies."}.
24-
{solaris_pkgname, "BASHObashobench"}.
24+
{solaris_pkgname, "BASHObasho-bench"}.

rebar.config

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{require_otp_vsn, "R16|17"}.
12

23
{deps,
34
[
@@ -8,32 +9,23 @@
89
%% increments. If someone wants to take advantage of a
910
%% new folsom feature, that desire + float incr must be
1011
%% weighed.
11-
{node_package, "1.2.2", {git, "git://github.com/basho/node_package", {tag, "1.2.2"}}},
12+
{node_package, "2.0.*", {git, "git://github.com/basho/node_package", {tag, "2.0.0"}}},
1213
{folsom, ".*", {git, "git://github.com/basho/folsom.git", {branch, "boundary-0.7.1+basho-bench-float"}}},
13-
{lager, "2.*", {git, "git://github.com/basho/lager", {tag, "2.0.3"}}},
14+
{lager, "2.*", {git, "git://github.com/basho/lager", {tag, "2.1.0"}}},
1415
{ibrowse, ".*",
1516
{git, "git://github.com/cmullaparthi/ibrowse.git", {tag, "v3.0.4"}}},
16-
{casbench, "0.1",
17-
{git, "git://github.com/basho/casbench",
18-
"95ed55b494551577870984aeb1e0f683631a326f"}},
19-
{erlcql, ".*",
20-
{git, "git://github.com/rpt/erlcql.git",
21-
{branch, "master"}}},
2217
{riakc, ".*",
2318
{git, "git://github.com/basho/riak-erlang-client", {branch, "develop"}}},
24-
{mochiweb, "1.5.1*",
25-
{git, "git://github.com/basho/mochiweb", {tag, "1.5.1p6"}}},
26-
{velvet, "1.*",
27-
{git, "git://github.com/basho/velvet",
28-
"4bb0fd664ff065c4082ca8dd2e0683e920537d15"}},
19+
{mochiweb, "2.9.*",
20+
{git, "git://github.com/basho/mochiweb", {tag, "v2.9.0"}}},
2921
{getopt, ".*",
30-
{git, "git://github.com/jcomellas/getopt", {tag, "v0.4"}}}
22+
{git, "git://github.com/jcomellas/getopt", {tag, "v0.8.2"}}}
3123
]}.
3224

3325
{erl_opts, [{src_dirs, [src]},
3426
{parse_transform, lager_transform}]}.
3527

36-
{escript_incl_apps, [node_package, lager, getopt, bear, folsom, ibrowse, riakc, mochiweb, protobuffs, velvet, goldrush]}.
28+
{escript_incl_apps, [node_package, lager, getopt, bear, folsom, ibrowse, riakc, mochiweb, protobuffs, goldrush]}.
3729

3830
{escript_emu_args, "%%! +K true -rsh ssh\n"}.
3931
%% Use this for the Java client bench driver

rel/files/basho_bench

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
# Pull environment for this install
4+
. "{{runner_base_dir}}/lib/env.sh"
5+
6+
# Make sure CWD is set to runner run dir
7+
cd $RUNNER_BASE_DIR/lib/basho_bench*/ebin
8+
9+
ERL_LIBS=$RUNNER_BASE_DIR $ERTS_PATH/escript basho_bench.beam "$@"

rel/files/install_upgrade.escript

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env escript
2+
%%! -noshell -noinput
3+
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
4+
%% ex: ft=erlang ts=4 sw=4 et
5+
6+
-define(TIMEOUT, 60000).
7+
-define(INFO(Fmt,Args), io:format(Fmt,Args)).
8+
9+
main([NodeName, Cookie, ReleasePackage]) ->
10+
TargetNode = start_distribution(NodeName, Cookie),
11+
{ok, Vsn} = rpc:call(TargetNode, release_handler, unpack_release,
12+
[ReleasePackage], ?TIMEOUT),
13+
?INFO("Unpacked Release ~p~n", [Vsn]),
14+
{ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler,
15+
check_install_release, [Vsn], ?TIMEOUT),
16+
{ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler,
17+
install_release, [Vsn], ?TIMEOUT),
18+
?INFO("Installed Release ~p~n", [Vsn]),
19+
ok = rpc:call(TargetNode, release_handler, make_permanent, [Vsn], ?TIMEOUT),
20+
?INFO("Made Release ~p Permanent~n", [Vsn]);
21+
main(_) ->
22+
init:stop(1).
23+
24+
start_distribution(NodeName, Cookie) ->
25+
MyNode = make_script_node(NodeName),
26+
{ok, _Pid} = net_kernel:start([MyNode, shortnames]),
27+
erlang:set_cookie(node(), list_to_atom(Cookie)),
28+
TargetNode = make_target_node(NodeName),
29+
case {net_kernel:hidden_connect_node(TargetNode),
30+
net_adm:ping(TargetNode)} of
31+
{true, pong} ->
32+
ok;
33+
{_, pang} ->
34+
io:format("Node ~p not responding to pings.\n", [TargetNode]),
35+
init:stop(1)
36+
end,
37+
TargetNode.
38+
39+
make_target_node(Node) ->
40+
[_, Host] = string:tokens(atom_to_list(node()), "@"),
41+
list_to_atom(lists:concat([Node, "@", Host])).
42+
43+
make_script_node(Node) ->
44+
list_to_atom(lists:concat([Node, "_upgrader_", os:getpid()])).

rel/files/vm.args

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Name of the node
2+
3+
4+
## Cookie for distributed erlang
5+
-setcookie healthb
6+
7+
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
8+
## (Disabled by default..use with caution!)
9+
##-heart
10+
11+
## Enable kernel poll and a few async threads
12+
##+K true
13+
##+A 5
14+
15+
## Increase number of concurrent ports/sockets
16+
##-env ERL_MAX_PORTS 4096
17+
18+
## Tweak GC to run more often
19+
##-env ERL_FULLSWEEP_AFTER 10

rel/reltool.config

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
%% -*- mode: erlang -*-
2+
%% ex: ft=erlang
3+
{sys, [
4+
{lib_dirs, ["../deps"]},
5+
{erts, [{mod_cond, derived}, {app_file, strip}]},
6+
{app_file, strip},
7+
{rel, "basho_bench", "0.10.0",
8+
[
9+
kernel,
10+
stdlib,
11+
bear,
12+
lager,
13+
folsom,
14+
goldrush,
15+
riakc,
16+
ibrowse,
17+
mochiweb
18+
]},
19+
{rel, "start_clean", "",
20+
[
21+
kernel,
22+
stdlib
23+
]},
24+
{boot_rel, "basho_bench"},
25+
{profile, embedded},
26+
{incl_cond, derived},
27+
{excl_archive_filters, [".*"]}, %% Do not archive built libs
28+
{excl_sys_filters, ["^bin/(?!start_clean.boot)",
29+
"^erts.*/bin/(dialyzer|typer)",
30+
"^erts.*/(doc|info|include|lib|man|src)"]},
31+
{excl_app_filters, ["\.gitignore"]},
32+
{app, basho_bench, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]},
33+
{app, hipe, [{incl_cond, exclude}]}
34+
]}.
35+
36+
{target_dir, "basho_bench"}.
37+
{overlay_vars, "vars.config"}.
38+
39+
{overlay, [
40+
{template, "../deps/node_package/priv/base/env.sh",
41+
"lib/env.sh"},
42+
{mkdir, "data/b_b"},
43+
44+
%% Copy base files for starting and interacting w/ node
45+
{copy, "../deps/node_package/priv/base/erl",
46+
"{{erts_vsn}}/bin/erl"},
47+
{copy, "../deps/node_package/priv/base/nodetool",
48+
"{{erts_vsn}}/bin/nodetool"},
49+
{template, "../deps/node_package/priv/base/env.sh",
50+
"lib/env.sh"},
51+
{copy, "files/vm.args", "etc/vm.args"},
52+
53+
{template, "files/basho_bench", "bin/basho_bench"},
54+
55+
{copy, "../examples/cs.config.sample", "etc/cs.config"},
56+
{copy, "../examples/riakc_pb.config", "etc/riakc_pb.config"},
57+
{copy, "../examples/httpraw.config", "etc/httpraw.config"},
58+
{copy, "../examples/http.config", "etc/http.config"},
59+
{copy, "../examples/null_test.config", "etc/null_test.config"}
60+
61+
%%{copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
62+
63+
]}.

rel/vars.config

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
2+
%% ex: ts=4 sw=4 et
3+
4+
%% Platform-specific installation paths
5+
{platform_bin_dir, "./bin"}.
6+
{platform_data_dir, "./data"}.
7+
{platform_etc_dir, "./etc"}.
8+
{platform_lib_dir, "./lib"}.
9+
{platform_log_dir, "./log"}.
10+
11+
%%
12+
{data_dir, "{{target_dir}}/data"}.
13+
{runner_script_dir, "\`cd \\`dirname $0\\` && /bin/pwd\`"}.
14+
{runner_base_dir, "{{runner_script_dir}}/.."}.
15+
{runner_etc_dir, "$RUNNER_BASE_DIR/etc"}.
16+
{runner_log_dir, "$RUNNER_BASE_DIR/log"}.
17+
{runner_lib_dir, "$RUNNER_BASE_DIR/lib"}.
18+
{runner_patch_dir, "$RUNNER_BASE_DIR/lib/basho-patches"}.
19+
{pipe_dir, "/tmp/$RUNNER_BASE_DIR/"}.
20+
{runner_user, ""}.

src/basho_bench.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{application, basho_bench,
22
[{description, "Riak Benchmarking Suite"},
3-
{vsn, "0.9"},
3+
{vsn, git},
44
{modules, []},
55
{registered, [ basho_bench_sup ]},
66
{applications, [kernel,

0 commit comments

Comments
 (0)