View Source Mix.Release (Mix v1.17.2)
Defines the release structure and convenience for assembling releases.
Summary
Functions
The Mix.Release struct has the following read-only fields
Copies the given application specification into the release.
Copies the ebin directory at source
to target
respecting release options such a :strip_beams
.
Copies ERTS if the release is configured to do so.
Makes boot scripts.
Copies the cookie to the given path.
Makes the start_erl.data file with the ERTS version and release versions.
Makes the sys.config
structure.
Finds a template path for the release.
Strips a beam file for a release.
Types
@type application() :: atom()
@type mode() :: :permanent | :transient | :temporary | :load | :none
@type t() :: %Mix.Release{ applications: %{required(application()) => keyword()}, boot_scripts: %{required(atom()) => [{application(), mode()}]}, config_providers: [{module(), term()}], erts_source: charlist() | nil, erts_version: charlist(), name: atom(), options: keyword(), overlays: [String.t()], path: String.t(), steps: [(t() -> t()) | :assemble, ...], version: String.t(), version_path: String.t() }
Functions
The Mix.Release struct has the following read-only fields:
:name
- the name of the release as an atom:version
- the version of the release as a string:path
- the path to the release root:version_path
- the path to the release version inside the release:applications
- a map of application with their definitions:erts_source
- the ERTS source as a charlist (or nil):erts_version
- the ERTS version as a charlist
The following fields may be modified as long as they keep their defined types:
:boot_scripts
- a map of boot scripts with the boot script name as key and a keyword list with all applications that are part of it and their modes as value:config_providers
- a list of{config_provider, term}
tuples where the first element is a module that implements theConfig.Provider
behaviour andterm
is the value given to it onConfig.Provider.init/1
:options
- a keyword list with all other user supplied release options:overlays
- a list of extra files added to the release. If you have a custom step adding extra files to a release, you can add these files to the:overlays
field so they are also considered on further commands, such as tar/zip. Each entry in overlays is the relative path to the release root of each file:steps
- a list of functions that receive the release and returns a release. Must also contain the atom:assemble
which is the internal assembling step. May also contain the atom:tar
to create a tarball of the release.
@spec copy_app(t(), application()) :: boolean()
Copies the given application specification into the release.
It assumes the application exists in the release.
Copies the ebin directory at source
to target
respecting release options such a :strip_beams
.
Copies ERTS if the release is configured to do so.
Returns true
if the release was copied, false
otherwise.
@spec make_boot_script(t(), Path.t(), [{application(), mode()}], [String.t()]) :: :ok | {:error, String.t()}
Makes boot scripts.
It receives a path to the boot file, without extension, such as
releases/0.1.0/start
and this command will write start.rel
,
start.boot
, and start.script
to the given path, returning
{:ok, rel_path}
or {:error, message}
.
The boot script uses the RELEASE_LIB environment variable, which must
be accordingly set with --boot-var
and point to the release lib dir.
Copies the cookie to the given path.
If a cookie option was given, we compare it with the contents of the file (if any), and ask the user if they want to override.
If there is no option, we generate a random one the first time.
Makes the start_erl.data file with the ERTS version and release versions.
@spec make_sys_config(t(), keyword(), Config.Provider.config_path()) :: :ok | {:error, String.t()}
Makes the sys.config
structure.
If there are config providers, then a value is injected into
the :elixir
application configuration in sys_config
to be
read during boot and trigger the providers.
It uses the following release options to customize its behavior:
:reboot_system_after_config
:start_distribution_during_config
:prune_runtime_sys_config_after_boot
In case there are no config providers, it doesn't change sys_config
.
Finds a template path for the release.
Strips a beam file for a release.
This keeps only significant chunks necessary for the VM operation, discarding documentation, debug info, compile information and others.
The exact chunks that are kept are not documented and may change in future versions.