Relisa
Relisa
Fast, simple, and composable deployment library for Elixir.
Installation
Just add relisa
to your project dependencies:
def deps do
[{:relisa, "~> 0.1.0"}]
end
Configuration
To get started, run mix relisa.init
in the root directory of your project.
This will create a config/relisa.exs
file for all of your relisa-specific configuration.
Here is an example of what one looks like:
use Mix.Config
config :relisa,
# Targets are specified with an {address, ssh_key_path} tuple
targets: [
{"ubuntu@54.68.138.247", "/vagrant/deploy.pem"}
],
# Hooks are Mix tasks that will be executed at certain life-cycle moments
# in Relisa
hooks: [
pre: ["phoenix.digest"]
]
Relisa uses ssh and scp to connect with your servers. Each target
should specify an address (username@ip_address_or_hostname
) and the path to an ssh key for that server.
Usage
Prepare a release
To ready your application for production, simply run mix relisa.prepare
. Relisa prefers Semantic Versioning and you can include the --major
, --minor
, or --patch
flags to specify how your version should be bumped. The default is --patch
.
Since Relisa automatically updates your version for you, you should commit the changes.
Deploy release
All you have to do is MIX_ENV=prod mix relisa.deploy
and relax. Relisa will run any hooks before deploying, package up your release, transport it to each of the targets
specified in your configuration, and start the application.
Note that you need to do this step on the same arch as your target. We use Vagrant to make this a snap. See this gist for the Vagrantfile
we use.
Upgrade
If Relisa detects that your application is already running, it will update the running application to the latest version. This utilizes hot-code reloading for zero-downtime deployments and upgrades.
Rollback
If your deployment had a bug and you’d like to roll back, that’s not a problem. mix relisa.rollback 1.0.0
(where 1.0.0
is the version you’d like to roll back to) and you’re good to go.
Hooks
Relisa is meant to be incredibly light-weight so you only load the tools you need. It can run mix tasks before a deployment as specified in the :hooks
configuration option. From digesting assets to commiting and pushing version changes, Relisa is incredibly extendable.