Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest changes into 2.0 #194

Merged
merged 16 commits into from
Dec 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ your application's =vars.config=.
**** Optional Variables
- =runner_ulimit_warn= - The runner script will warn if `ulimit -n` is less than
this value. This defaults to 4096 in all packages.
- =platform_patch_dir= - Directory to include in erlang's load path to allow for
- =package_patch_dir= - Directory to include in erlang's load path to allow for
patches to be hotloaded. By default this will be in the =platform_lib_dir=
(ex: "basho-patches")
- =runner_user= - The username to run the application as
Expand Down Expand Up @@ -124,3 +124,15 @@ So, if you want to have a variable persist all the way through to the
final reltool step, the variable needs to be set in pkg.vars.config
(or defaulted in <osname>.template) AND be present in the vars.config,
so it can be applied to the reltool templates.

*** Example App

The easiest app that uses =node_package= is [[https://github.com/basho/stanchion][stanchion]] a small application that Basho uses along side Riak CS.

In particular, see:

- [[https://github.com/basho/stanchion/blob/develop/pkg.vars.config][pkg.vars.config]]
- [[https://github.com/basho/stanchion/blob/develop/Makefile#L73][makefile]]
- [[https://github.com/basho/stanchion/blob/develop/rel/reltool.config#L46][reltool.config]]

It also has custom settings in its [[https://github.com/basho/stanchion/blob/develop/rel/vars.config#L31][vars.config]] for adjusting settings in the =bin/stanchion= that comes from node_package's =runner= script.
13 changes: 10 additions & 3 deletions priv/base/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ fi
# Registered process to wait for to consider start a success
WAIT_FOR_PROCESS={{runner_wait_process}}

WHOAMI=`whoami`
WHOAMI=`id -un`

# erlexec requires HOME to be set. The username needs to be a
# unquoted literal because of the tilde expansion, hence the
# usage of eval.
if [ -z "$HOME" ]; then
export HOME=`eval echo "~$WHOAMI"`
fi

# Echo to stderr on errors
echoerr() { echo "$@" 1>&2; }
Expand Down Expand Up @@ -231,8 +238,8 @@ check_user() {
# riak-admin bucket-type create mytype {props: {n_val: 4}}
# after the arguments were passed into the new shell during exec su
#
# So this regex finds any '"', '{', or '}' and prepends with a '\'
ESCAPED_ARGS=`echo "$@" | sed -e 's/\([{}"]\)/\\\\\1/g'`
# So this regex finds any '(', ')', "'" , '"', '{', or '}' and prepends with a '\'
ESCAPED_ARGS=$(echo "$@" | sed -e "s/\([\\\(\\\){}\"']\)/\\\\\1/g")

# This will drop priviledges into the runner user
# It exec's in a new shell and the current shell will exit
Expand Down
9 changes: 7 additions & 2 deletions priv/base/nodetool
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,13 @@ process_args([Arg | Rest], Acc, Opts) ->


start_epmd() ->
[] = os:cmd(epmd_path() ++ " -daemon"),
ok.
case os:getenv("NO_EPMD") of
false ->
[] = os:cmd(epmd_path() ++ " -daemon"),
ok;
_ ->
ok
end.

epmd_path() ->
ErtsBinDir = filename:dirname(escript:script_name()),
Expand Down