Skip to content
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
21 changes: 11 additions & 10 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{cluster_info, {git, "git://github.com/basho/cluster_info.git", {tag, "2.1.0"}}},
{riak_kv, {git, "git://github.com/basho/riak_kv.git", {branch, "develop-3.0"}}},
{riak_auth_mods, {git, "git://github.com/basho/riak_auth_mods.git", {tag, "riak_kv-3.0.0"}}},
{riaknostic, {git, "git://github.com/basho/riaknostic.git", {branch, "develop-3.0"}}},

% {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0"}}},

Expand Down Expand Up @@ -71,6 +72,7 @@
riak_repl,
cluster_info,
% yokozuna,
riaknostic,
riak_auth_mods]},

{dev_mode, false},
Expand All @@ -83,24 +85,23 @@
{template, "rel/files/advanced.config", "etc/advanced.config"},

%% Copy additional bin scripts
{template, "rel/files/riak-admin", "bin/riak-admin"},
{template, "rel/files/riak-debug", "bin/riak-debug"},
{template, "rel/files/riak-chkconfig", "bin/riak-chkconfig"},
{template, "rel/files/riak-repl", "bin/riak-repl"},
{template, "rel/files/riak-admin", "bin/riak-admin"},
{template, "rel/files/riak-debug", "bin/riak-debug"},
{template, "rel/files/riak-chkconfig", "bin/riak-chkconfig"},
{template, "rel/files/riak-repl", "bin/riak-repl"},
{template, "rel/files/riak", "usr/bin/riak"},

{template, "rel/files/riak", "usr/bin/riak"},

{copy, "rel/files/check_ulimit", "bin/hooks/check_ulimit"},
{copy, "rel/files/erl_maxlogsize", "bin/hooks/erl_maxlogsize"},
{copy, "rel/files/riak_not_running", "bin/hooks/riak_not_running"}
{copy, "rel/files/check_ulimit", "bin/hooks/check_ulimit"},
{copy, "rel/files/erl_maxlogsize", "bin/hooks/erl_maxlogsize"},
{copy, "rel/files/riak_not_running", "bin/hooks/riak_not_running"},
{copy, "rel/files/app_epath.sh", "lib/app_epath.sh"}

]},

{generate_start_script, true},
{extended_start_script, true},
{extended_start_script_extensions, [
{admin, "riak-admin"},
{debug, "riak-debug"},
{repl, "riak-repl"},
{chkconfig, "riak-chkconfig"}
]}
Expand Down
6 changes: 5 additions & 1 deletion rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{<<"getopt">>,
{git,"git://github.com/jcomellas/getopt.git",
{ref,"fbd210550677114a6c96cdf66e340eb248908d93"}},
4},
1},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},2},
{<<"hut">>,{pkg,<<"hut">>,<<"1.2.1">>},3},
{<<"hyper">>,
Expand Down Expand Up @@ -152,6 +152,10 @@
{git,"git://github.com/basho/riak-erlang-http-client",
{ref,"15174fa6631d66f11c0a31050df5e6ab34b9b69b"}},
1},
{<<"riaknostic">>,
{git,"git://github.com/basho/riaknostic.git",
{ref,"8aef63a89d719b22754683cce187eaeeecdd789c"}},
0},
{<<"setup">>,{pkg,<<"setup">>,<<"2.0.2">>},3},
{<<"sext">>,
{git,"git://github.com/uwiger/sext.git",
Expand Down
173 changes: 173 additions & 0 deletions rel/files/app_epath.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
#!/bin/sh

## ---------------------------------------------------------------------
##
## app_epath.sh: Parse Erlang app.config with POSIX tools for automation
##
## Copyright (c) 2013 Basho Technologies, Inc. All Rights Reserved.
##
## This file is provided to you 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.
##
## ---------------------------------------------------------------------

## Example usage:
#
# #!/bin/sh
#
# # Load the functions
# . path/to/app_epath.sh
#
# # Build the path info
# epaths=`make_app_epaths path/to/app.config`
#
# # View all of the settings. Quotes are important.
# echo "$epaths"
#
# # Grep around in the paths for various items.
# echo "$epaths" | grep 'riak_core ring_creation_size'
# echo "$epaths" | grep "lager handlers lager_file_backend" | grep info
#
# # Use the epath function to get directly at settings
# epath 'riak_core ring_creation_size' "$epaths"
# epath 'riak_core platform_bin_dir' "$epaths"
# epath 'riak_kv storage_backend' "$epaths"
#
# # Use epath to view all of the riak_core settings
# epath riak_core
#
## End example

## Here is a command you can put in your path for general cli use.
#
# #!/bin/sh
#
# # $1 quoted eterm path for search: 'riak_core ring_creation_size'
# # $2 path/to/app.config
#
# . path/to/app_epath.sh
#
# epaths=`make_app_epaths "$2"`
# epath "$1" "$epaths"
#
## End epath command

# make_app_epaths takes a path to an app.config file as its argument and
# and returns (prints) a flattened text structure of configuration settings.

make_app_epaths () {
# Remove all lines containing comments
# Remove all blank lines
# Remove the first [
# Remove the last ].
# Remove all blank lines again (just in case)
appconfig=`cat $1 \
| sed '/^[ \t]*%/d' \
| sed '/^[ \t]*$/d' \
| sed -e '/\[/{s///;:a' -e '$!N;$!ba' -e '}' \
| sed '$ s/\]\.//g' \
| sed '/^[ \t]*$/d'`

STACK=
INQUOTE=0
# The awk puts each char, spaces included, on their own line for parsing.
echo "$appconfig" | awk '{gsub(//,"\n");print}' | while read i; do
case "x${i}x" in
"x\"x")
# Flip the INQUOTE state and echo the quote
if [ 1 -eq $INQUOTE ]; then
INQUOTE=0
else
INQUOTE=1
fi
STACK="${STACK}${i}"
;;
"xx")
if [ 1 -eq $INQUOTE ]; then
# If in quotes, keep this space
STACK="${STACK} "
fi
;;
"x,x")
if [ 1 -eq $INQUOTE ]; then
# If in quotes, keep this comma
STACK="${STACK},"
else
# Commas outside quotes means a new item is next
STACK="${STACK} "
fi
;;
"x{x")
if [ 1 -eq $INQUOTE ]; then
# If in quotes, keep this bracket
STACK="${STACK}{"
else
# Add brace to the stack; will pop off from here on next }
STACK="${STACK} __EBRACE__ "
fi
;;
"x}x")
if [ 1 -eq $INQUOTE ]; then
# If in quotes, keep this bracket
STACK="${STACK}}"
else
# We're only interested in printing leaves, not
# intermediates like 'riak_core http', which contain lists.
# See if the current stack ends with ] (end of list).
echo $STACK | grep -E "__EBRACKET__$" >/dev/null 2>&1
if [ 1 -eq $? ]; then
# If not, print the stack without all of the mess.
echo "$STACK" | \
sed 's/ *__EBRACE__//g;s/ *__EBRACKET__//g;s/^ *//'
fi
# Pop off everything from the last brace on.
STACK=`echo "$STACK" | sed 's/\(.*\) __EBRACE__.*/\1/g'`
fi
;;
"x[x")
if [ 1 -eq $INQUOTE ]; then
# If in quotes, keep this bracket
STACK="${STACK}["
else
# Add a placeholder to aid in determining whether or not to
# print. That is, we don't want to print 'riak_core http'.
STACK="${STACK} __EBRACKET__ "
fi
;;
"x]x")
if [ 1 -eq $INQUOTE ]; then
# If in quotes, keep this bracket
STACK="${STACK}]"
fi
# Don't actually do anything with ], as the starting brackets
# are instead removed with }.
;;
*)
# Anything else is just pushed.
STACK="${STACK}${i}"
;;
esac
done
}

epath () {
# arg1 - a pattern to search for
# arg2 - output of make_app_epaths, passed in quoted
# output - search of arg2 for arg1, trimming arg1 from the beginning
# Note: there may be multiple lines of output.
pat=$1
shift
echo "$*" | grep "$pat " | sed "s/^${pat} *//"
}

7 changes: 7 additions & 0 deletions rel/files/riak
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ RUNNER_GEN_DIR="${RUNNER_GEN_DIR:-{{ platform_gen_dir }}}"
RELEASE_ROOT_DIR="${RELEASE_ROOT_DIR:-{{ runner_base_dir }}}"
PID_DIR={{pid_dir}}
COMMAND={{platform_bin_dir}}/riak
DEBUG_COMMAND={{platform_bin_dir}}/riak-debug
RUNNER_LOG_DIR={{platform_log_dir}}
RELX_CONFIG_PATH=${RUNNER_GEN_DIR}/sys.config
VMARGS_PATH=${RUNNER_GEN_DIR}/vm.args
Expand Down Expand Up @@ -40,6 +41,12 @@ else
start|console|foreground)
su - riak -c "RELX_CONFIG_PATH=${RELX_CONFIG_PATH} VMARGS_PATH=${VMARGS_PATH} RUNNER_LOG_DIR=${RUNNER_LOG_DIR} PIPE_DIR=${PIPE_DIR} ${COMMAND} ${*} -pa {{platform_lib_dir}}/patches"
;;
debug)
# Drop the "debug" from the args as we're going to directly call riak-debug now
shift
# Debug may fail if run via relx script due to use of relative start location, and also need for root access
RELX_CONFIG_PATH=${RELX_CONFIG_PATH} VMARGS_PATH=${VMARGS_PATH} RUNNER_LOG_DIR=${RUNNER_LOG_DIR} PIPE_DIR=${PIPE_DIR} ${DEBUG_COMMAND} ${*}
;;
*)
ESCAPED_ARGS=`echo "$@" | sed -e 's/\([\\\(\\\){}"\x27]\)/\\\\\1/g'`
su - riak -c "RELX_CONFIG_PATH=${RELX_CONFIG_PATH} VMARGS_PATH=${VMARGS_PATH} RUNNER_LOG_DIR=${RUNNER_LOG_DIR} PIPE_DIR=${PIPE_DIR} ${COMMAND} ${ESCAPED_ARGS}"
Expand Down
Loading