к каталогу

📦 edeliver/ edeliver

Deployment for Elixir and Erlang

Открыть на GitHubобновлён 1нед назад
Звёзды
2.0k
Форки
187
За неделю
За месяц
Рост %
Язык
Shell

Установка и запуск

Quick Start

Assuming an Elixir project, you already have a build server and a staging server, and you've created a database on your staging server already (there is no ecto.create, we skip straight to migrations).

Add edeliver and your build tool (distillery) to your project dependencies in mix.exs:

def application, do: [
  applications: [
    ...
    # Add edeliver to the END of the list
    :edeliver
  ]
]

defp deps do
  [
    ...
    {:edeliver, ">= 1.9.2"},
    {:distillery, "~> 2.1", warn_missing: false},
  ]
end

If this is a Phoenix project, upload your prod.secret.exs to your build server somewhere. Let's say it's at /home/builder/prod.secret.exs.

In your project, create the file .deliver/config

# .deliver/config

APP="myapp"

BUILD_HOST="my-build-server.myapp.com"
BUILD_USER="builder"
BUILD_AT="/tmp/edeliver/myapp/builds"

STAGING_HOSTS="stage.myapp.com"
STAGING_USER="web"
DELIVER_TO="/home/web"

# For *Phoenix* projects, symlink prod.secret.exs to our tmp source
pre_erlang_get_and_update_deps() {
  local _prod_secret_path="/home/builder/prod.secret.exs"
  if [ "$TARGET_MIX_ENV" = "prod" ]; then
    __sync_remote "
      ln -sfn '$_prod_secret_path' '$BUILD_AT/config/prod.secret.exs'
    "
  fi
}

Add the release directory to your gitignore

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

Commit everything, compile the new dependencies:

git add -A && git commit -m "Setting up edeliver"
mix do deps.get, compile

Now you can release with edeliver!

mix edeliver update
mix edeliver start
mix edeliver migrate

Installation

Because it is based on deliver, it uses only shell scripts and has no further dependencies except the Erlang/Elixir build system.

It can be used with any one of these build systems:

  • mix in conjunction with distillery for elixir/erlang releases (recommended)
  • mix in conjunction with relx for elixir/erlang releases
  • rebar3 for pure erlang releases or in conjunction with rebar_mix plugin to build also Elixir sources and dependencies
  • rebar for legacy pure erlang releases

Edeliver tries to autodetect which system to use:

Из README репозитория · полный README на GitHub