View Source Edeliver.Relup.Modification behaviour (edeliver v1.9.2)
This behaviour can be used to provide custom modifications of relup instructions
when a release upgrade is built by edeliver.
By default the implementation from Edeliver.Relup.PhoenixModification
is used
for phoenix applications and for all others the implementation from
Edeliver.Relup.DefaultModification
.
Implementations can modify the relup instructions step by step by using
modules implementing the Edeliver.Relup.Instruction
behaviour.
The implementation returning the highest priority/0
or which is passed by the
--relup-mod=
command line option will be used unless the --skip-relup-mod
option is set.
Example:
defmodule Acme.Relup.Modification do
use Edeliver.Relup.Modification
def modify_relup(instructions = %Instructions{}, config = %{}) do
instructions |> Edeliver.Relup.DefaultModification.modify_relup(config) # use default modifications
|> log_upgrade # add custom modification which logs the upgrade
end
defp log_upgrade(instructions = %Instructions{up_instructions: up_instructions}) do
log_instruction = {apply, {:Elixir.Logger, info, [<<"Upgraded successfully">>]}}
%{instructions| up_instructions: [log_instruction|up_instructions]}
end
end
Link to this section Summary
Callbacks
Modifies the relup instructions and returns the modified instruction
Functions
Default priority for builtin relup modifications
Priority lower as the default priority which can be used temporarily to disable user defined relup modifications and use the defaults
Default priority for user defined relup modificaitons
Link to this section Callbacks
@callback modify_relup(Edeliver.Relup.Instructions.t(), Edeliver.Relup.Config.t()) :: Edeliver.Relup.Instructions.t()
Modifies the relup instructions and returns the modified instruction
Link to this section Functions
@spec priority_default() :: 1
Default priority for builtin relup modifications
@spec priority_none() :: 0
Priority lower as the default priority which can be used temporarily to disable user defined relup modifications and use the defaults
@spec priority_user() :: 1000
Default priority for user defined relup modificaitons