edeliver_fork 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.

Summary

Functions

Returns the name of the application

Calls the run/1 function of this module

Returns the pid of the phoenix endpoint supervisor

Inserts the instruction before the point of no return

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

Functions

arguments(instructions, config)

Specs

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

call_this(arguments \\ [])

Specs

call_this(arguments :: [term]) ::
  Instruction.instruction |
  Instruction.instructions

Calls the run/1 function of this module

from the relup file during hot code upgrade

dependencies()

Specs

dependencies :: [instruction_module :: atom]
endpoint(otp_application_name)

Specs

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.

insert_where()

Specs

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.

modify_relup(instructions, config)
ranch_acceptors(ranch_acceptors_sup)

Specs

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.

ranch_acceptors_sup(ranch_listener_sup)

Specs

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.

ranch_listener_sup(otp_application_name)

Specs

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.

run(otp_application_name)

Specs

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.