LemonCore.Runtime.Boot (lemon_core v0.1.0)

View Source

Orchestrates the Lemon runtime boot sequence.

This module centralises the startup logic that previously lived in the bin/lemon shell script. The script is kept as a thin CLI wrapper that sets environment variables and then calls into this module.

Boot sequence

  1. Load .env from dotenv_dir (if present).
  2. Reject dev Erlang distribution cookie in production releases.
  3. Apply port values from the resolved Env struct to the OTP application environment.
  4. Start each application in the requested Profile in order.

Usage (from a mix eval or release boot)

LemonCore.Runtime.Boot.start(:runtime_full)

# with explicit env override
env = %LemonCore.Runtime.Env{control_port: 5050}
LemonCore.Runtime.Boot.start(:runtime_min, env: env)

Summary

Functions

Starts a Lemon runtime using the given profile name.

Like start/2 but halts the BEAM on failure.

Returns a summary of which apps in profile_name are currently started.

Functions

start(profile_name \\ :runtime_full, opts \\ [])

@spec start(
  atom(),
  keyword()
) :: :ok | {:error, {atom(), term()}}

Starts a Lemon runtime using the given profile name.

Options

  • :env - a LemonCore.Runtime.Env struct; defaults to Env.resolve/0.
  • :dotenv_dir - override the dotenv directory (default: env.dotenv_dir).
  • :check_running - when true (default), abort if a runtime is already running on the control-plane port.

start!(profile_name \\ :runtime_full, opts \\ [])

@spec start!(
  atom(),
  keyword()
) :: :ok

Like start/2 but halts the BEAM on failure.

Used by bin/lemon where the process runs with --no-halt — without this, a boot failure would leave the BEAM sitting idle with no apps running and no error visible to the user.

status(profile_name \\ :runtime_full)

@spec status(atom()) :: map()

Returns a summary of which apps in profile_name are currently started.