Deploying with Edeliver - SolarisJapan/lunaris-wiki GitHub Wiki

Production: Deployment

We use https://github.com/edeliver/edeliver to deploy most of our Elixir applications.

Using Upgrades

We are deploying via edeliver, mainly using upgrades.

Deploying upgrades takes longer to build, but will ensure a seamless deployment. However, especially when you have major changes in CSS or Javascript, or if you changed something in the function signature of long running processes, it is recommended to do a server restart.

To deploy build an upgrade first create a Bump version (v0.1.2) commit, and update the project version in mix.exs (versioning follows the semantic versioning conventions) :fire: This is important, because we are using the version bump commits as the --from option to build our upgrade!

# Example:
def project do
  [
    app: :my_app,
    version: "0.1.2",
    # ...
=> mix edeliver build upgrade --from=[last-version-bump-commit]
# Example:
# commits:
# * 123c12 Version bump (0.1.12) (this is the version bump we created earlier)
# * 0990a2 Your important fix
# * 001ba2 Some new feature
# * 091b12 Version bump (0.1.11) (this is the currently deployed version)
=> mix edeliver build upgrade --from=091b12

and deploy the upgrade

=> mix edeliver deploy upgrade to production

Done.

Full deploy

This will restart the server and result in a downtime of a few seconds.

=> mix edeliver update production

Afterwards we should make we're using the latest release we just deployed by removing the old data file

=> rm apps/my_app/var/start_erl.data

Production: Restart

Restarts can either be done via mix edeliver restart production or directly on the server:

  • connect to the server via ssh as deploy
  • run apps/my_app/bin/my_app restart