Files
ermnvldmr.com/services/docs/content/en/apex/reference/engine-api.md
T
deytenit b3638f4d63 fix: cyrillic fonts, dev certs, page head, and ru-text typography (#67)
šŸ¤– PR generated for branch `fix/cyrillic-fonts-dev-certs-and-page-head`.

### Changes Summary
- **Fonts**: Add Cyrillic glyph subsets for Lato, EB Garamond, and Fira
Code.
- **Dev**: Support remote Root CA and encrypted dev CA key in
`.env.dev`.
- **UI & Kits**: Add size variant to `Breadcrumbs` component and enlarge
`PageHead` breadcrumbs with tuned collapse scroll threshold.
- **ESLint**: Add `no-hanging-particles` i18n & markdown typography rule
with auto-fixer.
- **Content & i18n**: Apply `ru-text` editorial and typography polish
(em dashes, number ranges, «ё» restoration, non-breaking spaces) across
`services/www` and `services/docs`.
2026-10-25 15:21:09 +03:00

5.2 KiB

title, description, weight
title description weight
Engine API reference TheĀ descriptor andĀ ctx APIs available toĀ action authors. 34

TheĀ surface anĀ action author programs against: theĀ argument descriptors inĀ engine.descriptor andĀ theĀ members ofĀ theĀ execution context. Conceptual background inĀ Concept: TheĀ execution context.

Descriptors

from engine.descriptor import Meta, Arg, Opt, Flag, Rest
Class Signature argparse mapping
Meta Meta(summary, args=[]) Drives both theĀ listing summary andĀ theĀ parser.
Arg Arg(name, help="", required=True) Positional; required=False → nargs="?", default None.
Opt Opt(name, help="", default=None) Value option (--name VALUE) withĀ aĀ default.
Flag Flag(name, help="") Boolean store_true flag.
Rest Rest(name, help="") Greedy remainder (argparse.REMAINDER).

Usage errors exit 64 instead ofĀ argparse's default 2.

Warning

Rest captures everything after theĀ first positional — including flags. AĀ Flag declared next toĀ aĀ Rest isĀ only recognized before theĀ positional; anĀ action that must accept its flag anywhere has toĀ strip itĀ out ofĀ theĀ remainder itself (theĀ compose action does exactly this forĀ --dry-run).

ctx.log

info(msg) Ā· warn(msg) Ā· success(msg) → stdout; error(msg) → stderr. All lines carry theĀ [<node>] [<action>] [LEVEL] prefix.

ctx.sys

Method Behavior
run(cmd, check=True, capture=False, cwd=None, env=None, input=None) subprocess.run wrapper returning CompletedProcess; capture=True collects text stdout/stderr.
sudo(cmd, **kw) run(["sudo", *cmd]).
ok(cmd, **kw) True iff exit 0; never raises.
service_exists(name) / service_is_active(name) / service_is_enabled(name) systemd unit queries.
start_and_enable(name) Start + enable when needed; returns final active state.
ensure_running(name) enable --now when inactive.
restart(name) / reload(name, dry_run=False) / daemon_reload() Service lifecycle.
wait_for(name, timeout=30, interval=2) Poll until active.
install_packages(packages) ForĀ each package: skip when its binary isĀ onĀ PATH, else apt-get update -y + apt-get install -y.

ctx.tpl

Method Behavior
render(path, vars) Render one file (relative paths resolve against configs/); safe_substitute semantics — unknown variables stay literal.
render_dir(rel_dir, vars) Render every file under aĀ configs/ subtree; returns {relative_path: content}.

ctx.host

Method Behavior
backup(path, sudo=False) Copy theĀ file toĀ <path>.<epoch>.bak; returns theĀ backup path orĀ None.
write_file(path, content, backup=True, dry_run=False, sudo=False) Atomic install via temp file (mode 0644); optional prior backup; sudo variant preserves anĀ existing target's mode.
inject_block(target, content, start, end, anchor=None, old_pairs=(), dry_run=False, sudo=True) Managed marker-block replacement; removes current andĀ legacy blocks, inserts after theĀ first anchor line; False when theĀ anchor isĀ missing; missing target isĀ anĀ error.
install_crontab(text, dry_run=False) Snapshot, refuse empty render (SystemExit(65)), preview, install via crontab -, restore snapshot onĀ failure (SystemExit(1)).

ctx.ufw

apply(rules_dir, config_dir=None, dry_run=False) — theĀ full firewall pass: directory guards (exit 66), tool guards (ufw, ufw-docker), host rules, managed-block injection intoĀ /etc/ufw/before.rules andĀ after.rules, container rules fromĀ *.rules files.

ctx.crowdsec

ensure_installed() Ā· deploy(configs_subdir, vars, dry_run=False) Ā· install_collections(collections).

ctx.systemd

deploy_units(configs_subdir, vars, dry_run=False) — render theĀ subtree's top-level non-hidden files intoĀ /etc/systemd/system/, then daemon-reload andĀ enable --now each .service.

ctx.notify

telegram(title, bot_url, message, node=None, level="INFO") plus theĀ shorthands success / error / info / warn. All return bool — True only when theĀ message was delivered; anĀ empty bot_url logs aĀ warning andĀ returns False. TheĀ alert instance defaults toĀ theĀ node's public host (APEX_NODE_HOST) — noĀ domain orĀ node prefix isĀ applied.

ctx.paths andĀ ctx.node

ctx.paths: repo_root, commons, proprietaries, configs, compositions, core, tier1..3, stier1..3, root_tier1..3. ctx.node: theĀ identity record (name, subnet, fqdn, host) orĀ None inĀ aĀ standalone commons checkout. ctx.vars(): theĀ template/compose environment (see Reference: Environment variables). ctx.commons.run(args): delegate toĀ theĀ shadowed commons action — only valid inĀ anĀ overriding proprietary module.


See also: