Exrm releases seem extremely stable, but have some caveats:
- Require build environment to be very similar to deployment
- Require extra maintenance to ensure the correct application components are loaded by Erlang
- Requires a custom script to
scp
the release to the server
With these points in mind I decided to experiment with using a familiar Capistrano based workflow. Something along the lines of:
Capistrano deploys code -> Builds on server -> Upstart handles launch and keep-alive
Sadly however this didn't seem practical when it comes to Exrm's upgrade and downgrade. Instead I ended up creating a custom shell script.
It handles:
- Uploading all code to the remote server
- Compiling an Exrm release, the current version is detected from
mix.exs
- Move release to app directory
- Run hot upgrade with Exrm
- Runs migrations on server
The script below is targeted to a project which uses Webpack in an app
directory. If your project uses Brunch some minor modification may be necessary.
Create a file called exdeploy
in the root of your project containing the code from the Gist at the end of this article.
Dont forget to chmod +x ./exdeploy
to make it executable.