From 12af16eb70a6feca4008b874dda2e80a7555ffa1 Mon Sep 17 00:00:00 2001 From: Shunichi Shinohara Date: Sat, 20 Oct 2012 14:22:43 +0900 Subject: Add slim release support for runner script --- priv/templates/simplenode.runner | 45 +++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) (limited to 'priv/templates') diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index 032eb28..1f8c5e7 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -130,11 +130,42 @@ cd $USE_DIR # Make sure log directory exists mkdir -p $USE_DIR/log -# Add ERTS bin dir to our path -ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin +RUNNER_SCRIPT_DATA= +if [ -e "$RUNNER_BASE_DIR/releases/$APP_VSN/runner_script.data" ]; then + RUNNER_SCRIPT_DATA=`cat $RUNNER_BASE_DIR/releases/$APP_VSN/runner_script.data` +fi -# Setup command to control the node -NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG" +if [ -z "$RUNNER_SCRIPT_DATA" ]; then + echo "normal release" + ROOTDIR=$RUNNER_BASE_DIR + ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin + NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG" + SLIM_ARGS= +elif [ "$RUNNER_SCRIPT_DATA" = "slim" ]; then + echo "slim release" + # Setup system paths + SYSTEM_ERL_PATH=`which erl` + if [ ! -x "$SYSTEM_ERL_PATH" ]; then + echo "Failed to find erl. Is Erlang/OTP available in PATH?" + exit 1 + fi + SYSTEM_HOME_BIN=${SYSTEM_ERL_PATH%/*} + ROOTDIR=$SYSTEM_HOME_BIN/../lib/erlang + ERTS_PATH=$ROOTDIR/erts-$ERTS_VSN/bin + unset SYSTEM_ERL_PATH + unset SYSTEM_HOME_BIN + + # Setup nodetool path. Is it nice to place nodetool script under releases? + LOCAL_ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin + NODETOOL="$ERTS_PATH/escript $LOCAL_ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG" + unset LOCAL_ERL_PATH + + # Setup additional arguments for slim release + SLIM_ARGS="-boot_var RELTOOL_EXT_LIB $RUNNER_BASE_DIR/lib -sasl releases_dir \"$RUNNER_BASE_DIR/releases\"" +else + echo "unknown runner_script.data" + exit 1 +fi # Setup remote shell command to control node REMSH="$ERTS_PATH/erl -hidden $REMSH_NAME_ARG $REMSH_REMSH_ARG $COOKIE_ARG" @@ -310,11 +341,10 @@ case "$1" in ;; esac # Setup beam-required vars - ROOTDIR=$RUNNER_BASE_DIR BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin EMU=beam PROGNAME=`echo $0 | sed 's/.*\\///'` - CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -mode embedded -config $CONFIG_PATH -args_file $VMARGS_PATH" + CMD="$BINDIR/erlexec $SLIM_ARGS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -mode embedded -config $CONFIG_PATH -args_file $VMARGS_PATH" export EMU export ROOTDIR export BINDIR @@ -339,11 +369,10 @@ case "$1" in FOREGROUNDOPTIONS="-noinput +Bd" # Setup beam-required vars - ROOTDIR=$RUNNER_BASE_DIR BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin EMU=beam PROGNAME=`echo $0 | sed 's/.*\///'` - CMD="$BINDIR/erlexec $FOREGROUNDOPTIONS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -config $CONFIG_PATH -args_file $VMARGS_PATH" + CMD="$BINDIR/erlexec $SLIM_ARGS $FOREGROUNDOPTIONS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -config $CONFIG_PATH -args_file $VMARGS_PATH" export EMU export ROOTDIR export BINDIR -- cgit v1.1 From e4300bf88f78e171e597fd9c30f7a6b4ef7f084e Mon Sep 17 00:00:00 2001 From: Shunichi Shinohara Date: Sun, 13 Jan 2013 21:11:52 +0900 Subject: Change nodetool path to under releases// --- priv/templates/simplenode.reltool.config | 2 +- priv/templates/simplenode.runner | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'priv/templates') diff --git a/priv/templates/simplenode.reltool.config b/priv/templates/simplenode.reltool.config index bac7270..eae8ab3 100644 --- a/priv/templates/simplenode.reltool.config +++ b/priv/templates/simplenode.reltool.config @@ -32,7 +32,7 @@ {overlay, [ {mkdir, "log/sasl"}, {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, - {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"}, + {copy, "files/nodetool", "releases/\{\{rel_vsn\}\}/nodetool"}, {copy, "{{nodeid}}/bin/start_clean.boot", "\{\{erts_vsn\}\}/bin/start_clean.boot"}, {copy, "files/{{nodeid}}", "bin/{{nodeid}}"}, diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index 1f8c5e7..595a1ea 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -136,13 +136,15 @@ if [ -e "$RUNNER_BASE_DIR/releases/$APP_VSN/runner_script.data" ]; then fi if [ -z "$RUNNER_SCRIPT_DATA" ]; then - echo "normal release" ROOTDIR=$RUNNER_BASE_DIR ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin - NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG" + if [ -e "$RUNNER_BASE_DIR/releases/$APP_VSN/nodetool" ]; then + NODETOOL="$ERTS_PATH/escript $RUNNER_BASE_DIR/releases/$APP_VSN/nodetool $NAME_ARG $COOKIE_ARG" + else + NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG" + fi SLIM_ARGS= elif [ "$RUNNER_SCRIPT_DATA" = "slim" ]; then - echo "slim release" # Setup system paths SYSTEM_ERL_PATH=`which erl` if [ ! -x "$SYSTEM_ERL_PATH" ]; then @@ -155,15 +157,14 @@ elif [ "$RUNNER_SCRIPT_DATA" = "slim" ]; then unset SYSTEM_ERL_PATH unset SYSTEM_HOME_BIN - # Setup nodetool path. Is it nice to place nodetool script under releases? LOCAL_ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin - NODETOOL="$ERTS_PATH/escript $LOCAL_ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG" + NODETOOL="$ERTS_PATH/escript $RUNNER_BASE_DIR/releases/$APP_VSN/nodetool $NAME_ARG $COOKIE_ARG" unset LOCAL_ERL_PATH # Setup additional arguments for slim release SLIM_ARGS="-boot_var RELTOOL_EXT_LIB $RUNNER_BASE_DIR/lib -sasl releases_dir \"$RUNNER_BASE_DIR/releases\"" else - echo "unknown runner_script.data" + echo "Unknown runner_script.data" exit 1 fi -- cgit v1.1 From 81ed1611af693fb9b4483a55c437a5c9d743966c Mon Sep 17 00:00:00 2001 From: Shunichi Shinohara Date: Fri, 27 Dec 2013 16:54:20 +0900 Subject: Add TODO comment to install_upgrade script template --- priv/templates/simplenode.install_upgrade.escript | 8 ++++++++ 1 file changed, 8 insertions(+) mode change 100644 => 100755 priv/templates/simplenode.install_upgrade.escript (limited to 'priv/templates') diff --git a/priv/templates/simplenode.install_upgrade.escript b/priv/templates/simplenode.install_upgrade.escript old mode 100644 new mode 100755 index 56cea19..0d4cbe3 --- a/priv/templates/simplenode.install_upgrade.escript +++ b/priv/templates/simplenode.install_upgrade.escript @@ -6,6 +6,14 @@ -define(TIMEOUT, 60000). -define(INFO(Fmt,Args), io:format(Fmt,Args)). +%% TODO: This script currently does NOT support slim releases. +%% Necessary steps to upgrade a slim release are as follows: +%% 1. unpack relup archive manually +%% 2. copy releases directory and necessary libraries +%% 3. using release_hander:set_unpacked/2 . +%% For more details, see https://github.com/rebar/rebar/pull/52 +%% and https://github.com/rebar/rebar/issues/202 + main([NodeName, Cookie, ReleasePackage]) -> TargetNode = start_distribution(NodeName, Cookie), {ok, Vsn} = rpc:call(TargetNode, release_handler, unpack_release, -- cgit v1.1