Shoehorn
Shoehorn provides full control over the application lifecycle in Elixir.
Usage
Shoehorn acts as a shim to the initialization sequence for your application’s
VM. Using Shoehorn, you can ensure that the VM will always pass initialization.
This provides the running target the ability of using Elixir / Erlang to control
the full application lifecycle through the exposure of new system phases.
Heres how it works.
Include shoehorn into your application release plugins.
# rel/config.exs
release :simple_app do
set version: current_version(:simple_app)
plugin Shoehorn
endAnd produce a release
$ mix release
Go to the release directory and boot your app using shoehorn
$ _build/dev/rel/simple_app/bin/simple_app console_boot shoehorn
From here we can see that the shoehorn was started, but simple_app was not.
iex(simple_app@127.0.0.1)1> Application.started_applications
[{:iex, 'iex', '1.4.0'}, {:shoehorn, 'shoehorn', '0.1.0'},
{:elixir, 'elixir', '1.4.0'}, {:compiler, 'ERTS CXC 138 10', '7.0.3'},
{:stdlib, 'ERTS CXC 138 10', '3.2'}, {:kernel, 'ERTS CXC 138 10', '5.1.1'}]
Now lets configure shoehorn to do something more interesting by adding some
general configuration.
Lets have it start our application and initialize some apps before our app starts
# config/config.exs
config :shoehorn,
overlay_path: "/tmp/erl_shoehorn",
init: [:runtime_app],
app: :simple_app