Skip to content

Instantly share code, notes, and snippets.

@ziazek
Last active June 1, 2017 09:05
Show Gist options
  • Save ziazek/5d20c3daa120cada5947357e9611c12b to your computer and use it in GitHub Desktop.
Save ziazek/5d20c3daa120cada5947357e9611c12b to your computer and use it in GitHub Desktop.
.deliver/config
APP="deploy_phoenix"
BUILD_HOST="188.166.182.170"
BUILD_USER="deploy"
BUILD_AT="/tmp/edeliver/$APP/builds"
RELEASE_DIR="/tmp/edeliver/$APP/builds/_build/prod/rel/$APP"
# prevent re-installing node modules; this defaults to "."
GIT_CLEAN_PATHS="_build rel priv/static"
# STAGING_HOSTS="188.166.182.170"
# STAGING_USER="deploy"
# TEST_AT="/home/deploy/staging"
PRODUCTION_HOSTS="188.166.182.170"
PRODUCTION_USER="deploy"
DELIVER_TO="/home/deploy"
# For *Phoenix* projects, symlink prod.secret.exs to our tmp source
pre_erlang_get_and_update_deps() {
local _prod_secret_path="/home/deploy/prod.secret.exs"
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
ln -sfn '$_prod_secret_path' '$BUILD_AT/config/prod.secret.exs'
"
fi
}
pre_erlang_clean_compile() {
status "Running phoenix.digest" # log output prepended with "----->"
__sync_remote " # runs the commands on the build host
# [ -f ~/.profile ] && source ~/.profile # load profile (optional)
source ~/.profile
# echo \$PATH # check if rbenv is in the path
set -e # fail if any command fails (recommended)
cd '$BUILD_AT' # enter the build directory on the build host (required)
# prepare something
mkdir -p priv/static # required by the phoenix.digest task
npm install
./node_modules/brunch/bin/brunch build --production
# run your custom task
APP='$APP' MIX_ENV='$TARGET_MIX_ENV' $MIX_CMD phoenix.digest $SILENCE
"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment