Macaw.Host.Ctl.Description (macaw_host v0.1.4)

Copy Markdown View Source

The app description <app>-ctl is generated from: the :ctl key of the app's mix.exs project config, checked once here so the templates can trust every value.

ctl: [
  name: "astex",
  image: "gitlab.conet.yarina.org:5005/dco-tek/astex",
  env_prefix: "ASTEX",
  release: "Astex.Release",
  uid: "2060:2060",
  port: 4000
]

Required:

KeyWhat it is
:namethe app's name: the script is <name>-ctl, its settings <name>.conf
:imagethe image, without a tag
:env_prefixthe release protocol's prefix: <PREFIX>_CTL_ARGS and the like
:releasethe release module whose config/0 and status/0 the script calls
:uidthe container user's fixed "uid:gid"
:portthe port the app listens on in the container, and the default PORT

Optional, with their defaults:

KeyDefaultWhat it is
:titlethe name, capitalizedthe app's name in prose
:otp_appthe project's :appnames the release's start script
:release_bin"/app/bin/<otp_app>"the release's start script in the image
:tag"latest"the default TAG
:network"bridge"the default NETWORK; "host" shares the host's
:container_data"/data"where the data volume is mounted
:docker_run_args"--restart unless-stopped"the default DOCKER_RUN_ARGS
:stop_timeout30seconds stop gives the app
:data_home"/srv/<name>"the data directory init offers
:seeds[]app config init seeds: [tz: :timezone, phx_host: :hostname, phx_scheme: "http"]
:migrate_keys[]{old key, config key, old default} that init --migrate carries from <name>-env
:settings[]the app's own host settings: {"KEY", "default", "help"}
:app_commands"ctl/app_commands.ex"the file defining Ctl.AppCommands, or false for none
:output"container/<name>-ctl"where the script is written

Any other key is an error: a misspelled optional key silently taking its default is the bug this refuses.

Summary

Functions

The checked description, with every default filled in and the values the templates derive (:script, :ids, the full :settings): {:ok, map}, or {:error, message} naming the first fault. otp_app is the project's :app, the default for :otp_app.

As new/2, raising ArgumentError with the message.

Types

t()

@type t() :: %{required(atom()) => term()}

Functions

new(description, otp_app \\ nil)

@spec new(keyword() | map() | nil, atom() | String.t() | nil) ::
  {:ok, t()} | {:error, String.t()}

The checked description, with every default filled in and the values the templates derive (:script, :ids, the full :settings): {:ok, map}, or {:error, message} naming the first fault. otp_app is the project's :app, the default for :otp_app.

new!(description, otp_app \\ nil)

@spec new!(keyword() | map(), atom() | String.t() | nil) :: t()

As new/2, raising ArgumentError with the message.