Mate.Config (Mate v0.1.5) View Source
The configuration for mate deployments is stored in your applications root
directory, in a file named .mate.exs
. This uses import Config
as you might
already be used to.
To get started you can use the mix task mix mate.init
to help generate one for you.
The configuration exists out of two parts:
1. Mate configuration
This configures mate
itself, a full example would be:
config :mate,
otp_app: :my_app,
driver: Mate.Driver.SSH,
mix_env: :prod,
clean_paths: ~w{_build rel priv/generated priv/static}
You can also customise the build steps that are executed, but more information
about that can be found in Mate.Pipeline
.
2. Remote configuration
You can specify one or more remotes, for example you could configure a staging and production environment. But you can add as many as you want, with whichever names you want to use.
A remote ends up as a %Mate.Remote{}
struct, so a very complete example is:
config :staging,
build_server: "build.example.com",
deploy_server: "www.example.com",
build_path: "/tmp/build/my-app",
release_path: "/opt/my-app",
build_secrets: %{
"prod.secret.exs" => "/home/elixir/secrets/prod.secret.exs"
}
If both servers are the same you can also opt to just configure server
instead
of having to specify both build_server
and deploy_server
. For small setups it
might be more likely for you to not have a separate build server yet.
config :staging,
server: "www.example.com",
You can also specify multiple deploy servers by turning them into a list as such:
config :staging,
deploy_server: ["www1.example.com", "www2.example.com", "www3.example.com"]
Link to this section Summary
Functions
Find a specific remote in the given config, or if there was no specific search query given it will just return the first one found as the default. This will return as a tuple.
Find a specific remote in the given config, or if there was no specific search
query given it will just return the first one found as the default. This will
return a Mate.Remote
struct or raise an error when there was nothing found.
Reads and parses the given configuration file.
Link to this section Types
Specs
t() :: %Mate.Config{ clean_paths: [String.t()], driver: atom(), driver_opts: keyword(), mix_env: atom(), module: String.t(), otp_app: atom(), remotes: [Mate.Remote.t()], steps: Mate.Pipeline.steps() | function() | nil }
Link to this section Functions
Specs
find_remote(config :: t(), remote :: atom() | String.t()) :: {:ok, Mate.Remote.t()} | {:error, any()}
Find a specific remote in the given config, or if there was no specific search query given it will just return the first one found as the default. This will return as a tuple.
Specs
find_remote!(config :: t(), remote :: atom() | String.t()) :: Mate.Remote.t()
Find a specific remote in the given config, or if there was no specific search
query given it will just return the first one found as the default. This will
return a Mate.Remote
struct or raise an error when there was nothing found.
Specs
Reads and parses the given configuration file.