Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (48 sloc) 2.64 KB
#!/usr/bin/env bash
APP="phoenix_website" # name of your release
USERNAME="phoenix" # user name on the App Server where the app will be deployed
BUILD_HOST="elixir-build-server.lunarlogic.io" # host where to build the release
BUILD_USER="builder" # local user at build host
BUILD_AT="/tmp/edeliver/$APP/builds" # build directory on build host
STAGING_HOSTS="phoenix-website-staging.lunarlogic.io" # staging / test hosts separated by space
STAGING_USER=$USERNAME # local user at staging hosts
PRODUCTION_HOSTS="phoenix-website.lunarlogic.io" # deploy / production hosts separated by space
PRODUCTION_USER=$USERNAME # local user at deploy hosts
DELIVER_TO="/home/$USERNAME" # deploy directory on production hosts
# If you need to generate the $APP.config file for the first time or when you updated structure of the config/config.exs or config/prod.exs
# then please comment out LINK_SYS_CONFIG and then build app on the build server:
# $ mix edeliver build release --branch=master --verbose
# After it you will find the compiled package in .deliver/releases
# Find it and unpack. You will find the $APP.config file in path looking like this:
# .deliver/releases/phoenix_website_0.0.1+28-1aaac9f-deployment.release/releases/0.0.1+28-1aaac9f-deployment/sys.config
# Copy the content of sys.config and put it on your App Server and replace FILL_IN_HERE with your credentails:
# /home/phoenix/phoenix_website/phoenix_website.config
#
# We had to comment out LINK_SYS_CONFIG to be able to generate the sys.config file.
# Once we did that now you can again uncomment LINK_SYS_CONFIG.
# Now you can build app again and deploy to App Server. Thanks to that the new compiled package will contain sysmlink called sys.config to
# /home/phoenix/phoenix_website/phoenix_website.config file.
# When the package will be deployed to staging/production then symlink will work because there will be file phoenix_website.config
# you've just created.
#
# If you like you can learn more at:
# https://github.com/edeliver/edeliver/wiki/Use-per-host-configuration#use-different-configurations-on-different-deploy-hosts
LINK_SYS_CONFIG="$DELIVER_TO/$APP/$APP.config"
AUTO_VERSION=commit-count+git-revision+branch-unless-master
pre_erlang_get_and_update_deps() {
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
# fail if any command fails (recommended)
set -e
cd '$BUILD_AT'
# required by the phx.digest task
mkdir -p priv/static
mix deps.get
cd '$BUILD_AT/assets'
npm install
$BUILD_AT/assets/node_modules/.bin/brunch build --production
cd '$BUILD_AT'
APP='$APP' MIX_ENV='$TARGET_MIX_ENV' $MIX_CMD phx.digest $SILENCE
"
fi
}