Project-scaffolding commands. Use this plugin to create a fresh umbrella with Marea wired up, or to bootstrap a release inside an existing project.
Always loaded (part of @base_plugins).
Commands
marea setup
├── init-marea (bootstrap marea.d/ in the current project)
├── init-umbrella --name <project>
└── init-release --app <umbrella-app>marea setup init-marea
Bootstraps Marea in the current project: creates a marea.d/
directory with configs/ and secrets/ subdirectories and a stub
marea.d/marea.yaml.
> marea setup init-marea
Created marea.d/marea.yaml and subdirs (configs/, secrets/)
Aborts if a config already exists at any of the discovery paths
(marea.yaml, config/marea.yaml, marea.d/marea.yaml). This is the
command Marea points you at on first run when no config is found — see
Installation → First run. Unlike every other
command, setup init-marea (and the other setup commands) run without an
existing marea.yaml.
marea setup init-umbrella --name <project>
Creates a new umbrella project named <project> next to the current
directory and wires Marea into it.
Steps performed:
mix new <project> --umbrellamix new <project>_sample --supinside<project>/apps/- Add a
{:marea, path: "<abs-path-to-marea-source>", runtime: false, only: :dev}entry to<project>/mix.exs(idempotent — does nothing if:mareais already listed). The path is the absolute location of the marea source checkout you ran this from, since marea is consumed from source (it is not published to hex). mix deps.get && mix compileinside the new umbrella.- Symlink the shipped Marea binary into the new umbrella as
<project>/marea.
After this command, cd <project> and start writing marea.yaml.
marea setup init-release --app <app>
Bootstraps a Mix release in the current project, using the named umbrella app as the entry point.
Steps performed:
- If
rel/doesn't exist, runmix release.init. - Write
rel/env.sh.eexfrom the embeddedpriv/templates/rel/env.sh.eextemplate — this is the Marea-flavoured env script that resolvesRELEASE_NODEfromNODE_NAME/NODE_HOST/RELEASE_COOKIE. Ifrel/already exists, you'll be asked before overwriting. - Use
Igniterto:- Add
releases: releases()to the project keyword inmix.exs. - Add or extend
releases/0with<app>: [applications: [<app>: :permanent]].
- Add
Other plugins can override the file content by implementing
Marea.Plugins.Base.marea_init_release_file/1 with the :env_sh_eex argument.
Implementation notes
init-umbrellainvokesmix newfor both the umbrella and the sample app viaLib.cmd!/3. They run withprefix: :build, so if you setcmd_prefix.buildinmarea.yaml(e.g. running builds inside a Linux container), the bootstrap commands honour it too.init-releaseuses Igniter to mutatemix.exsin a structured way: it walks the AST to find the project module, theproject/0function, andreleases/0, rather than doing string substitution. This makes it safe to re-run after manually editingmix.exs.
Source
lib/marea/plugins/setup.ex- Embedded template:
priv/templates/rel/env.sh.eex