eDeliver

eDeliver automates the deployment of Elixir applications. Behind the scenes it uses exrm to package a release, and then uses SSH tunnels to execute remote commands.

Install it in your Phoenix project by adding it to both deps and applications. It should be the last item in your applications list.

mix.exs

def application, do: [ applications: [ # ... add it at the end :edeliver ] ] defp deps do [{:edeliver, "~> 1.2.9"}] end

Compile the new dependency.

mix do deps.get, compile

eDeliver requires a configuration file. This config tells it where the build and production/staging servers are, and can be configured further for special needs. For example, at the bottom of this config is a hook to symlink the secret configs you created on the build server into the project before building.

Create an eDeliver config (replace "example" with your project name, replace the server addresses with your own addresses or IPs).

APP="example" AUTO_VERSION="commit-count+git-revision+branch-unless-master" BUILD_AT="/tmp/erlang/example/builds" DELIVER_TO="/var/web" BUILD_HOST="build.app.example.com" BUILD_USER="builder" STAGING_HOSTS="stage.app.example.com" STAGING_USER="web" PRODUCTION_HOSTS="app.example.com" PRODUCTION_USER="web" pre_erlang_get_and_update_deps() { # copy it on the build host to the build directory when building if [ "$DEPLOY_ENVIRONMENT" = "production" ]; then local _secret_config_file_on_build_host="/home/builder/config/prod.secret.exs" else local _secret_config_file_on_build_host="/home/builder/config/stage.secret.exs" fi if [ "$TARGET_MIX_ENV" = "prod" ]; then status "Linking '$_secret_config_file_on_build_host' to build config dir" __sync_remote " ln -sfn '$_secret_config_file_on_build_host' '$BUILD_AT/config/prod.secret.exs' " fi }

Important

Up until now this guide assumes you only have one app server. Assuming that's all you have, put the same server in STAGING_HOSTS and PRODUCTION_HOSTS.

eDeliver will create a releases directory to store your packaged app. These can be quite large. Add this to your gitignore.

echo ".deliver/releases/" >> .gitignore

results matching ""

    No results matching ""