MonoRepo v0.2.0 MonoRepo.Release View Source

Release holds functions for building dependencies and releases list from custom configuration.

For proper work you need to create a separate mix.exs, definition.exs and "release name".exs files in rel folder in project's root. Mix project configurations for development and for releasing with MonoRepo pattern are quite different, so we create a separate mix.exs for releases. definition.exs describes our releases using Config module. Root key of a configuration must be a release name. :applications attribute should be a list of applications' names in a specific format which will be passed by this module's functions. The valid format for app name is path/to/app. Be sure to avoid mentioning apps folders in your paths. For example if your app is nested like root_app/apps/app1/apps/app2, you should refer to it as app1/app2. All the other release options found in Mix.Release documentation can be passed as is. The last file we need is a "release name".exs. It's your compile-time configuration for your release. It should be used for :config_path attribute of mix project configuration. This way you can keep release-specific configuration nice and tidy and do not load unnecessary configuration attributes. To make a release use MIX_EXS environment variable set to the release MixProject file, for example:

MIX_EXS=rel/mix.exs mix release set0

definitions.exs sample:

import Config

config :set0,
  applications: ["child0", "child1/child2"],
  strip_beams: false

config :set1,
  applications: ~w(child3/child4/child5 child6/child7)

Link to this section Summary

Functions

Returns release-specific configuration file path.

Builds a list of dependencies from rel/definitions.exs.

Builds a standard releases list with all applications set to permanent mode.

Link to this section Functions

Link to this function

build_config_path()

View Source
build_config_path() :: Path.t()

Returns release-specific configuration file path.

It relies on release name from passed arguments. So NIX_EXS=rel/mix.exs mix release set0 will assign config_path to rel/set0.exs in case mentioned mix.exs uses this module's config_path function.

Link to this function

build_deps()

View Source
build_deps() :: [{atom(), [{:path, String.t()}]}]

Builds a list of dependencies from rel/definitions.exs.

All dependencies will get released the same way your main application will. This way you can add any application or nested application at any level to your final release.

Link to this function

build_releases()

View Source
build_releases() :: [{atom(), [{:applications, [{atom(), :permanent}]}]}]

Builds a standard releases list with all applications set to permanent mode.

Other modes are not yet supported. Requires a rel/definitions.exs to read release setup. This function must always be used since there is no default release, so building one requires a name and that requires a release declaration.