Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Elixir Deployment

Elixir Deployment

Talk given at Elixir London meetup 2017.

tetiana12345678

January 29, 2017
Tweet

More Decks by tetiana12345678

Other Decks in Programming

Transcript

  1. RELEASE IT! $ mix release ==> You are missing a

    release config file. Run the release.init task first
  2. REL/CONFIG.EXS #/rel/config file content ... include_ertc: false #needs to have

    erlang installed. ... release :app_name do set version: current_version(:app_name) end
  3. SOLUTION 1 SHORTEN LONG MODULE NAMES $ find . -type

    f -print| awk -F/ ' length($NF) > 99 '
  4. SOLUTION 2 PRODUCE TARBAL MANUALLY MIX_ENV=prod mix compile mix release

    --env=prod --no-tar cd /my_app/_build/prod tar -cvzf my_app.tar.gz
  5. POSSIBILITY 1 MANUALLY COPY .TAR.GZ TO THE PROD SERVER #

    copy release to prod server $ scp -i _build/prod/rel/my_app/releases/0.0.1\ /my_app.tar.gz user_name@server_name:/home/my_app/releases/0.0. my_app.tar.gz
  6. UNTAR IT # ssh to the server ssh user_name@server_name #

    untar your release on prod server tar -xzf ~/my_app.tar.gz
  7. CHECK IT'S WORKING # start it on prod server my_app/bin/my_app

    console # you should see the logs # start it as a daemon on prod server my_app/bin/my_app start my_app/bin/my_app ping # > pong
  8. CONTROL.TAR.GZ ARCHIVED CONTROL FILE Package: my.app Version: 1.0.0 Architecture: amd64

    Maintainer: Inflowmatix Priority: optional Description: Packaged on debian server
  9. CIRCLECI(2.0) BUILD RELEASE(NO TAR) cd my_app if [ "${CIRCLE_BRANCH}" ==

    "master" ]; then MIX_ENV=prod mix compile mix release --env=prod --no-tar --verbose ...
  10. PREPARE DATA.TAR.GZ ... cd /my_app chmod 755 _build/prod/rel/my_app/bin/my_app ... mkdir

    -p /my_app/package/ cd /my_app/_build/prod/ tar --xform="s%^%/home/my_app/%"\ -cvzf /my_app/package/data.tar.gz rel/
  11. PREPARE CONTROL.TAR.GZ ... mkdir -p package/control cd package/control printf "Package:

    ..." >> control; tar -zcf /my_app/package/control.tar.gz .
  12. CREATE .DEB PACKAGE ... cd /my_app/ version=$(git describe | sed

    's/v//'); mkdir releases ar -rc releases/my_app_$version.deb\ package/debian-binary package/control.tar.gz\ package/data.tar.gz rm -rf package/ fi
  13. SUMMARY LOT'S OF OPTIONS 3 PIECES NEEDED TO PRODUCE .DEB

    PACKAGE COULD BE FRUSTRATING, BUT DON'T GIVE UP! CHECK WHERE YOU ARE BUILDING A RELEASE