Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Yaroslav Martsynyuk - Deploying Elixir/Phoenix with Distillery

199 visualizaciones

Publicado el

Elixir Club Ternopil - March 25, 2017
Friendly Restoration "Mamont"

Publicado en: Tecnología
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Yaroslav Martsynyuk - Deploying Elixir/Phoenix with Distillery

  1. 1. Deploying Elixir/Phoenix w/ Distillery Elixir Club Ternopil, 2017 Yaroslav Martsynyuk @ Wise Engineering
  2. 2. What is Distillery and What it Does? - Elixir Release Manager - Builds Release Tarball - Describes the Set of Applications It Needs to Run - Builds Upgrades
  3. 3. 1 defp deps do 2 [{:distillery, "~> 1.2.2"}] 3 end Add Distillery As Dependency
  4. 4. $> mix release.init 1 use Mix.Releases.Config, 2 default_release: :foo, 3 default_environment: Mix.env, 4 5 environment :prod do 6 set include_erts: true 7 set cookie: :prod 8 end 9 10 release :foo do 11 set version: current_version(:foo) 12 end
  5. 5. $> MIX_ENV=prod mix deps.get --only prod $> MIX_ENV=prod mix compile $> MIX_ENV=prod mix release [--upgrade] --env=prod VERSION - 1 => VERSION => VERSION + 1 Create Release/Upgrade
  6. 6. 1 #! /usr/bin/env 2 3 if["$(ssh user@host /tmp/bin/demo ping)" = "pong" ]; then 4 bash ./upgrade.sh 5 else 6 cd ~/demo 7 export V=$(grep 'version' mix.exs | cut -d'"' -f2) 8 mix release.init 9 MIX_ENV=prod mix deps.get --only prod 10 MIX_ENV=prod mix compile 11 MIX_ENV=prod mix release --env=prod 12 scp ./releases/${V}/demo.tar.gz user@host:/tmp 13 ssh user@host tar -xf demo.tar.gz -C /tmp 14 ssh user@host /tmp/bin/demo start 15 fi
  7. 7. 1 #! /usr/bin/env 2 3 cd ~/demo 4 export V=$(grep 'version' mix.exs | cut -d'"' -f2) 5 MIX_ENV=prod mix deps.get --only prod 6 MIX_ENV=prod compile 7 MIX_ENV=prod mix release --env=prod --upgrade 8 scp ./releases/${V}/demo.tar.gz user@host:/tmp/releases/${V} 9 ssh user@host /tmp/bin/demo upgrade ${VERSION}
  8. 8. 45.55.215.61 CI Node 45.55.191.102 Production Node http://45.55.191.102:4000 Demo Time
  9. 9. . . .
  10. 10. ?

×