edeliver v1.4.5 Edeliver.Relup.Instructions.CheckRanchAcceptors

This upgrade instruction checks whether the ranch acceptors can be found.

This instruction will cause the upgrade to be canceled if the ranch acceptors cannot be found and because it is insterted before the “point of no return” it will run twice, once when checking the relup and once when executing the relup.

Link to this section Summary

Functions

Returns the name of the application

Calls the run/1 function of this module

Returns a list of module names which implement the behaviour Edeliver.Relup.RunnableInstruction

Returns the pid of the phoenix endpoint supervisor

Inserts the instruction before the point of no return

Modifies the relup file

Gets the supervisor child ids of the ranch socket accecptors

Gets the pid of the supervisor which supervises the ranch socket acceptors

Gets the pid of the ranch listener supervisor

Checks whether the ranch acceptors can be found

Link to this section Functions

Link to this function arguments(instructions, config)
arguments(
  %Edeliver.Relup.Instructions{
    changed_modules: term(),
    down_instructions: term(),
    down_version: term(),
    up_instructions: term(),
    up_version: term()
  },
  Edeliver.Relup.Config.t()
) :: term()

Returns the name of the application.

This name is taken as argument for the run/1 function and is required to access the acceptor processes through the supervision tree

Link to this function call_this(arguments \\ [])
call_this(arguments :: [term()]) ::
  Instruction.instruction() | Instruction.instructions()

Calls the run/1 function of this module

from the relup file during hot code upgrade

Link to this function dependencies()
dependencies() :: [instruction_module :: atom()]

Returns a list of module names which implement the behaviour Edeliver.Relup.RunnableInstruction

and are used / referenced by this runnable instruction. These modules must be loaded before this instruction is executed for upgrades and unloaded after this instruction for downgrades. Default is an empty list.

Callback implementation for Edeliver.Relup.RunnableInstruction.dependencies/0.

Link to this function endpoint(otp_application_name)
endpoint(otp_application_name :: atom()) :: pid()

Returns the pid of the phoenix endpoint supervisor

or throws and logs an error if it cannot be found. It supervises the Phoenix.Endpoint.Server which supervises the connections and acceptors, Phoenix.Config and the phoenix pubsub supervisor, e.g. Phoenix.PubSub.PG2.

Link to this function insert_where()
insert_where() :: Instruction.insert_fun()

Inserts the instruction before the point of no return.

This causes the release handler to abort the upgrade already when running :release_handler.check_install_release/1 if this instruction fails.

Link to this function modify_relup(instructions, config)

Modifies the relup file.

Modifies the relup file which will be used to upgrade (or downgrade) from one version to another by inserting, removing, or shifting appup instructions. See Edeliver.Relup.InsertInstruction and Edeliver.Relup.ShiftInstruction for useful helpers to insert / position the instructions and Edeliver.Relup.RunnableInstruction to execute custom code during the upgrade.

Callback implementation for Edeliver.Relup.Instruction.modify_relup/2.

Link to this function ranch_acceptors(ranch_acceptors_sup)
ranch_acceptors(ranch_acceptors_sup :: pid()) :: [:supervisor.child_id()]

Gets the supervisor child ids of the ranch socket accecptors

(ranch_acceptor) from the ranch acceptor supervisor or throws and logs an error if the acceptors cannot be found.

Link to this function ranch_acceptors_sup(ranch_listener_sup)
ranch_acceptors_sup(ranch_listener_sup :: pid()) :: pid()

Gets the pid of the supervisor which supervises the ranch socket acceptors.

If it cannot be found as child of the given ranch listener supervisor it throws and logs an error.

Link to this function ranch_listener_sup(otp_application_name)
ranch_listener_sup(otp_application_name :: atom()) :: pid()

Gets the pid of the ranch listener supervisor

(:ranch_listener_sup) which supervises the ranch acceptors supervisor (:ranch_acceptors_sup) and the connections supervisor (:ranch_conns_sup). It throws and logs an error if they cannot be found in the supervison tree of the application.

Link to this function run(otp_application_name)
run(otp_application_name :: atom()) :: :ok

Checks whether the ranch acceptors can be found.

If not the upgrade will be canceled. This function runs twice because it is executed before the “point of no return”, once when checking the relup and once when executing the relup.