edeliver v1.2.7 Edeliver.Relup.Instructions.SuspendRanchAcceptors

This upgrade instruction suspends the ranch acceptors

to avoid that new connections will be accepted. It will be inserted right after the “point of no return”. When the upgrade is done, the

Edeliver.Relup.Instructions.ResumeRanchAcceptors

instruction reenables the acceptors again. To make sure that the ranch acceptors are found, use this instruction after the

Edeliver.Relup.Instructions.CheckRanchAcceptors

instruction which will abort the upgrade if the acceptors cannot be found. Because real suspending of ranch acceptors is not possible because ranch acceptors do not handle sys messages, they are actually terminated. Unfortunately the ranch acceptor supervisor cannot be suspended in adition to avoid starting new acceptors, because supervisors can’t be suspended because the supervision tree is used to find processes which uses callback modules. Since no acceptors are started dynamically this can be ignored. Use the

Edeliver.Relup.Instructions.ResumeRanchAcceptors

instruction at the end of your instructions list to reenable accepting tcp connection when the upgrade is done.

Summary

Functions

Returns 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

Calls the run/1 function of this module

Logs a debug message using the Logger on the running node which is upgraded

This module requires the Edeliver.Relup.Instructions.CheckRanchAcceptors module which must be loaded before this instruction for upgrades and unload after this instruction for downgrades

Ensures that all Edeliver.Relup.RunnableInstruction modules used / referenced by this instruction and returned by the dependencies/0 callback are loaded before this instruction is executed during the upgrade

Ensures that all Edeliver.Relup.RunnableInstruction modules used / referenced by this instruction and returned by the dependencies/0 callback are unloaded after this instruction is executed during the downgrade

Logs an error using the Logger on the running node which is upgraded

Formats and prints the message on the node

Logs an info message using the Logger on the running node which is upgraded

Appends this instruction to the instructions after the “point of no return” but before any instruction which loads or unloads new code, (re-)starts or stops any running processes, or (re-)starts or stops any application or the emulator

Logs the message of the given type on the node

Suspends all ranch acceptors to avoid handling new requests / connections during the upgrade. Because suspending of ranch acceptors is not possible they are terminated. In addition the ranch acceptor supervisor is suspended to avoid starting new acceptors

Logs a warning using the Logger on the running node which is upgraded

Macros

Assumes that the pattern matches or throws an error with the given error message

Types

insert_fun :: (%Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions, new_instructions :: instruction | instructions -> updated_instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions)
instruction :: :relup.instruction

Functions

arguments(instructions, config)

Specs

arguments(%Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term}, %ReleaseManager.Config{dev: term, env: term, erl: term, name: term, package: term, relx_config: term, upgrade?: term, verbosity: term, version: term}) :: term

Returns 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 |
  instructions

Calls the run/1 function of this module

from the relup file during hot code upgrade

debug(message)

Specs

debug(message :: String.t) :: no_return

Logs a debug message using the Logger on the running node which is upgraded.

In addition the same debug message is logged on the node which executes the upgrade and is displayed as output of the $APP/bin/$APP upgarde $RELEASE command.

dependencies()

Specs

dependencies :: [instruction_module :: atom]
dependencies :: [Edeliver.Relup.Instructions.CheckRanchAcceptors]

This module requires the Edeliver.Relup.Instructions.CheckRanchAcceptors module which must be loaded before this instruction for upgrades and unload after this instruction for downgrades.

ensure_dependencies_loaded_before_instruction_for_upgrade(instructions, call_this_instruction, dependencies \\ dependencies())

Specs

ensure_dependencies_loaded_before_instruction_for_upgrade(instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term}, runnable_instruction :: {:apply, {module :: atom, :run, arguments :: [term]}}, dependencies :: [instruction_module :: atom]) :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term}

Ensures that all Edeliver.Relup.RunnableInstruction modules used / referenced by this instruction and returned by the dependencies/0 callback are loaded before this instruction is executed during the upgrade.

ensure_dependencies_unloaded_after_instruction_for_downgrade(instructions, call_this_instruction, dependencies \\ dependencies())

Specs

ensure_dependencies_unloaded_after_instruction_for_downgrade(instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term}, runnable_instruction :: {:apply, {module :: atom, :run, arguments :: [term]}}, dependencies :: [instruction_module :: atom]) :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term}

Ensures that all Edeliver.Relup.RunnableInstruction modules used / referenced by this instruction and returned by the dependencies/0 callback are unloaded after this instruction is executed during the downgrade.

error(message)

Specs

error(message :: String.t) :: no_return

Logs an error using the Logger on the running node which is upgraded.

In addition the same error message is logged on the node which executes the upgrade and is displayed as output of the $APP/bin/$APP upgarde $RELEASE command.

format_in_upgrade_script(format, arguments)

Specs

format_in_upgrade_script(format :: char_list, arguments :: [term]) :: no_return

Formats and prints the message on the node

running the upgrade script which was started by the $APP/bin/$APP upgrade $RELEASE command.

info(message)

Specs

info(message :: String.t) :: no_return

Logs an info message using the Logger on the running node which is upgraded.

In addition the same info message is logged on the node which executes the upgrade and is displayed as output of the $APP/bin/$APP upgarde $RELEASE command.

insert_where()

Specs

insert_where :: insert_fun

Appends this instruction to the instructions after the “point of no return” but before any instruction which loads or unloads new code, (re-)starts or stops any running processes, or (re-)starts or stops any application or the emulator.

log_in_upgrade_script(type, message)

Specs

log_in_upgrade_script(type :: :error | :warning | :info | :debug, message :: String.t) :: no_return

Logs the message of the given type on the node

which executes the upgrade and displays it as output of the $APP/bin/$APP upgrade $RELEASE command. The message is prefixed with a string derived from the message type.

modify_relup(instructions, config)

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

run(otp_application_name)

Specs

run(otp_application_name :: atom) :: :ok

Suspends all ranch acceptors to avoid handling new requests / connections during the upgrade. Because suspending of ranch acceptors is not possible they are terminated. In addition the ranch acceptor supervisor is suspended to avoid starting new acceptors.

warn(message)

Specs

warn(message :: String.t) :: no_return

Logs a warning using the Logger on the running node which is upgraded.

In addition the same warning message is logged on the node which executes the upgrade and is displayed as output of the $APP/bin/$APP upgarde $RELEASE command.

Macros

assume(assertion, error_message)

Assumes that the pattern matches or throws an error with the given error message.

The error message is logged as error to the logfile using the Logger and displayed as error output by the $APP/bin/$APP upgrade $RELEASE task using the $APP/ebin/install_upgrade.escript script. If the pattern matches the variables from the matching are assigned.