bunops
Описание
Языки
- TypeScript99,9%
- Dockerfile0,1%
bunops
Minimal bun CLI scaffold.
Localizations
- Russian: docs/ru/README.md
Quality Checks
Usage
Git source
For git source, provide a repo URL via or .
Optional selects a branch, tag, or commit. If omitted, the default
remote branch is used.
SSH/credentials are handled by git itself. Use your normal setup, for example:
S3 source
Uses Bun's built-in S3 client.
You can also use explicit flags:
Credentials and endpoint can be provided via environment variables:
State
State is written to by default (override with ).
Agent node status is written to by default (override with ).
Node ID defaults to hostname (override via or ).
Default mode for node-state file is (override with , e.g. ).
Durability fsync for node-state writes is disabled by default for performance.
Enable with when strict crash-consistency is required.
Example:
Locking
To prevent concurrent runs, a lockfile is created at by default.
Override with and TTL (stale detection) with .
If a stale lock is detected, it will be removed and the run will continue.
Reconcile
runs a single reconcile cycle. runs continuously on an interval
(default , override with ).
Fleet directives
Agent reads fleet directives from by default
(override with ).
Supported payload fields:
(freeze): skip reconcile and publishboolstatus=frozen(desiredRevision): overridesstring--rev(pause): sync source, do not apply tasks (boolmode)check(reconcileIntervalOverride): overrides agent loop intervalduration(mode):report|enforceforcesreportmodecheck,rolloutWave(rolloutId): propagated intostringnode-state.json
Precedence:
- directives override CLI/config (
overdesiredRevision, interval override over--rev)--interval orpause=trueforce no-apply reconcile (mode=report)check
Safety:
- missing directives file => defaults
- invalid JSON => warning + defaults (agent continues)
Orchestrator CLI (SSH)
manages fleet nodes over SSH using file backend ( / ).
Commands:
- orch status --inventory <...>
- orch freeze --inventory <...> [--limit ...]
- orch unfreeze --inventory <...> [--limit ...]
- orch pin --inventory <...> --revision <sha> [--limit ...]
- orch unpin --inventory <...> [--limit ...]
- orch set --inventory <...> --file directives.json [--limit ...]
Common options:
: parallel hosts (default--parallel <n>)10: timeout per host (default--timeout-ms <n>)10000,--user,--port: SSH connection options--identity:--limithost-1,host-2,@group
Status output options:
: machine-readable output for CI--json: filter rows--only failed|drift|frozen: custom table columns--columns host,nodeId,status,currentRevision,desiredRevision,lastRun,drift,error
Remote file paths:
(status), default--node-state-path/var/lib/bunops/node-state.json(write commands), default--directives-path/var/lib/bunops/fleet-directives.json
Playbook is read from inside the synced source directory
(override with ).
You can set a root path inside the repo for all relative lookups:
Then resolves to ,
and roles/templates/files/inventory resolve relative to that root.
Minimal playbook example:
Supported tasks:
:shell, optionalcommand,timeoutMscwd:copy,src, optionaldest,mode,ownergroup:template,src, optionaldest,mode,ownergroup:package, optionalname(present/latest/absent),state(apt/dnf/yum),managersudo:service, optionalname(started/stopped/restarted),state,enabledsudo:user, optionalname(present/absent),state,shell,home,groupssudo:group, optionalname(present/absent),statesudo
Shell commands run via Bun Shell (pipes and redirects supported).
Handlers
Tasks can notify handlers. Handlers run once per reconcile cycle, even if multiple tasks notify them.
can be a string or a list of handler names.
Plugins
Custom modules are discovered from:
- plugins/modules/*.js
- modules.d/*.js
Plugin contract:
- export
object withdefaultandtyperun(context) returnsrun{ changed: boolean, stdout?: string, stderr?: string }
Example plugin and playbook are in:
- examples/plugins/modules/line_append.js
- examples/plugin-playbook.yml
Details:
Variables
Sources (lowest -> highest precedence):
- Role defaults/vars (reserved for roles support)
- Inventory vars (reserved for inventory support)
- Play vars (
in playbook)vars: - Task vars (
in task)vars: - Environment (
orBUNOPS_VAR_*)BUNOPS_VARS_JSON - Var files (
), later files override earlier--var-file - CLI vars (
)--var key=value
Examples:
Env:
Inventory
Supports YAML or INI inventory. Use to point to a file or directory.
Group/host vars are read from and in the repo.
Example YAML inventory:
Example INI inventory:
Use flags to select host/group vars:
Template supports variables via in playbook:
Roles
Supports Ansible-like roles:
- roles/<name>/tasks/main.yml
- roles/<name>/templates/
- roles/<name>/files/
Playbook can include roles:
Or inline:
Logging
Set for JSON logs. Default is pretty logs.
Tutorial
- Prepare a repo with
and any referenced files/templates.playbook.yml - Run one cycle:
- Run as daemon:
Example playbook and assets are in .
Подробная документация по модулям: .
systemd example
Build
produces a native binary at using .