Skip to content

Extend edeliver (config) to fit your needs

bharendt edited this page Dec 3, 2015 · 1 revision

Extend edeliver config to fit your needs

You can easily extend the .deliver/config file to fit your needs.

It's a bash script which is loaded and executed before each edeliver task. So you can for example do something like that with a few lines:

Add confirmation before deploying to production:

If you like to be asked before destroying deploying something on to production, you can add something like this to the .deliver/config:

  __config_confirm() {
    echo ; echo "${2}${1}${txtrst}"; echo
    while true; do
      echo -n -e "\r${2}Are you sure? (y|n): ${txtrst}"
      read -n 1 option
      [ "$option" = "y" ] && echo && break
      [ "$option" = "n" ] && echo && exit 1
    done  
  }

  [[ "$COMMAND" = "deploy" ]]  && [[ "$DEPLOY_ENVIRONMENT" = "production" ]] && \
      __config_confirm "DEPLOYING TO PRODUCTION!" "${txtred}" && \
      __config_confirm "REALLY SURE????!" "${txtred}"
Install migration only on a single production host if your cluster uses the same database:

If you like to run the migrations always just on on a single production host, because serveral production hosts connect to the same database, you can either use the --host=single-production-host.com command line argument each time you run a migration like this...

  • edeliver migrate up --version=new-version --host=single-production-host.com

... or add something like this to the .deliver/config

  [[ "$COMMAND" =~ migrat.*  ]] && [[ "$DEPLOY_ENVIRONMENT" = "production" ]] && \
      PRODUCTION_HOSTS="single-production-host.com"
Allow to build a release and download it to localhost, not to the release store:

If you like to test and inspect your release before uploading it to the remote release store, where it can be deployed also by others, you can...

  • use a custom LOCAL flag for building: LOCAL=true mix edeliver build release
  • inspect the release in .deliver/releases/$RELEASE-$VERSION.tar.gz
  • test your release on a staging host mix edeliver deploy release to staging --version=$VERSION
  • upload it to the release store if you thinks it's ready to be deployed by everybody: edeliver upload release $VERSION

... if you add something like this to the .deliver/config

if [[ "$LOCAL" != "true" ]]; then # use remote release store
  RELEASE_STORE="[email protected]:~/releases"
else # use default local release store
  echo -e "\n${txtylw}Using local release store.${txtrst}"
fi