edeliver v1.5.1 Edeliver

Execute edeliver tasks on the production / staging nodes.

This internal module provides functions on the nodes which are used by some edeliver tasks e.g. to get the running release version (edeliver version), show the pending migrations (edeliver show migrations) or install pending migrations (edeliver migrate).

In addition it represents the edeliver application callback module and starts a process registered locally as Edeliver whichs onliest purpose is to be able to detect whether the release was successfully started. This requires to start edeliver as last application in the release.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

Invoked when the server is started. start_link/3 or start/3 will block until it returns

Returns the current directory containing the ecto migrations

Waits until the edeliver application is started

Runs the edeliver command on the erlang node

Starts the edeliver application

Starts this gen-server registered locally as Edeliver

Link to this section Functions

Link to this function child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Invoked when the server is started. start_link/3 or start/3 will block until it returns.

args is the argument term (second argument) passed to start_link/3.

Returning {:ok, state} will cause start_link/3 to return {:ok, pid} and the process to enter its loop.

Returning {:ok, state, timeout} is similar to {:ok, state} except handle_info(:timeout, state) will be called after timeout milliseconds if no messages are received within the timeout.

Returning {:ok, state, :hibernate} is similar to {:ok, state} except the process is hibernated before entering the loop. See c:handle_call/3 for more information on hibernation.

Returning :ignore will cause start_link/3 to return :ignore and the process will exit normally without entering the loop or calling c:terminate/2. If used when part of a supervision tree the parent supervisor will not fail to start nor immediately try to restart the GenServer. The remainder of the supervision tree will be (re)started and so the GenServer should not be required by other processes. It can be started later with Supervisor.restart_child/2 as the child specification is saved in the parent supervisor. The main use cases for this are:

  • The GenServer is disabled by configuration but might be enabled later.
  • An error occurred and it will be handled by a different mechanism than the Supervisor. Likely this approach involves calling Supervisor.restart_child/2 after a delay to attempt a restart.

Returning {:stop, reason} will cause start_link/3 to return {:error, reason} and the process to exit with reason reason without entering the loop or calling c:terminate/2.

Callback implementation for GenServer.init/1.

Link to this function list_pending_migrations(application_name, application_version, ecto_repository \\ [])

Prints the pending ecto migrations

Link to this function migrate(application_name, application_version, ecto_repository, direction, migration_version \\ :all)

Runs the pending ecto migrations

Link to this function migrations_dir(application_name, application_version)

Returns the current directory containing the ecto migrations.

Link to this function monitor_startup_progress(application_name)
monitor_startup_progress(application_name :: atom()) :: :ok

Waits until the edeliver application is started.

If the edeliver application is added as last application in the :applications section of the application/0 fun in the mix.exs this waits until all applications are started. This can be used as rpc call after running the asynchronous bin/$APP start command to wait until all applications started and then return ok.

Link to this function release_version(application_name, application_version \\ nil)
release_version(application_name :: atom(), application_version :: String.t()) ::
  String.t()

Returns the running release version

which is either the :current version or the :permanent version.

Link to this function run_command(list)
run_command(args :: [term()]) :: no_return()

Runs the edeliver command on the erlang node

started as:

  bin/$APP rpc Elixir.Edeliver run_command '[[command_name, "$APP", arguments...]].'

The first argument must be the name of the command, the second argument the name of the main application and all further arguments are passed to the function thats name is equal to the command name.

Link to this function start(type, args)
start(term(), term()) :: {:ok, pid()}

Starts the edeliver application

including the Edeliver.Supervisor process supervising the Edeliver generic server.

Link to this function start_link()
start_link() :: {:ok, pid()}

Starts this gen-server registered locally as Edeliver