Packages

Build and Deploy Elixir Applications and perform Hot-Code Upgrades and Schema Migrations

Current section

Files

Jump to
edeliver_fork bin edeliver
Raw

bin/edeliver

#!/usr/bin/env bash
# The most comprehensive way of figuring this script's absoute path,
# even when we're dealing with multi-level symlinks
SOURCE="${BASH_SOURCE[0]}"
DIR="$( dirname "$SOURCE" )"
while [ -h "$SOURCE" ]
do
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
done
# DIR is now pointing to the bin dir, BASE_PATH is one level up
BASE_PATH="$(cd "$DIR/.." >/dev/null 2>&1 && pwd)"
# All functions starting with __ are private ones
# You can overwrite them, but ideally they should be left alone.
# Remember Demeter: http://ablogaboutcode.com/2012/02/27/understanding-the-law-of-demeter/
source "$BASE_PATH/libexec/defaults"
source "$BASE_PATH/libexec/output"
source "$BASE_PATH/libexec/deprecations"
source "$BASE_PATH/libexec/core"
source "$BASE_PATH/libexec/common"
source "$BASE_PATH/libexec/generated"
source "$BASE_PATH/libexec/erlang"
trap __graceful_stop SIGINT SIGTERM
if [ -f "$ORIGIN_DIR/.deliver/help" ]; then
source "$ORIGIN_DIR/.deliver/help"
fi
source "$BASE_PATH/libexec/erlang-init"
if [[ "$PRINT_COMMAND_HELP" = "true" ]]; then
__find_all_strategies
__load_strategy
help
else
__capture_runtime_configs
__find_all_strategies
__load_app_config
__default_app_config
__apply_runtime_configs
__load_strategy
__remote_hosts
__check_config
[[ "$RUNS_AS_MIX_TASK" = "true" ]] && __monitor_parent_pid &
# Run the loaded strategy
# Can be overwritten by each strategy, e.g. custom output
#
begin
run
finish
exit 0 # if we reached this point, everything went according to plan, use the appropriate exit status
fi